2 # 2. Create table t1 in MySQL with all supported data types in it. and insert 10 records in it.
3 # Note that in this test case the table is not cached in csql and it is present only in MySQL.
4 # insert 10 more records using csql tool.
5 # select records with WHERE clause containing parameters for all the fields with different data types.
6 # update all fields with WHERE clause on primary key
7 # delete records with WHERE clause on all fields
8 #Run this test only under csql/test or on this directory.
9 #Otherwise, it may fail
10 input
=${PWD}/cache
/Gateway
/mysqlinputtest1.sql
14 REL_PATH
=${PWD}/cache
/Gateway
18 cp $REL_PATH/csql.conf
/tmp
/csql.conf
19 echo CSQL_SQL_SERVER
=true
>>/tmp
/csql.conf
20 echo PORT
=6002 >>/tmp
/csql.conf
21 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
33 if [ $DSN = "oracle" ]
35 isql
$DS < $REL_PATH/orainputt1.oracle
>/dev
/null
2>&1
36 elif [ $DSN = "sybase" ]
38 isql
$DS < $REL_PATH/sybaseinputtest1.sql
>/dev
/null
2>&1
41 isql
$DS < $REL_PATH/db2inputtest1.sql
>/dev
/null
2>&1
43 isql
$DS < $REL_PATH/mysqlinputtest1.sql
>/dev
/null
2>&1
48 echo "DSN is not set for target db"
52 # edit /tmp/csql/csqltable.conf
53 rm -f /tmp
/csql
/csqltable.conf
54 touch /tmp
/csql
/csqltable.conf
55 $CSQL_INSTALL_ROOT/bin
/csqlserver
>/dev
/null
2>&1 &
58 if [ $DSN = "oracle" ]
60 for a
in 51 52 53 54 55
62 echo "insert into t1 values($a,'KKK');"
63 done >> $REL_PATH/oracsqlinputt1.sql
64 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/oracsqlinputt1.sql
>/dev
/null
2>&1
68 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/csqldb2inputtest1.sql
>/dev
/null
2>&1
70 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/csqlinputtest1.sql
>/dev
/null
2>&1
76 echo "Server not opened"
80 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/selectstar.sql
>/dev
/null
2>&1
81 isql
$DS < $REL_PATH/selectstar.sql
83 if [ $DSN = "oracle" ]
85 echo "select * from t1 where f1 in(10,30,50,54);" >> $REL_PATH/oraselect.sql
86 echo "select * from t1 where f1 between 20 and 54;" >> $REL_PATH/oraselect.sql
87 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdate.sql
88 echo "delete from t1 where f2='BBB';" >> $REL_PATH/oradelete.sql
89 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/oraselect.sql
>/dev
/null
2>&1
90 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/oraupdate.sql
>/dev
/null
2>&1
91 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/oradelete.sql
>/dev
/null
2>&1
92 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/selectstar.sql
>/dev
/null
2>&1
94 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/select.sql
>/dev
/null
2>&1
97 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/db2update.sql
>/dev
/null
2>&1
99 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/update.sql
>/dev
/null
2>&1
101 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/delete.sql
>/dev
/null
2>&1
102 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6002 -g -s $REL_PATH/selectstar.sql
>/dev
/null
2>&1
105 isql
$DS < $REL_PATH/selectstar.sql
106 isql
$DS < $REL_PATH/dropt1t2t3.sql
> /dev
/null
2>&1
107 rm -f /tmp
/csql
/csqltable.conf
108 rm -f $REL_PATH/ora
*.sql
109 touch /tmp
/csql
/csqltable.conf
111 ipcrm
-M 1199 -M 2277
112 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`