adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test003.ksh
blob32b1a23c5e4036a6b62b8ae83e4767966c452509
1 #!/bin/ksh
3 #Test Case
5 # 3.csqlds.conf file has the entries for MySQL and Postgres
6 #
7 # Create table t1 in MyQL and t10 in Postgres.
8 # CACHE_TABLE=false in csql.conf file.
9 # cache t1 and t10 from their 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=$MYSQL_DSN >>$CSQL_CONFIG_FILE
27 rm -f /tmp/csql/csqlds.conf
28 touch /tmp/csql/csqlds.conf
30 $CSQL_INSTALL_ROOT/bin/csqlds -U $MYSQL_USER -P $MYSQL_PASSWORD -D $MYSQL_DSN -N $MYSQL_TDB -a
31 if [ $? -ne 0 ]
32 then
33 exit 1;
35 echo "Entries made for $MYSQL_DSN in csqlds.conf file."
37 $CSQL_INSTALL_ROOT/bin/csqlds -U $POSTGRES_USER -P $POSTGRES_PASSWORD -D $POSTGRES_DSN -N $POSTGRES_TDB -a
38 if [ $? -ne 0 ]
39 then
40 exit 2;
42 echo "Entries made for $POSTGRES_DSN in csqlds.conf file."
44 echo CACHE_TABLE=false >>$CSQL_CONFIG_FILE
45 echo "CACHE_TABLE=false in csql.conf file."
47 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
48 if [ $? -ne 0 ]
49 then
50 exit 3;
52 echo "Table 't1' is created in $MYSQL_DSN."
54 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
55 if [ $? -ne 0 ]
56 then
57 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
58 exit 4;
60 echo "Table 't10' is created in $POSTGRES_DSN."
62 rm -f /tmp/csql/csqltable.conf
63 touch /tmp/csql/csqltable.conf
65 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
66 pid=$!
67 sleep 5
68 echo "CSQL Server started."
70 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t1 >/dev/null 2>&1
71 if [ $? -eq 0 ]
72 then
73 kill -9 $pid
74 ipcrm -M 1199 -M 2277
75 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
76 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
77 exit 5;
79 echo "Table 't1' is not cached."
81 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 -d $POSTGRES_DSN > /dev/null 2>&1
82 if [ $? -eq 0 ]
83 then
84 kill -9 $pid
85 ipcrm -M 1199 -M 2277
86 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
87 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
88 exit 6;
90 echo "Table 't10' is not cached."
92 rm -f /tmp/csql/csqltable.conf
93 touch /tmp/csql/csqltable.conf
95 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
96 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
97 echo "Table 't1' and 't10' is dropped from their respective TDB."
100 kill -9 $pid
101 ipcrm -M 1199 -M 2277
102 exit 0;