version 1.0
[csql.git] / test / cache / Gateway / test002.ksh
blobae5b3110d09693060d78dbf7767e1b476763048e
1 #!/bin/sh
3 # 2. Create table t1 in MySQL 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 it is present only in MySQL.
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 rm -f /tmp/csql.conf
20 cp $REL_PATH/csql.conf /tmp
21 export CSQL_CONFIG_FILE=/tmp/csql.conf
22 echo DSN=$DSN >>$CSQL_CONFIG_FILE
24 isql $DSN < $REL_PATH/mysqlinputtest1.sql > /dev/null 2>&1
25 if [ $? -ne 0 ]
26 then
27 echo "DSN is not set for target db"
28 exit 1
31 # edit /tmp/csql/csqltable.conf
32 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
34 for (( a=1; a<2; a++ ))
36 echo "1:t$a NULL NULL NULL"
37 done >> /tmp/csql/csqltable.conf
38 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
39 pid=$!
40 sleep 5
41 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/csqlinputtest1.sql >/dev/null 2>&1
42 if [ $? -ne 0 ]
43 then
44 echo "Server not opened"
45 exit 2
48 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql>/dev/null 2>&1
49 isql $DSN < $REL_PATH/selectstar.sql
50 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/select.sql>/dev/null 2>&1
51 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/update.sql>/dev/null 2>&1
52 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/delete.sql>/dev/null 2>&1
53 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql>/dev/null 2>&1
54 isql $DSN < $REL_PATH/selectstar.sql
55 isql $DSN < $REL_PATH/dropall.sql > /dev/null 2>&1
56 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
57 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
58 kill -9 $pid
59 ipcrm -M 1199 -M 2277
60 exit 0;