windows porting build fix for linux
[csql.git] / test / cache / Gateway / test004n.ksh
blobc94486293df7001cd4bebd94b214606a40aea028
1 #!/bin/ksh
2 #insert, select, update, delete on table which is not there in both mysql and csql. All should fail.
3 #Run this test only under csql/test or on this directory.
4 #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=6006 >>/tmp/csql.conf
18 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;
29 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
30 pid=$!
31 sleep 5
33 if [ $DSN = "oracle" ]
34 then
35 for a in 51 52 53 54 55
37 echo "insert into t1 values($a,'KKK');"
38 done >> $REL_PATH/oracsqlinputt1.sql
39 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/oracsqlinputt1.sql >/dev/null 2>&1
40 else
41 if [ $DSN = "db2" ]
42 then
43 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/csqldb2inputtest1.sql >/dev/null 2>&1
44 else
45 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/csqlinputtest1.sql >/dev/null 2>&1
48 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/selectstar.sql
49 isql $DS < $REL_PATH/selectstar.sql
50 if [ $? -ne 0 ]
51 then
52 cp /tmp/csql.conf $CSQL_CONFIG_FILE
53 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 -H localhost -P 6006 -g -s $REL_PATH/oraselect.sql >/dev/null 2>&1
62 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/oraupdate.sql >/dev/null 2>&1
63 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/oradelete.sql >/dev/null 2>&1
64 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/selectstar.sql >/dev/null 2>&1
65 else
66 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/select.sql 2>/dev/null
67 if [ $DSN = "db2" ]
68 then
69 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/db2update.sql 2>/dev/null
70 else
71 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/update.sql 2>/dev/null
73 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -g -s $REL_PATH/delete.sql 2>/dev/null
74 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6006 -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 ipcrm -M 1199 -M 2277
87 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
88 rm -f $REL_PATH/ora*.sql
89 exit 0;