adding test scripts
[csql.git] / test / cache / Gateway / test010n.ksh
blob231a0226d8d06c7941350b86a9ae20d04fb29bc0
1 #!/bin/ksh
3 # 10.Table there in csql and mysql and not cached. insert should insert only to csql table.
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
13 rm -f /tmp/csql.conf
15 cp $REL_PATH/csql.conf /tmp/csql.conf
16 echo CSQL_SQL_SERVER=true >>/tmp/csql.conf
17 echo PORT=6018 >>/tmp/csql.conf
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
20 echo DSN=$DSN >>$CSQL_CONFIG_FILE
21 DS="$DSN $DBUSER $PASSWORD"
22 rm -f /tmp/csql/csqlds.conf
23 touch /tmp/csql/csqlds.conf
24 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
25 if [ $? -ne 0 ]
26 then
27 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/sybaseinputtest1.sql >/dev/null 2>&1
36 elif [ $DSN = "db2" ]
37 then
38 isql $DS < $REL_PATH/db2inputtest1.sql >/dev/null 2>&1
39 else
40 isql $DS < $REL_PATH/mysqlinputtest1.sql > /dev/null 2>&1
43 if [ $? -ne 0 ]
44 then
45 echo "DSN is not set for target db"
46 exit 1
49 isql $DS < $REL_PATH/selectstar.sql
50 if [ $? -ne 0 ]
51 then
52 cp /tmp/csql.conf $CSQL_CONFIG_FILE
53 exit 2;
56 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
57 pid=$!
58 sleep 5
59 if [ $DSN = "oracle" ]
60 then
61 echo "insert into t1 values(100,'GGG');" >> $REL_PATH/orainsert.sql
62 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/orainputt1.oracle >/dev/null 2>&1
63 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6018 -g -s $REL_PATH/selectstar.sql
64 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6018 -g -s $REL_PATH/orainsert.sql
65 else
66 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest10.sql >/dev/null 2>&1
67 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6018 -g -s $REL_PATH/selectstar.sql
68 if [ $DSN = "db2" ]
69 then
70 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6018 -g -s $REL_PATH/insert.sql
71 else
72 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6018 -g -s $REL_PATH/insertdb2.sql
76 isql $DS < $REL_PATH/selectstar.sql
77 if [ $? -ne 0 ]
78 then
79 cp /tmp/csql.conf $CSQL_CONFIG_FILE
80 exit 3;
83 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6018 -g -s $REL_PATH/selectstar.sql
84 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
85 rm -f $REL_PATH/ora*.sql
86 rm -f /tmp/csql/csqltable.conf
87 touch /tmp/csql/csqltable.conf
88 kill -9 $pid
89 ipcrm -M 1199 -M 2277
90 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
91 exit 0;