On 8-6-2019 15:26, Simon Slavin wrote:
Use

     .bail ON

If the shell bails out because of an error, it should be setting the exit code 
to indicate an error.

unfortunatly still 0 is returned  (sqlite3 version 3.28.0)

~/temp> cat empty.sh
#!/bin/bash

rm -f empty.db empty.csv
echo "" > empty.csv
echo "a, b" >> empty.csv
sqlite3 empty.db \
'.bail on' \
'DROP TABLE IF EXISTS empty;' \
'.mode csv' \
'CREATE TABLE IF NOT EXISTS empty(A, B NOT NULL);' \
'.import empty.csv empty' \
'.exit'
echo "error code is" $?

~/temp> ./empty.sh
empty.csv:1: expected 2 columns but found 1 - filling the rest with NULL
empty.csv:1: INSERT failed: NOT NULL constraint failed: empty.B
error code is 0
~/temp>


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to