[sqlite] Shell not returning 1 on error
This error occurs in 3.8.6: $ echo 'foo' /tmp/foo.sql $ sqlite3 /tmp/foo.db /tmp/foo.sql Error: incomplete SQL: foo $ echo $? 0 0 is the return code from sqlite3 and this should instead return 1 since an error occured. shell.c:3644 if( nSql ){ if( !_all_whitespace(zSql) ){ fprintf(stderr, Error: incomplete SQL: %s\n, zSql); } free(zSql); } free(zLine); return errCnt0; == I think there should be a errCnt++; after the fprintf statement. I recompiled with this statement. It now returns 1 back to the OS. See also: http://stackoverflow.com/questions/26286104/sqlite3-command-line-inconsistent-return-codes Thanks, -John ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] unique constraints
The circumstances I was thinking about is if you had many tables with a column called 'name'. If each table had a different name for the constraint, then they could be differentiated. Otherwise, it would be nice to at least have the name of the table included in the error message. Also, I just noticed this same behavior of foreign key constraints. Even when they are named, a FK violation error message just says: sqlite3.IntegrityError: foreign key constraint failed Again, it would be nice for the error message to report the constraint name and/or the table name. The rationale behind this is the same -- multiple tables could have the same column names and FK constraints. Thanks, -John On Sat, Aug 25, 2012 at 08:13:22PM -0700, Roger Binns wrote: It does tell you the name of the column. Under what circumstances could you not work with that? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] unique constraints
Greetings, This is my first time posting to this list, so I am not sure if this is the correct list or not for this request. If it is not, please let me know the best place for it. Version 3.7.12 has added the following feature: Report the name of specific CHECK constraints that fail. SQLite should also do the same for unique constraints. Example: create table tbl ( name varchar(100), constraint uniq_name unique(name) ); insert into tbl values(john); insert into tbl values(george); insert into tbl values(john); Error: near line 9: column name is not unique Add another constraint to this table: constraint len_name check (length(name) 5) When you rerun the same sql statements you will get this error: Error: near line 9: constraint len_name failed I'd like to see something similar for unique constraints, where you are actully told the name of the unique constraint that failed: Error: near line 9: constraint uniq_name failed Since patching SQLite is beyond my programming capability, how would I best go about getting this added into the program? Thanks, -John Taylor ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users