Re: [sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Stephen Chrzanowski
Which is where you put into the decision 'black box' of your program a check to see how many rows were modified. If something was supposed to be changed, but zero rows were updated, throw an alert. If one or a reasonable amount were changed, don't inform the user. If more than a reasonable amoun

Re: [sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Frederick Wasti
Thanks for your replies. What you have all said makes sense (and, in my defense, I did suggest that a nonsense - but properly formed - SQL statement could still be processed "OK"). :-) I first noticed this situation when studying the sample code for the "SmartDB" C++ wrapper for SQLite. The author

Re: [sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Simon Slavin
On 22 Feb 2013, at 10:23pm, Simon Slavin wrote: > DELETE FROM customers WHERE name = "John Johnson" That should of course have been DELETE FROM customers WHERE name = 'John Johnson' I'm terribly sorry to have shamed the SQLite community this way. Simon. __

Re: [sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Eric Sink
In your example, the only way SQLite can do what you expect is to notice that your UPDATE didn't modify any rows. But you don't want an UPDATE statement throwing errors simply because it didn't modify any rows. There are many situations where that happens and is considered normal behavior.

Re: [sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Jay A. Kreibich
On Fri, Feb 22, 2013 at 05:15:15PM -0500, Frederick Wasti scratched on the wall: > So, my question is: Is it correct for sqlite3_exec() to return SQLITE_OK if > the SQL query is doomed to failure (but is otherwise properly formed)? The SQL query did not fail. It did exactly what you asked: upd

Re: [sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Simon Slavin
On 22 Feb 2013, at 10:15pm, Frederick Wasti wrote: > From the documentation on sqlite3_exec(), it seems as if it should return > SQLITE_OK (=0) upon processing a successful SQL query. However, I was a > bit surprised to see that an SQL statement such as "UPDATE table1 SET > site='Site1' WHERE si

[sqlite] Return Value from sqlite3_exec()

2013-02-22 Thread Frederick Wasti
[A "newbie to SQLite" here...] >From the documentation on sqlite3_exec(), it seems as if it should return SQLITE_OK (=0) upon processing a successful SQL query. However, I was a bit surprised to see that an SQL statement such as "UPDATE table1 SET site='Site1' WHERE site='garbage' (where garbage r