#!/bin/sh

# sqltest - fast parser testing using sqlite database.
# Type sqltest --help for usage info.
# Copyright (C) 2004-2006 Jarosław Staniek <staniek@kde.org>

[ $# -lt 1 ] && echo "Usage: $0 <sqlite-database-name> <sql-statement> [-v] [other_options]" && \
 echo " -v    Verbose mode" && exit 1

dir=`dirname $0`
dbname=$1
shift

sql=$1
shift

verbose=0
if [ "$1" = "-v" ] ; then
	verbose=1
	shift
fi

t=/tmp/`basename $0`.XXXXXX
temp=`mktemp $t`

./kexidbtest -test parser sqlite3 "$dbname" "$sql" $* 2> $temp || \
	cat $temp && test "$verbose" -eq 1 && cat $temp

rm -f $temp
