adding test scripts
[csql.git] / test / cache / Gateway / test003.ksh
blob120c405ef6d40ba564cdf489fdc4dc911cdd2c92
1 #!/bin/ksh
3 # 3. Create table t1 in CSQL with all supported data types in it. and insert 5 records in it using csql tool with -g option.
4 # Note that in this test case the table is not cached in csql and is present in csql
5 # insert 5 more records using csql tool with -g option.
6 # select records with WHERE clause containing parameters for all the fields with different data types.
7 # update all fields with WHERE clause on primary key using csql tool with -g option.
8 # delete records with WHERE clause on all fields using csql tool with -g option
10 #Run this test only under csql/test or on this directory.
11 #Otherwise, it may fail
12 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
13 REL_PATH=.
14 if [ -s "$input" ]
15 then
16 REL_PATH=${PWD}/cache/Gateway
18 rm -f /tmp/csql.conf
20 # edit /tmp/csql/csqltable.conSQL_CONFIG_FILE /tmp/csql.conf
21 cp $REL_PATH/csql.conf /tmp/csql.conf
22 export CSQL_CONFIG_FILE=/tmp/csql.conf
23 echo DSN=$DSN >>$CSQL_CONFIG_FILE
24 DS="$DSN $DBUSER $PASSWORD"
25 rm -f /tmp/csql/csqlds.conf
26 touch /tmp/csql/csqlds.conf
27 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
28 if [ $? -ne 0 ]
29 then
30 exit 1;
33 rm -f /tmp/csql/csqltable.conf
34 touch /tmp/csql/csqltable.conf
36 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
37 pid=$!
38 sleep 5
40 if [ $DSN = "oracle" ]
41 then
42 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/orainput_t1.oracle >/dev/null 2>&1
43 else
44 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqlinputtest3.sql >/dev/null 2>&1
47 if [ $? -ne 0 ]
48 then
49 echo "Unable Start Server"
50 exit 1
53 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
54 isql $DS < $REL_PATH/selectstar.sql 2>&1
55 if [ $? -ne 0 ]
56 then
57 cp /tmp/csql.conf $CSQL_CONFIG_FILE
58 exit 2;
61 if [ $DSN = "oracle" ]
62 then
63 for a in 51 52 53 54 55
65 echo "insert into t1 values($a,'KKK');"
66 done >> $REL_PATH/oracsqlinputt1.sql
67 echo "select * from t1 where f1 in(10,30,50,54);" >> $REL_PATH/oraselect.sql
68 echo "select * from t1 where f1 between 20 and 54;" >> $REL_PATH/oraselect.sql
69 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdate.sql
70 echo "delete from t1 where f2='BBB';" >> $REL_PATH/oradelete.sql
71 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oracsqlinputt1.sql >/dev/null 2>&1
72 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraselect.sql
73 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oraupdate.sql >/dev/null 2>&1
74 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/oradelete.sql >/dev/null 2>&1
75 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
76 else
77 if [ $DSN = "db2" ]
78 then
79 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqldb2inputtest3a.sql >/dev/null 2>&1
80 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/select.sql
81 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/db2update.sql >/dev/null 2>&1
82 else
83 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqlinputtest3a.sql >/dev/null 2>&1
84 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/select.sql
85 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/update.sql >/dev/null 2>&1
87 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/delete.sql >/dev/null 2>&1
88 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
91 isql $DS < $REL_PATH/selectstar.sql 2>&1
92 if [ $? -ne 0 ]
93 then
94 cp /tmp/csql.conf $CSQL_CONFIG_FILE
95 exit 3;
98 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
99 rm -f $REL_PATH/ora*.sql
100 rm -f /tmp/csql/csqltable.conf
101 touch /tmp/csql/csqltable.conf
102 kill -9 $pid
103 ipcrm -M 1199 -M 2277
104 exit 0;