adding test scripts
[csql.git] / test / cache / Gateway / test008n.ksh
blob6c95f362fd1c27a38c890ad9c2643fa3f2844288
1 #!/bin/ksh
3 # 8.Cached table there in csql, but join with another cached table in csql. 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 echo CSQL_SQL_SERVER=true >>/tmp/csql.conf
17 echo PORT=6014 >>/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;
31 if [ $DSN = "oracle" ]
32 then
33 isql $DS < $REL_PATH/orainputt1.oracle > /dev/null 2>&1
34 elif [ $DSN = "sybase" ]
35 then
36 isql $DS < $REL_PATH/sybaseinputtest5.sql > /dev/null 2>&1
37 elif [ $DSN = "db2" ]
38 then
39 isql $DS < $REL_PATH/db2inputtest5.sql > /dev/null 2>&1
40 else
41 isql $DS < $REL_PATH/mysqlinputtest5.sql > /dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 echo "DSN is not set for target db"
47 exit 1
50 if [ $DSN = "oracle" ]
51 then
52 isql $DS < $REL_PATH/orainputt2.oracle > /dev/null 2>&1
53 else
54 isql $DS < $REL_PATH/mysqlinputtest8.sql > /dev/null 2>&1
56 # edit /tmp/csql/csqltable.conf
57 rm -f /tmp/csql/csqltable.conf
58 touch /tmp/csql/csqltable.conf
60 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
61 pid=$!
62 sleep 5
64 for a in 1 2
66 $CSQL_INSTALL_ROOT/bin/cachetable -t t$a -d $DSN
67 if [ $? -ne 0 ]
68 then
69 kill -9 $pid
70 ipcrm -M 1199 -M 2277
71 exit 3;
73 done >> /tmp/csql/csqltable.conf
74 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6014 -g -s $REL_PATH/join.sql
76 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
77 kill -9 $pid
78 ipcrm -M 1199 -M 2277
79 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
80 rm -f /tmp/csql/csqltable.conf
81 touch /tmp/csql/csqltable.conf
82 exit 0;