adding test scripts
[csql.git] / test / cache / Gateway / test004.ksh
blob2aea570e622ce7b2d1831dcb67837a7e6a41cf9a
1 #!/bin/ksh
3 # 4.insert, select, update, delete on table which is not there in both mysql and csql. All should fail.
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 export CSQL_CONFIG_FILE=/tmp/csql.conf
17 echo DSN=$DSN >>$CSQL_CONFIG_FILE
18 DS="$DSN $DBUSER $PASSWORD"
19 rm -f /tmp/csql/csqlds.conf
20 touch /tmp/csql/csqlds.conf
21 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
22 if [ $? -ne 0 ]
23 then
24 exit 1;
27 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
28 pid=$!
29 sleep 5
31 if [ $DSN = "oracle" ]
32 then
33 for a in 51 52 53 54 55
35 echo "insert into t1 values($a,'KKK');"
36 done >> $REL_PATH/oracsqlinputt1.sql
37 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oracsqlinputt1.sql >/dev/null 2>&1
38 else
39 if [ $DSN = "db2" ]
40 then
41 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqldb2inputtest1.sql >/dev/null 2>&1
42 else
43 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqlinputtest1.sql >/dev/null 2>&1
47 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
48 isql $DS < $REL_PATH/selectstar.sql
49 if [ $? -ne 0 ]
50 then
51 cp /tmp/csql.conf $CSQL_CONFIG_FILE
52 exit 2;
55 if [ $DSN = "oracle" ]
56 then
57 echo "select * from t1 where f1 in(10,30,50,54);" >> $REL_PATH/oraselect.sql
58 echo "select * from t1 where f1 between 20 and 54;" >> $REL_PATH/oraselect.sql
59 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdate.sql
60 echo "delete from t1 where f2='BBB';" >> $REL_PATH/oradelete.sql
61 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraselect.sql >/dev/null 2>&1
62 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraupdate.sql >/dev/null 2>&1
63 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oradelete.sql >/dev/null 2>&1
64 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql >/dev/null 2>&1
65 else
66 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/select.sql 2>/dev/null
67 if [ $DSN = "db2" ]
68 then
69 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/db2update.sql 2>/dev/null
70 else
71 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/update.sql 2>/dev/null
73 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/delete.sql 2>/dev/null
74 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql 2>/dev/null
77 isql $DS < $REL_PATH/selectstar.sql 2>/dev/null
78 if [ $? -ne 0 ]
79 then
80 cp /tmp/csql.conf $CSQL_CONFIG_FILE
81 exit 3;
84 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
85 kill -9 $pid
86 rm -f $REL_PATH/ora*.sql
87 ipcrm -M 1199 -M 2277
88 exit 0;