test script corresponding to the cases in Wiki pages for the module
[csql.git] / test / cache / Gateway / test001.ksh
blob01cd45836695cf1bf6f041f4500406c08f48dc3f
1 #!/bin/sh
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 CSQL_CONF=${PWD}/cache/Gateway/csql.conf
13 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
14 REL_PATH=.
15 if [ -s "$input" -a -s "$CSQL_CONF" ]
16 then
17 REL_PATH=${PWD}/cache/Gateway
19 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
21 isql myodbc3 < $REL_PATH/mysqlinputtest1.sql > /dev/null 2>&1
23 # edit /tmp/csql/csqltable.conf
24 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
25 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
26 for (( a=1; a<2; a++ ))
28 echo "1:t$a"
29 done >> /tmp/csql/csqltable.conf
30 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
31 pid=$!
32 sleep 5
33 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqlinputtest1.sql >/dev/null 2>&1
34 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
35 isql myodbc3 < $REL_PATH/selectstar.sql
36 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/select.sql
37 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/update.sql >/dev/null 2>&1
38 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/delete.sql >/dev/null 2>&1
39 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
40 isql myodbc3 < $REL_PATH/selectstar.sql
41 isql myodbc3 < $REL_PATH/dropall.sql > /dev/null 2>&1
42 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
43 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
44 kill -9 $pid
45 ipcrm -M 1199 -M 2277
46 exit 0;