On Mon, Jun 16, 2014 at 10:03 PM, <c...@isbd.net> wrote: > Remember - I said I'm doing an INSERT, either it will insert the > intended data or there will be an error. >
If it fails because of a syntax error then the shell exits with non-0. Presumably (based on a quick scan of the code) it does the same for any app-fatal error (e.g. a read-only db, which could cause an insert to fail). You can test this yourself very easily: [odroid@host:~/fossil/cwal/s2]$ sqlite3 foo.db SQLite version 3.7.17 2013-05-20 00:56:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t(a); sqlite> [odroid@host:~/fossil/cwal/s2]$ chmod 0400 foo.db [odroid@host:~/fossil/cwal/s2]$ echo "insert into t values('aaa');" | sqlite3 foo.db Error: near line 1: attempt to write a readonly database [odroid@host:~/fossil/cwal/s2]$ echo $? 1 So yes, it fails. Any specific error code it returns is moot, though, because POSIX doesn't guaranty any specific range of errors other than OK and Not OK. Additionally, a large-enough error code could overflow (as in my first example), leading to unpredictable results. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users