*** empty log message ***
[csql.git] / test / cache / MultiDsn / Connection / test008.ksh
blob9a35e07afbf9cc281acbc9f32f29c16ec9a6e8e6
1 #!/bin/ksh
2 #Test Case
4 # 8.csqlds.conf file has the entries for MySQL and Postgres
5 # Default DSN is "psql" in csql.conf file.
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.
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=$POSTGRES_DSN >>$CSQL_CONFIG_FILE
26 rm -f /tmp/csql/csqlds.conf
27 touch /tmp/csql/csqlds.conf
29 $CSQL_INSTALL_ROOT/bin/csqlds -U $MYSQL_USER -P $MYSQL_PASSWORD -D $MYSQL_DSN -N $MYSQL_TDB -a
30 if [ $? -ne 0 ]
31 then
32 exit 1;
34 echo "Entries made for $MYSQL_DSN in csqlds.conf file."
36 $CSQL_INSTALL_ROOT/bin/csqlds -U $POSTGRES_USER -P $POSTGRES_PASSWORD -D $POSTGRES_DSN -N $POSTGRES_TDB -a
37 if [ $? -ne 0 ]
38 then
39 exit 2;
41 echo "Entries made for $POSTGRES_DSN in csqlds.conf file."
43 echo CACHE_TABLE=false >>$CSQL_CONFIG_FILE
44 echo "CACHE_TABLE=false in csql.conf file."
46 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
47 if [ $? -ne 0 ]
48 then
49 exit 3;
51 echo "Table 't1' is created in $MYSQL_DSN."
53 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
54 if [ $? -ne 0 ]
55 then
56 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
57 exit 4;
59 echo "Table 't10' is created is $POSTGRES_DSN."
61 rm -f /tmp/csql/csqltable.conf
62 touch /tmp/csql/csqltable.conf
64 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
65 pid=$!
66 sleep 5
67 echo "CSQL Server started."
69 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -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 5;
78 echo "Table 't1' is not cached."
80 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 >/dev/null 2>&1
81 if [ $? -eq 0 ]
82 then
83 kill -9 $pid
84 ipcrm -M 1199 -M 2277
85 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
86 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
87 exit 6;
89 echo "Table 't10' is not cached."
91 rm -f /tmp/csql/csqltable.conf
92 touch /tmp/csql/csqltable.conf
94 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
95 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
96 echo "Table 't1' and 't10' is dropped from their respective TDB."
99 kill -9 $pid
100 ipcrm -M 1199 -M 2277
101 exit 0;