Saturday, December 10, 2011

SQLite.delete with args workaround

This Android SQLite code wasn't working:

    getContentResolver().delete(LogProvider.URI, LogDatabase.COL + " < ?", new String[] { Long.toString(lval) });

But this code does:

    getContentResolver().delete(LogProvider.URI, LogDatabase.COL + " < " + Long.toString(lval), null);

Don't know if it's a bug in SQLite or in the way I was calling it. Doesn't matter, it's an easy enough workaround. Hope this saves somebody else some trouble!

No comments: