adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test002.ksh
bloba05dc30c6717bba5a9ec1ace733c087389fafb3c
1 #!/bin/ksh
2 #Test Case
4 # 2.csqlds.conf fiel has no entries for MySQL and Postgres
5 #
6 # Create table t1 in MySQL and t10 in Postgres.
7 # CACHE_TABLE=true in cql.conf file.
8 # cache t1 and t10 from respective TDB.
9 # It should fail.
11 # Author : Jitendra Lenka
13 input=${PWD}/cache/MultiDsn/Connection/mysqltable.sql
14 REL_PATH=.
15 if [ -s "$input" ]
16 then
17 REL_PATH=${PWD}/cache/MultiDsn/Connection
20 rm -f /tmp/csql.conf
21 cp $REL_PATH/csql.conf /tmp
22 export CSQL_CONFIG_FILE=/tmp/csql.conf
24 echo DSN=$MYSQL_DSN >>$CSQL_CONFIG_FILE
27 rm -f /tmp/csql/csqlds.conf
28 touch /tmp/csql/csqlds.conf
31 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
32 if [ $? -ne 0 ]
33 then
34 exit 3;
36 echo "Table 't1' is created in MySQL."
38 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
39 if [ $? -ne 0 ]
40 then
41 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
42 exit 4;
44 echo "Table 't10' is created in Postgres"
46 rm -f /tmp/csql/csqltable.conf
47 touch /tmp/csql/csqltable.conf
49 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
50 pid=$!
51 sleep 5
52 #echo $CSQL_INSTALL_ROOT
53 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t1 >/dev/null 2>&1
54 if [ $? -eq 0 ]
55 then
56 kill -9 $pid
57 ipcrm -M 1199 -M 2277
58 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
59 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
60 exit 5;
62 echo "Table 't1' is not cached."
64 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 -d $POSTGRES_DSN >/dev/null 2>&1
65 if [ $? -eq 0 ]
66 then
67 kill -9 $pid
68 ipcrm -M 1199 -M 2277
69 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
70 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
72 exit 6;
74 echo "Table 't10' is not cached."
76 rm -f /tmp/csql/csqltable.conf
77 touch /tmp/csql/csqltable.conf
79 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
80 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
81 echo "Table 't1' and 't10' is dropped from their respective TDB."
83 kill -9 $pid
84 ipcrm -M 1199 -M 2277
85 exit 0;