[sqlite] Determine type of prepared statement via C Interface?

2015-05-09 Thread Stephan Beal
On Fri, May 8, 2015 at 7:01 PM, Stephen Broberg wrote: > (e.g., insert, update, delete, select, etc.). Specifically, I?d like to > know whether a statement that either has run or is about to be run (via > sqlite3_step) is a read-only (select) or write (pretty much everything > else) operation.

[sqlite] Determine type of prepared statement via C Interface?

2015-05-08 Thread Zsbán Ambrus
On Fri, May 8, 2015 at 8:20 PM, Simon Slavin wrote: > Suppose you have this statement > > DELETE FROM myTable WHERE id=600 > > and there are no rows with id=600. I presume that the function will return > FALSE but a literal reading of the description says that it will return TRUE. > If I'm

[sqlite] Determine type of prepared statement via C Interface?

2015-05-08 Thread Simon Slavin
On 8 May 2015, at 6:43pm, Peter Aronson wrote: > Well, there's sqlite3_stmt_readonly which appears to do pretty much what > you're asking for: https://www.sqlite.org/c3ref/stmt_readonly.html. Suppose you have this statement DELETE FROM myTable WHERE id=600 and there are no rows with

[sqlite] Determine type of prepared statement via C Interface?

2015-05-08 Thread Stephen Broberg
Using versions 3.8.5 and 3.7.7.1: Is there something in the SQLite C API that will tell what type of statement a prepared sqlite3_stmt is (e.g., insert, update, delete, select, etc.). Specifically, I?d like to know whether a statement that either has run or is about to be run (via

[sqlite] Determine type of prepared statement via C Interface?

2015-05-08 Thread Scott Hess
On Fri, May 8, 2015 at 11:20 AM, Simon Slavin wrote: > On 8 May 2015, at 6:43pm, Peter Aronson wrote: >> Well, there's sqlite3_stmt_readonly which appears to do pretty much what >> you're asking for: https://www.sqlite.org/c3ref/stmt_readonly.html. > > Suppose you have this statement > > DELETE

[sqlite] Determine type of prepared statement via C Interface?

2015-05-08 Thread Peter Aronson
Well, there's sqlite3_stmt_readonly which appears to do pretty much what you're asking for: https://www.sqlite.org/c3ref/stmt_readonly.html. Or, if you want more detailed control, there's the whole authorizer interface: https://www.sqlite.org/c3ref/set_authorizer.html. Peter On 5/8/2015

[sqlite] Determine type of prepared statement via C Interface?

2015-05-08 Thread Scott Hess
sqlite3_stmt_readonly(stmt)? This hits INSERT/UPDATE/DELETE, but not BEGIN/COMMIT/ROLLBACK. Or sqlite3_sql(stmt) if you want to do it heuristically by inspecting the statement. I think a "BEGIN READONLY" would be a sensible transaction type. Having a wrapper API force the developer to select