adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test004.ksh
blob7c633e57b651d55bce4e4504be3c02b5203b651c
1 #!/bin/ksh
2 #Test Case
4 # 4.csqlds.conf file has the entries for MySQL and not for Postgres.
5 # Create table t1 in MyQL and t10 in Postgres.
6 # CACHE_TABLE=true in cql.conf file.
7 # cache t1 and t10 from respective TDB,
8 # The table 't10' will not be cached.
10 # Author : Jitendra
12 input=${PWD}/cache/MultiDsn/Connection/mysqltable.sql
13 REL_PATH=.
14 if [ -s "$input" ]
15 then
16 REL_PATH=${PWD}/cache/MultiDsn/Connection
19 rm -f /tmp/csql.conf
20 cp $REL_PATH/csql.conf /tmp
21 export CSQL_CONFIG_FILE=/tmp/csql.conf
23 echo DSN=$MYSQL_DSN >>$CSQL_CONFIG_FILE
25 rm -f /tmp/csql/csqlds.conf
26 touch /tmp/csql/csqlds.conf
28 $CSQL_INSTALL_ROOT/bin/csqlds -U $MYSQL_USER -P $MYSQL_PASSWORD -D $MYSQL_DSN -N $MYSQL_TDB -a
29 if [ $? -ne 0 ]
30 then
31 exit 1;
33 echo "Entry made for $MYSQL_DSN in csqlds.conf file"
35 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
36 if [ $? -ne 0 ]
37 then
38 exit 3;
40 echo "Table t1 is created in $MYSQL_TDB ."
42 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
43 if [ $? -ne 0 ]
44 then
45 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
46 exit 4;
48 echo "Table t10 is created in $POSTGRES_TDB"
50 rm -f /tmp/csql/csqltable.conf
51 touch /tmp/csql/csqltable.conf
53 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
54 pid=$!
55 sleep 5
56 echo "CSQL Server is started."
58 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t1 >/dev/null 2>&1
59 if [ $? -ne 0 ]
60 then
61 kill -9 $pid
62 ipcrm -M 1199 -M 2277
63 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
64 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
65 exit 5;
67 echo "Table 't1' is cached from $MYSQL_DSN"
69 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 -d $POSTGRES_DSN > /dev/null 2>&1
70 if [ $? -eq 0 ]
71 then
72 kill -9 $pid
73 ipcrm -M 1199 -M 2277
74 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
75 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
76 exit 6;
78 echo "Table 't10' is not cached from $POSTGRES_DSN"
80 rm -f /tmp/csql/csqltable.conf
81 touch /tmp/csql/csqltable.conf
83 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
84 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
85 echo "Table t1 and t10 is dropped in TDB."
87 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
88 echo "Table is dropped in CSQL."
89 kill -9 $pid
90 ipcrm -M 1199 -M 2277
91 exit 0;