I get an assertion failiure on this statement;
SELECT keyphrase_id, keyphrase, url, googlename FROM keyphrases left join domains on keyphrases.domain_id = domains.domain_id where domain_id = ? and ifnull(keytime,'') != ? order by keyphrase desc;
I ran it through a SQL query checker and it highlighted the “!=” bit citing it wasn’t correct syntax. This doesn’t make sense to me since I was using this statement previously;
SELECT keyphrase_id, keyphrase, url, googlename FROM keyphrases left join domains on keyphrases.domain_id = domains.domain_id where ifnull(keytime,'') != ? order by keyphrase desc;
This is how I bind the where values;
sqlite3_bind_int(selStmt, 1, domain_ID);
sqlite3_bind_text(selStmt, 2, [dateString UTF8String] , -1, SQLITE_TRANSIENT);
I can’t work this out at all and it’s definitely nothing to do with the database being open or the statement being nil when executing etc. since the only component of the method I’m changing is the SQL statement.
Can anyone suggest any possible reasons for this?
If you get a return code from any
sqlite3function call that suggests an error, do another call tosqlite3_errmsgand look at the error message, e.g.This will tell you what’s wrong.
Personally, I would have thought that the reference to
domain_idin thewhereclause was ambiguous, but thesqlite3_errmsgwill tell you precisely what’s going on.