SQLite でこのクエリを実行したいと思います。
update table1 set col1 = (? || substr (col1, col2))
where table1.id in (select id from table2 where condition);
これを行う方法がわかりません。SQLiteDatabase.rawQuery が機能しません。私が見た他のすべての API では、「set」部分で式を使用できません。SQLiteStatement を使用できれば機能します。しかし、そのコンストラクターは、私のコードではなく、そのパッケージでのみ表示されます:(
理想的には、次のようにします。
String query =
"update Table1 set " +
" col1 = (? || substr (col1, col2)), " +
" col2 = ? " +
"where Table1.id in " +
" (select id from Table2 where col3 = ?)";
String[] args = new String[3];
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
SQLiteStatement statement = new SQLiteStatement (getDb(), query, args);
int rowsUpdated = 0;
try
{
rowsUpdated = statement.executeUpdateDelete();
} finally {
statement.close();
}
何か案は?ありがとう。