adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test010.ksh
blob10860ad06b32dc5774522bd7baa996a834bdb87a
1 #!/bin/ksh
2 #Test Case
4 # 10.csqlds.conf fiel has the entries for Postgres and not for MySQL.
5 # Default dsn is "psql" in 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 # The table 't1' will not be cached.
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 $CSQL_INSTALL_ROOT/bin/csqlds -U $POSTGRES_USER -P $POSTGRES_PASSWORD -D $POSTGRES_DSN -N $POSTGRES_TDB -a
31 if [ $? -ne 0 ]
32 then
33 exit 1;
35 echo "Entry made for $POSTGRES_DSN in csqlds.conf file"
37 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
38 if [ $? -ne 0 ]
39 then
40 exit 3;
42 echo "Table t1 is created in $MYSQL_TDB."
44 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
45 if [ $? -ne 0 ]
46 then
47 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
48 exit 4;
50 echo "Table t10 is created in $POSTGRES_TDB"
52 rm -f /tmp/csql/csqltable.conf
53 touch /tmp/csql/csqltable.conf
55 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
56 pid=$!
57 sleep 5
58 echo "CSQL Server is started."
60 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $MYSQL_DSN >/dev/null 2>&1
61 if [ $? -eq 0 ]
62 then
63 kill -9 $pid
64 ipcrm -M 1199 -M 2277
65 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
66 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
67 exit 5;
69 echo "Table 't1' is not cached from $MYSQL_DSN"
71 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 > /dev/null 2>&1
72 if [ $? -ne 0 ]
73 then
74 kill -9 $pid
75 ipcrm -M 1199 -M 2277
76 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
77 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
78 exit 6;
80 echo "Table 't10' is cached from $POSTGRES_DSN"
82 rm -f /tmp/csql/csqltable.conf
83 touch /tmp/csql/csqltable.conf
85 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
86 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
87 echo "Table t1 and t10 is dropped in TDB."
89 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
90 echo "Table is dropped in CSQL."
91 kill -9 $pid
92 ipcrm -M 1199 -M 2277
93 exit 0;