adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test007.ksh
blob8b47bb750dd037ff6aeb7e1ab2adf39a28ade3ea
1 #!/bin/ksh
2 #Test Case
4 # 7.csqlds.conf fiel has no entries for MySQL and Postgres
5 # Default DSN is "psql" is set in the csql.conf file.
7 # Create table t1 in MyQL and t10 in Postgres.
8 # CACHE_TABLE=true in cql.conf file.
9 # cache t1 and t10 from respective TDB.
10 # It should fail.
12 # Author : Jitendra
14 input=${PWD}/cache/MultiDsn/Connection/mysqltable.sql
15 REL_PATH=.
16 if [ -s "$input" ]
17 then
18 REL_PATH=${PWD}/cache/MultiDsn/Connection
21 rm -f /tmp/csql.conf
22 cp $REL_PATH/csql.conf /tmp
23 export CSQL_CONFIG_FILE=/tmp/csql.conf
25 echo DSN=$POSTGRES_DSN >>$CSQL_CONFIG_FILE
27 rm -f /tmp/csql/csqlds.conf
28 touch /tmp/csql/csqlds.conf
30 #echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
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
53 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $MYSQL_DSN >/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 >/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
71 exit 6;
73 echo "Table 't10' is not cached."
75 rm -f /tmp/csql/csqltable.conf
76 touch /tmp/csql/csqltable.conf
78 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
79 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
80 echo "Table 't1' and 't10' is dropped from their respective TDB."
82 kill -9 $pid
83 ipcrm -M 1199 -M 2277
84 exit 0;