Note that there are some explanatory texts on larger screens.

plurals
  1. PODebugging sqlite
    text
    copied!<p>Is there a way to see what the resulting 'showStatement' is after sqlite3_prepare_v2 and sqlite3_bind_xxx ?</p> <p>Running this query :</p> <pre><code>SELECT * FROM shows, locations WHERE (shows.day_id = 1) AND (shows.id IN (6,7,15,19,23,66)) AND (shows.location_id = locations.id) ORDER by locations.sort_order </code></pre> <p>runs perfectly in SQLite Manager and in code when I enter it EXACTLY like that. If I however do parameter substitution the query returns no results...</p> <pre><code>if (sqlite3_open([databasePath UTF8String],&amp;showsDatabase) == SQLITE_OK){ const char *sqlStatement = "SELECT * FROM shows, locations WHERE (shows.day_id = ?) AND (shows.id IN (?)) AND (shows.location_id = locations.id) ORDER by locations.sort_order"; sqlite3_stmt *showStatement; if(sqlite3_prepare_v2(showsDatabase, sqlStatement, -1, &amp;showStatement, NULL) == SQLITE_OK) { sqlite3_bind_int(showStatement, 1, forDay); sqlite3_bind_text(showStatement, 2, allFavorites,-1,NULL); int error = sqlite3_step(showStatement); while(sqlite3_step(showStatement) == SQLITE_ROW) { </code></pre> <p>...</p> <p>The problem must lie in the IN (6,7...) part, without that it works perfect.</p> <p>My debugger shows me that forDay = 1 and that allFavorites = 6,7,15,19,23,66 but the error = 101 = sqlite3_step() has finished executing = no lines found</p> <p>Being able to see the 'showStatement' variable in one way or another would solve the problem, however the debugger doesn't give that info</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload