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
Post a Comment