java - How to include arguments in a where-clause in Android SQLite? -



java - How to include arguments in a where-clause in Android SQLite? -

i have table t1, has float column representing julianday. want delete entries julianday older n-day. tried:

db.delete(t1, col_julianday + " <= julianday('now', '- ? days')", new string[] { integer.tostring(days) });

but got error android:

android.database.sqlite.sqliteexception: bind or column index out of range

i think because '?' mark quoted in where-clause.

rather resorting raw sql, suggest trying utilize concatenation operators in clause.

db.delete(t1, col_julianday + " <= julianday('now', '- ' || ? || ' days')", new string[] { integer.tostring(days) });

java android sqlite3

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - cuda, pycuda -- how to write complex numbers -- errors:class "cuComplex" has no member "i" -

How do I check if an insert was successful with MySQLdb in Python? -