1

I have an update statement that does not work properly and want to know how the final statement looks like. Is there a way to print out the statements generated by the Android SQLiteOpenHelper?

So far I managed to get a hold of the unpopulated statement by stepping through the stacktrace:

UPDATE banks SET fav=? WHERE code = ? AND name = ?

The syntax of the unpopulated statement is correct.

Philipp
  • 788
  • 1
  • 11
  • 23
  • what does "not work properly" mean? Is there an error? Or does the statement not do what is supposed to do? Can you give us an example of what you are expecting the statement to look like? – browep Jul 08 '11 at 14:31
  • The statement does not what it is supposed to do, i.e. after executing the update the data in the row remains unchanged. A complete statement should look like this: `UPDATE banks SET fav=1 WHERE code = '12030000' AND name = 'XYZ Bank'` – Philipp Jul 11 '11 at 08:14
  • try updating your question with some actual java code, we may be able to spot the issue if we know exactly what calls you are making. – browep Jul 22 '11 at 13:33

1 Answers1

0

You might want to try to use a SQLiteQueryBuilder in addition to the SQLiteOpenHelper. You can use the buildQuery() method, which returns a string, to get the output of the query statement and the query() method, which returns a cursor, to run a query.

Stefan Bossbaly
  • 6,682
  • 9
  • 53
  • 82
  • The API doc says that buildQuery() can be used to create SELECT statements, but I use an UPDATE statement. – Philipp Jul 11 '11 at 08:04