From ec81b04b6e996b56fbc3e6d1cba281d97d4a6ab8 Mon Sep 17 00:00:00 2001 From: Paul Reeves Date: Thu, 26 Jan 2023 15:57:53 +0100 Subject: [PATCH] Misc changes to improve error output --- test/execsql.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/test/execsql.sh b/test/execsql.sh index 17f1fd4..2ff2d5e 100755 --- a/test/execsql.sh +++ b/test/execsql.sh @@ -439,7 +439,7 @@ if [ -f $DBFILENAME ]; then echo "" >> recreate_db.ddl fi #echo "create database 'localhost:$ALIAS';" >> recreate_db.ddl -echo "create database '$ALIAS';" >> recreate_db.ddl +echo "create database '$ALIAS' SET NAMES 'UTF8';" >> recreate_db.ddl echo "commit;" >> recreate_db.ddl #echo "connect '$ALIAS';" >> recreate_db.ddl @@ -450,13 +450,14 @@ echo "commit;" >> recreate_db.ddl #run creation script if [ -f $ALIAS.sql ]; then echo Running $ALIAS.sql... - ${FIREBIRD_BIN}/isql -b -user FWFRAMEWORK_OWNER -pass masterkey -role RDB$ADMIN -e -i $ALIAS.sql -o $ALIAS.txt -m -m2 > /dev/null + ${FIREBIRD_BIN}/isql -b -user DB_OWNER -pass masterkey -role RDB$ADMIN -e -i $ALIAS.sql -o $ALIAS.txt -m -m2 > /dev/null else echo Could not find $ALIAS.sql. echo Exiting. exit; fi +# This should be part of recreate_db.ddl if [ $(whoami) = "root" ]; then chown firebird.firebird $DBFILENAME chmod 660 $DBFILENAME @@ -464,9 +465,13 @@ fi #print errors -echo Checking for Errors -cat $ALIAS.txt | grep -B 16 -A 16 "Statement failed" -if [ $? -gt 0 ]; then +echo +echo Checking for Errors... + echo + echo +#cat $ALIAS.txt | grep -B 16 -A 16 "Statement failed" +_err_count=$(cat $ALIAS.txt | grep -c "Statement failed") +if [ $_err_count -eq 0 ]; then echo No errors found. echo Script completed successfully. echo @@ -474,9 +479,13 @@ if [ $? -gt 0 ]; then echo echo Here are the last lines from $ALIAS.txt echo - tail -n 20 $ALIAS.txt - echo + tail -n 30 $ALIAS.txt +else + echo Script failed with the following errors: + cat $ALIAS.txt | grep -B 3 -A 4 "Statement failed" fi + echo + echo echo "$(date) Completed." }