I've created a query to delete rows from my table if they match some criteria.
sqlite3_prepare(sqlite->db, "DELETE FROM test WHERE field1=? AND field2=? AND field3=? AND field4=? AND field5=?", -1, &sqlite->deleteSymbol, 0);
I then bind them to NULL terminated strings. However, if any of the strings passed by the caller of my function is NULL, then this means that any value for the given column should match.
I.e., if field1
, field3
and field5
are NULL, then the query would be equivalent to
DELETE FROM test WHERE field2=? AND field4=?
Can this be achieved while reusing the output of sqlite3_prepare, without creating separate queries for each combination of NULL/non-NULL strings?