3 # 1. Create table t1 in MySQL with all supported data types in it. and insert 10 records in it.
4 # Cache the table in CSQL. and run csqlserver -c to load the records.
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
16 REL_PATH
=${PWD}/cache
/Gateway
20 cp $REL_PATH/csql.conf
/tmp
/csql.conf
21 echo CSQL_SQL_SERVER
=true
>>/tmp
/csql.conf
22 echo PORT
=6028 >>/tmp
/csql.conf
23 export CSQL_CONFIG_FILE
=/tmp
/csql.conf
24 echo DSN
=$DSN >>$CSQL_CONFIG_FILE
25 DS
="$DSN $DBUSER $PASSWORD"
26 rm -f /tmp
/csql
/csqlds.conf
27 touch /tmp
/csql
/csqlds.conf
28 $CSQL_INSTALL_ROOT/bin
/csqlds
-U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
35 if [ $DSN = "oracle" ]
37 isql
$DS < $REL_PATH/orainputt1.oracle
>/dev
/null
2>&1
38 elif [ $DSN = "sybase" ]
40 isql
$DS < $REL_PATH/sybaseinputtest1.sql
>/dev
/null
2>&1
43 isql
$DS < $REL_PATH/db2inputtest1.sql
>/dev
/null
2>&1
45 isql
$DS < $REL_PATH/mysqlinputtest1.sql
>/dev
/null
2>&1
49 echo "DSN is not set for target db"
53 # edit /tmp/csql/csqltable.conf
54 rm -f /tmp
/csql
/csqltable.conf
55 touch /tmp
/csql
/csqltable.conf
56 $CSQL_INSTALL_ROOT/bin
/csqlserver
>/dev
/null
2>&1 &
60 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t1
-d $DSN
68 if [ $DSN = "oracle" ]
70 for a
in 51 52 53 54 55
72 echo "insert into t1 values($a,'KKK');"
73 done >> $REL_PATH/oracsqlinputt1.sql
74 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/oracsqlinputt1.sql
>/dev
/null
2>&1
78 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/csqldb2inputtest1.sql
>/dev
/null
2>&1
80 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/csqlinputtest1.sql
>/dev
/null
2>&1
86 echo "Server Not Open"
90 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/selectstar.sql
91 isql
$DS < $REL_PATH/selectstar.sql
94 cp /tmp
/csql.conf
$CSQL_CONFIG_FILE
98 if [ $DSN = "oracle" ]
100 echo "select * from t1 where f1 in(10,30,50,54);" >> $REL_PATH/oraselect.sql
101 echo "select * from t1 where f1 between 20 and 54;" >> $REL_PATH/oraselect.sql
102 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdate.sql
103 echo "delete from t1 where f2='BBB';" >> $REL_PATH/oradelete.sql
104 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/oraselect.sql
105 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/oraupdate.sql
>/dev
/null
2>&1
106 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/oradelete.sql
>/dev
/null
2>&1
107 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/selectstar.sql
109 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/select.sql
112 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/db2update.sql
>/dev
/null
2>&1
114 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/update.sql
>/dev
/null
2>&1
116 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/delete.sql
>/dev
/null
2>&1
117 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6028 -g -s $REL_PATH/selectstar.sql
121 isql
$DS < $REL_PATH/selectstar.sql
122 isql
$DS < $REL_PATH/dropt1t2t3.sql
> /dev
/null
2>&1
123 rm -f $REL_PATH/ora
*.sql
124 rm -f /tmp
/csql
/csqltable.conf
125 touch /tmp
/csql
/csqltable.conf
127 ipcrm
-M 1199 -M 2277
128 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`