adding test scripts
[csql.git] / test / cache / MultiDsn / Connection / test012.ksh
blob9364e965d88cbbb332956b1188eb1b1258418730
1 #!/bin/ksh
2 #Test Case
4 # 1.csqlds.conf file has the entries for Postgres and MySQL
5 # Default DSN is "psql"
6 # Create table t1 in MyQL and t10 in Postgres.
7 # Select t1 and t10 from their respecrtive TDB.
8 # CACHE_TABLE=true in csql.conf file.
9 # cache t1 and t10 from respective TDB.
10 # select t1 and t10 from CSQL.
12 # Author : Jitendra Lenka
15 input=${PWD}/cache/MultiDsn/Connection/mysqltable.sql
16 REL_PATH=.
17 if [ -s "$input" ]
18 then
19 REL_PATH=${PWD}/cache/MultiDsn/Connection
22 rm -f /tmp/csql.conf
23 cp $REL_PATH/csql.conf /tmp
24 export CSQL_CONFIG_FILE=/tmp/csql.conf
27 echo DSN=$POSTGRES_DSN >>$CSQL_CONFIG_FILE
29 rm -f /tmp/csql/csqlds.conf
30 touch /tmp/csql/csqlds.conf
33 $CSQL_INSTALL_ROOT/bin/csqlds -U $POSTGRES_USER -P $POSTGRES_PASSWORD -D $POSTGRES_DSN -N $POSTGRES_TDB -a
34 if [ $? -ne 0 ]
35 then
36 exit 2;
38 echo "Entries made for $POSTGRES_DSN in csqlds.conf file."
41 $CSQL_INSTALL_ROOT/bin/csqlds -U $MYSQL_USER -P $MYSQL_PASSWORD -D $MYSQL_DSN -N $MYSQL_TDB -a
42 if [ $? -ne 0 ]
43 then
44 exit 1;
46 echo "Entries made for $MYSQL_DSN in csqlds.conf file."
51 #echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
52 isql $DS1 < ${REL_PATH}/mysqltable.sql >/dev/null 2>&1
53 if [ $? -ne 0 ]
54 then
55 exit 3;
57 echo "Table 't1' is created in $MYSQL_DSN"
59 isql $DS1 < ${REL_PATH}/selectt1.sql
60 if [ $? -ne 0 ]
61 then
62 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
63 exit 4;
66 isql $DS2 < ${REL_PATH}/psqltable.sql >/dev/null 2>&1
67 if [ $? -ne 0 ]
68 then
69 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
70 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
71 exit 5;
73 echo "Table 't10' is created in $POSTGRES_DSN"
75 isql $DS2 < ${REL_PATH}/selectt10.sql
76 if [ $? -ne 0 ]
77 then
78 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
79 exit 6;
83 rm -f /tmp/csql/csqltable.conf
84 touch /tmp/csql/csqltable.conf
86 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
87 pid=$!
88 sleep 5
90 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $MYSQL_DSN >/dev/null 2>&1
91 if [ $? -ne 0 ]
92 then
93 kill -9 $pid
94 ipcrm -M 1199 -M 2277
95 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
96 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
97 exit 7;
99 echo "Table t1 is cached from $MYSQL_DSN."
101 echo "select * from t1"
102 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
103 if [ $? -ne 0 ]
104 then
105 kill -9 $pid
106 ipcrm -M 1199 -M 2277
107 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
108 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
109 exit 8;
113 $CSQL_INSTALL_ROOT/bin/cachetable -t t10 >/dev/null 2>&1
114 if [ $? -ne 0 ]
115 then
116 kill -9 $pid
117 ipcrm -M 1199 -M 2277
118 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
119 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
120 exit 9;
122 echo "Table 't10' is cached from $POSTGRES_DSN."
124 echo "select * from t10."
125 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt10.sql
126 if [ $? -ne 0 ]
127 then
128 kill -9 $pid
129 ipcrm -M 1199 -M 2277
130 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
131 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
132 exit 10;
136 rm -f /tmp/csql/csqltable.conf
137 touch /tmp/csql/csqltable.conf
139 isql $DS1 < ${REL_PATH}/drop.sql >/dev/null 2>&1
140 isql $DS2 < ${REL_PATH}/drop.sql >/dev/null 2>&1
143 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
144 kill -9 $pid
145 ipcrm -M 1199 -M 2277
146 exit 0;