adding test scripts
[csql.git] / test / cache / Gateway / test012a.ksh
blob3da36afc18b90b2c5f1f5f47e5441afca1848d43
1 #!/bin/ksh
3 # 12.csqlserver not running
4 # a)connect,select
5 # oncached table in mysql(should work), cached table (work), csql table (fail)
7 #Run this test only under csql/test or on this directory.
8 #Otherwise, it may fail
9 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Gateway
15 rm -f /tmp/csql.conf
17 cp $REL_PATH/csql.conf /tmp/csql.conf
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
20 echo DSN=$DSN >>$CSQL_CONFIG_FILE
21 DS="$DSN $DBUSER $PASSWORD"
22 rm -f /tmp/csql/csqlds.conf
23 touch /tmp/csql/csqlds.conf
24 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
25 if [ $? -ne 0 ]
26 then
27 exit 1;
30 if [ $DSN = "oracle" ]
31 then
32 isql $DS < $REL_PATH/orainputt1.oracle >/dev/null 2>&1
33 elif [ $DSN = "sybase" ]
34 then
35 isql $DS < $REL_PATH/sybaseinputtest1.sql >/dev/null 2>&1
36 elif [ $DSN = "db2" ]
37 then
38 isql $DS < $REL_PATH/db2inputtest1.sql >/dev/null 2>&1
39 else
40 isql $DS < $REL_PATH/mysqlinputtest1.sql >/dev/null 2>&1
42 if [ $? -ne 0 ]
43 then
44 echo "DSN is not set for target db"
45 exit 1
48 if [ $DSN = "oracle" ]
49 then
50 isql $DS < $REL_PATH/orainputt2.oracle >/dev/null 2>&1
51 elif [ $DSN = "sybase" ]
52 then
53 isql $DS < $REL_PATH/sybaseinputtest12.sql > /dev/null 2>&1
54 elif [ $DSN = "db2" ]
55 then
56 isql $DS < $REL_PATH/db2inputtest12.sql > /dev/null 2>&1
57 else
58 isql $DS < $REL_PATH/mysqlinputtest12.sql >/dev/null 2>&1
61 if [ $? -ne 0 ]
62 then
63 cp /tmp/csql.conf $CSQL_CONFIG_FILE
64 exit 1;
66 # edit /tmp/csql/csqltable.conf
67 rm -f /tmp/csql/csqltable.conf
68 touch /tmp/csql/csqltable.conf
70 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
71 pid=$!
72 sleep 5
73 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $DSN
74 if [ $? -ne 0 ]
75 then
76 kill -9 $pid
77 ipcrm -M 1199 -M 2277
78 exit 3;
80 if [ $DSN = "oracle" ]
81 then
82 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/orainputt3.oracle >/dev/null 2>&1
83 else
84 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest12.sql >/dev/null 2>&1
86 kill -9 $pid
87 ipcrm -M 1199 -M 2277
88 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstart2.sql
89 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstar.sql
90 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectstart3.sql
91 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
93 rm -f /tmp/csql/csqltable.conf
94 touch /tmp/csql/csqltable.conf
95 exit 0;