adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test005.ksh
blobd8e1ab9d0f99eb5fc771b5ca0135bb0b1213c3f2
1 #!/bin/ksh
2 #Test Case
4 # 5.csqlds.conf fiel has the entries for Postgres and not for MySQL.
5 #
6 # Create table t1 in MyQL and t10 in Postgres.
7 # CACHE_TABLE=true in cql.conf file.
8 # cache t1 and t10 from respective TDB,
9 # The table 't1' will not be cached.
11 # Author : Jitendra
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
26 rm -f /tmp/csql/csqlds.conf
27 touch /tmp/csql/csqlds.conf
29 $CSQL_INSTALL_ROOT/bin/csqlds -U $POSTGRES_USER -P $POSTGRES_PASSWORD -D $POSTGRES_DSN -N $POSTGRES_TDB -a
30 if [ $? -ne 0 ]
31 then
32 exit 1;
34 echo "Entry made for $POSTGRES_DSN in csqlds.conf file"
36 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
37 if [ $? -ne 0 ]
38 then
39 exit 3;
41 echo "Table t1 is created in $MYSQL_TDB ."
43 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
47 exit 4;
49 echo "Table t10 is created in $POSTGRES_TDB"
51 rm -f /tmp/csql/csqltable.conf
52 touch /tmp/csql/csqltable.conf
54 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
55 pid=$!
56 sleep 5
57 echo "CSQL Server is started."
59 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t1 >/dev/null 2>&1
60 if [ $? -eq 0 ]
61 then
62 kill -9 $pid
63 ipcrm -M 1199 -M 2277
64 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
65 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
66 exit 5;
68 echo "Table 't1' is not cached from $MYSQL_DSN"
70 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 -d $POSTGRES_DSN > /dev/null 2>&1
71 if [ $? -ne 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 6;
79 echo "Table 't10' is cached from $POSTGRES_DSN"
81 rm -f /tmp/csql/csqltable.conf
82 touch /tmp/csql/csqltable.conf
84 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
85 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
86 echo "Table t1 and t10 is dropped in TDB."
88 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
89 echo "Table is dropped in CSQL."
90 kill -9 $pid
91 ipcrm -M 1199 -M 2277
92 exit 0;