adding test scripts
[csql.git] / test / cache / Gateway / test006n.ksh
blob73043610b7f87c2c28d73b4fbae8cf3b4a8cf6ab
1 #!/bin/ksh
3 # 6. Non cached table there in csql and mysql. run complex query (avg on some field). It should get the correct value from mysql.
5 #Run this test only under csql/test or on this directory.
6 #Otherwise, it may fail
7 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
8 REL_PATH=.
9 if [ -s "$input" ]
10 then
11 REL_PATH=${PWD}/cache/Gateway
14 cp $REL_PATH/csql.conf /tmp/csql.conf
15 echo CSQL_SQL_SERVER=true >>/tmp/csql.conf
16 echo PORT=6010 >>/tmp/csql.conf
17 export CSQL_CONFIG_FILE=/tmp/csql.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
20 DS="$DSN $DBUSER $PASSWORD"
21 rm -f /tmp/csql/csqlds.conf
22 touch /tmp/csql/csqlds.conf
23 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
24 if [ $? -ne 0 ]
25 then
26 exit 1;
30 if [ $DSN = "oracle" ]
31 then
32 isql $DS < $REL_PATH/orainputt1.oracle >/dev/null 2>&1
33 elif [ $DSN = "sybase" ]
34 then
35 isql $DS < $REL_PATH/sybaseinputtest5.sql > /dev/null 2>&1
36 elif [ $DSN = "db2" ]
37 then
38 isql $DS < $REL_PATH/db2inputtest5.sql > /dev/null 2>&1
39 else
40 isql $DS < $REL_PATH/mysqlinputtest5.sql > /dev/null 2>&1
43 if [ $? -ne 0 ]
44 then
45 echo "DSN is not set for target db"
46 exit 1
49 # edit /tmp/csql/csqltable.conf
51 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
52 pid=$!
53 sleep 5
55 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6010 -g -s $REL_PATH/selectstar.sql
57 if [ $DSN = "oracle" ]
58 then
59 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6010 -g -s $REL_PATH/complex.oracle
60 elif [ $DSN = "sybase" -o $DSN = "db2" ]
61 then
62 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6008 -g -s $REL_PATH/complex.sybase
63 else
64 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6010 -g -s $REL_PATH/complex.sql
67 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
68 kill -9 $pid
69 ipcrm -M 1199 -M 2277
70 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
71 exit 0;