TSQL "IF @@Rowcount > 0" analog in Sqlite? TSQL "IF @@Rowcount > 0" analog in Sqlite? sqlite sqlite

TSQL "IF @@Rowcount > 0" analog in Sqlite?


SQLite's flavor of SQL doesn't have the branch and loop constructs that T-SQL has. Control-flow logic is exercised in the host language.

In your case, you want the sqlite3_changes function. You're going to need it anyway, to decide whether there are any rows to retrieve. Although, as a matter of ease and efficiency, you might as well just execute the query where changes() > 0 if (as I suspect) the query planner is smart enough to return instantly.