adding test scripts
[csql.git] / test / cache / Gateway / test010.ksh
blobad2e9a08bc88d7c79ad1c6c78f749cdf0af9a4ef
1 #!/bin/ksh
3 # 10.Table there in csql and mysql and not cached. insert should insert only to csql table.
5 #Run this test only under csql/test or on this directory.
6 #Otherwise, it may fail
7 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
8 REL_PATH=.
9 if [ -s "$input" ]
10 then
11 REL_PATH=${PWD}/cache/Gateway
13 rm -f /tmp/csql.conf
15 cp $REL_PATH/csql.conf /tmp/csql.conf
16 export CSQL_CONFIG_FILE=/tmp/csql.conf
18 echo DSN=$DSN >>$CSQL_CONFIG_FILE
19 DS="$DSN $DBUSER $PASSWORD"
20 rm -f /tmp/csql/csqlds.conf
21 touch /tmp/csql/csqlds.conf
22 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
23 if [ $? -ne 0 ]
24 then
25 exit 1;
27 if [ $DSN = "oracle" ]
28 then
29 isql $DS < $REL_PATH/orainputt1.oracle > /dev/null 2>&1
30 elif [ $DSN = "sybase" ]
31 then
32 isql $DS < $REL_PATH/sybaseinputtest1.sql >/dev/null 2>&1
33 elif [ $DSN = "db2" ]
34 then
35 isql $DS < $REL_PATH/db2inputtest1.sql >/dev/null 2>&1
36 else
37 isql $DS < $REL_PATH/mysqlinputtest1.sql > /dev/null 2>&1
40 if [ $? -ne 0 ]
41 then
42 echo "DSN is not set for target db"
43 exit 1
46 isql $DS < $REL_PATH/selectstar.sql
47 if [ $? -ne 0 ]
48 then
49 cp /tmp/csql.conf $CSQL_CONFIG_FILE
50 exit 2;
53 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
54 pid=$!
55 sleep 5
56 if [ $DSN = "oracle" ]
57 then
58 echo "insert into t1 values(100,'GGG');" >> $REL_PATH/orainsert.sql
59 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/orainputt1.oracle >/dev/null 2>&1
60 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
61 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/orainsert.sql
62 else
63 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest10.sql >/dev/null 2>&1
64 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
65 if [ $DSN = "db2" ]
66 then
67 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/insertdb2.sql
68 else
69 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/insert.sql
73 isql $DS < $REL_PATH/selectstar.sql
74 if [ $? -ne 0 ]
75 then
76 cp /tmp/csql.conf $CSQL_CONFIG_FILE
77 exit 3;
80 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
81 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
82 rm -f $REL_PATH/ora*.sql
83 rm -f /tmp/csql/csqltable.conf
84 touch /tmp/csql/csqltable.conf
85 kill -9 $pid
86 ipcrm -M 1199 -M 2277
87 exit 0;