adding test scripts
[csql.git] / test / cache / Gateway / test012b.ksh
blobc4fde1492b0fc910787a4584834654f08fff28ef
1 #!/bin/ksh
3 # 12.csqlserver not running
4 # b)connect, update
5 # noncached table in mysql(should work), cached table (work), csql table (fail)
7 #Run this test only under csql/test or on this directory.
8 #Otherwise, it may fail
9 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Gateway
15 rm /tmp/csql.conf
17 cp $REL_PATH/csql.conf /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 if [ $DSN = "oracle" ]
50 then
51 isql $DS < $REL_PATH/orainputt2.oracle > /dev/null 2>&1
52 elif [ $DSN = "sybase" ]
53 then
54 isql $DS < $REL_PATH/sybaseinputtest12.sql > /dev/null 2>&1
55 elif [ $DSN = "db2" ]
56 then
57 isql $DS < $REL_PATH/db2inputtest12.sql > /dev/null 2>&1
58 else
59 isql $DS < $REL_PATH/mysqlinputtest12.sql > /dev/null 2>&1
61 # edit /tmp/csql/csqltable.conf
62 rm -f /tmp/csql/csqltable.conf
63 touch /tmp/csql/csqltable.conf
65 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
66 pid=$!
67 sleep 5
68 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $DSN
69 if [ $? -ne 0 ]
70 then
71 kill -9 $pid
72 ipcrm -M 1199 -M 2277
73 exit 3;
76 if [ $DSN = "oracle" ]
77 then
78 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/orainputt3.oracle >/dev/null 2>&1
79 else
80 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest12.sql >/dev/null 2>&1
83 kill -9 $pid
84 ipcrm -M 1199 -M 2277
86 if [ $DSN = "oracle" ]
87 then
88 echo "update t2 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdatet2.sql
89 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdatet1.sql
90 echo "update t3 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdatet3.sql
91 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraupdatet2.sql
92 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraupdatet1.sql
93 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraupdatet3.sql
94 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstart2.sql
95 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
96 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstart3.sql
97 else
98 if [ $DSN = "db2" ]
99 then
100 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/db2updatet2.sql
101 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/db2update.sql
102 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/db2updatet3.sql
103 else
104 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/updatet2.sql
105 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/update.sql
106 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/updatet3.sql
108 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstart2.sql
109 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
110 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstart3.sql
113 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
115 rm -f /tmp/csql/csqltable.conf
116 rm -f $REL_PATH/oraup*.sql
117 touch /tmp/csql/csqltable.conf
118 exit 0;