64 bit build fix
[csql.git] / test / cache / Gateway / test003n.ksh
blobab16c9f6dc12b4c713cd7fdb2727dffbc03b59f5
1 #!/bin/ksh
3 # 3. Create table t1 in CSQL with all supported data types in it. and insert 10 records in it.
4 # Note that in this test case the table is not cached in csql and is present in csql
5 # insert 10 more records using csql tool.
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
8 # delete records with WHERE clause on all fields
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 echo CSQL_SQL_SERVER=true >>/tmp/csql.conf
23 echo PORT=6004 >>/tmp/csql.conf
24 export CSQL_CONFIG_FILE=/tmp/csql.conf
25 echo DSN=$DSN >>$CSQL_CONFIG_FILE
26 DS="$DSN $DBUSER $PASSWORD"
27 rm -f /tmp/csql/csqlds.conf
28 touch /tmp/csql/csqlds.conf
29 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
30 if [ $? -ne 0 ]
31 then
32 exit 1;
35 rm -f /tmp/csql/csqltable.conf
36 touch /tmp/csql/csqltable.conf
38 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
39 pid=$!
40 sleep 5
42 if [ $DSN = "oracle" ]
43 then
44 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/orainput_t1.oracle >/dev/null 2>&1
45 else
46 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/csqlinputtest3.sql >/dev/null 2>&1
49 if [ $? -ne 0 ]
50 then
51 echo "Unable Start Server"
52 exit 2
55 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/selectstar.sql
56 isql $DS < $REL_PATH/selectstar.sql 2>&1
57 if [ $? -ne 0 ]
58 then
59 cp /tmp/csql.conf $CSQL_CONFIG_FILE
60 exit 2;
63 if [ $DSN = "oracle" ]
64 then
65 for a in 51 52 53 54 55
67 echo "insert into t1 values($a,'KKK');"
68 done >> $REL_PATH/oracsqlinputt1.sql
69 echo "select * from t1 where f1 in(10,30,50,54);" >> $REL_PATH/oraselect.sql
70 echo "select * from t1 where f1 between 20 and 54;" >> $REL_PATH/oraselect.sql
71 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdate.sql
72 echo "delete from t1 where f2='BBB';" >> $REL_PATH/oradelete.sql
73 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/oracsqlinputt1.sql >/dev/null 2>&1
74 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/oraselect.sql
75 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/oraupdate.sql >/dev/null 2>&1
76 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/oradelete.sql >/dev/null 2>&1
77 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/selectstar.sql
78 else
79 if [ $DSN = "db2" ]
80 then
81 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/csqldb2inputtest3a.sql >/dev/null 2>&1
82 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/select.sql
83 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/db2update.sql >/dev/null 2>&1
84 else
85 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/csqlinputtest3a.sql >/dev/null 2>&1
86 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/select.sql
87 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/update.sql >/dev/null 2>&1
89 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/delete.sql >/dev/null 2>&1
90 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6004 -g -s $REL_PATH/selectstar.sql
93 isql $DS < $REL_PATH/selectstar.sql 2>&1
94 if [ $? -ne 0 ]
95 then
96 cp /tmp/csql.conf $CSQL_CONFIG_FILE
97 exit 3;
100 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
101 rm -f $REL_PATH/ora*.sql
102 rm -f /tmp/csql/csqltable.conf
103 touch /tmp/csql/csqltable.conf
104 kill -9 $pid
105 ipcrm -M 1199 -M 2277
106 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
107 exit 0;