adding test scripts
[csql.git] / test / cache / Gateway / test009.ksh
blobffe8d169cc55e00c5fae8c15a6a2491528edc975
1 #!/bin/ksh
3 # 9.Cached table there in csql, but join with another noncached table in MySQL. It should get the correct value from mysql.
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;
28 if [ $DSN = "oracle" ]
29 then
30 isql $DS < $REL_PATH/orainputt1.oracle > /dev/null 2>&1
31 elif [ $DSN = "sybase" ]
32 then
33 isql $DS < $REL_PATH/sybaseinputtest5.sql > /dev/null 2>&1
34 elif [ $DSN = "db2" ]
35 then
36 isql $DS < $REL_PATH/db2inputtest5.sql > /dev/null 2>&1
37 else
38 isql $DS < $REL_PATH/mysqlinputtest5.sql > /dev/null 2>&1
41 if [ $? -ne 0 ]
42 then
43 echo "DSN is not set for target db"
44 exit 1
47 if [ $DSN = "oracle" ]
48 then
49 isql $DS < $REL_PATH/orainputt2.oracle > /dev/null 2>&1
50 else
51 isql $DS < $REL_PATH/mysqlinputtest8.sql > /dev/null 2>&1
54 if [ $? -ne 0 ]
55 then
56 cp /tmp/csql.conf $CSQL_CONFIG_FILE
57 exit 2;
60 # edit /tmp/csql/csqltable.conf
61 rm -f /tmp/csql/csqltable.conf
62 touch /tmp/csql/csqltable.conf
64 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
65 pid=$!
66 sleep 5
68 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $DSN
69 if [ $? -ne 0 ]
70 then
71 kill -9 $pid
72 ipcrm -M 1199 -M 2277
73 exit 3;
75 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/join.sql
77 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
78 kill -9 $pid
79 ipcrm -M 1199 -M 2277
80 rm -f /tmp/csql/csqltable.conf
81 touch /tmp/csql/csqltable.conf
82 exit 0;