I have the following code. When I open my SQLite db I can see the patient with Id = 1235 is created but not with Id = 1234:
String sql;
sql = "INSERT INTO Users(Id, Name, Surname, LastLogin)VALUES(1234, 'john', 'foo', null)";
database.rawQuery(sql, null);
sql = "INSERT INTO Users(Id, Name, Surname, LastLogin)VALUES(1235, 'john', 'foo', null);";
database.execSQL(sql);
The documentation for rawQuery() states:
the SQL query. The SQL string must not be ; terminated
and this is indeed the case in my 1st query. (the other difference is the Id. I changed it so that both inserts could work, Id is index).
Using the debugger I can confirm that both queries are executed and I don’t get any exceptions or errors.
Any idea? I have spent hours on this but I could not figure it out. I guess it is something very trivial that I am missing.
Though I cannot find this in the documentation, what I understand is that rawQuery is meant for SELECT queries. It is just a “raw” interface to what “query” methods do.