code reorg for Transactionw!
[csql.git] / test / cache / CacheVerify / test012.ksh
blob02768e3307b734319c4395ce6c5baf4316696648
1 #!/bin/ksh
2 # Test Case
3 #cacheverify test after all Non-select dml (primary key on bigint field) (cache/CacheVerify/test010.ksh)
4 #Create table t1 in mysql with primary key on bigint field. Insert 5 rows.
5 #Cache the table in csql.
6 #Run $ cacheverify -t t1. The output should display the number of records present in csql and mysql same.
7 #Run $ cacheverify -t t1 -p. The output should display no missing records in either database.
8 #Run $ cacheverify -t t1 -f. The output should display no missing records and should display the data is consistent in both databases.
9 #Update 2 records in csql using csql -g.
10 #Run $ cacheverify -t t1 -f
11 #The output should display no missing records and should display the data is consistent in both databases.
12 #delete 2 records in csql using csql -g.
13 #Run $ cacheverify -t t1 -p
14 #The output should display no missing records in either database.
15 #Update 2 records in Mysql.
16 #Run $ cacheverify -t t1 -f.
17 #The output should display the 4 inconsistent records. Only those fields with different values should be displayed for inconsistent records.
18 #delete 2 records in Mysql.
19 #Run $ cacheverify -t t1 -p.
20 #The output should display the primary key field values for missing records in either of the databases in ascending order.
22 input=${PWD}/cache/CacheVerify/mysqlinput10.sql
23 REL_PATH=.
24 if [ -s "$input" ]
25 then
26 REL_PATH=${PWD}/cache/CacheVerify
29 rm -f /tmp/csql/csqltable.conf
30 touch /tmp/csql/csqltable.conf
32 cp $CSQL_CONFIG_FILE /tmp/csql.conf
33 export CSQL_CONFIG_FILE=/tmp/csql.conf
34 echo DSN=$DSN >>$CSQL_CONFIG_FILE
35 echo CACHE_TABLE=true>>$CSQL_CONFIG_FILE
36 DS="$DSN $DBUSER $PASSWORD"
37 rm -f /tmp/csql/csqlds.conf
38 touch /tmp/csql/csqlds.conf
39 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
40 if [ $? -ne 0 ]
41 then
42 exit 1;
45 if [ $DSN = "myodbc3" ]
46 then
47 isql $DS < ${REL_PATH}/mysqlinput12.sql >/dev/null 2>&1
48 elif [ $DSN = "oracle" ]
49 then
50 isql $DS < ${REL_PATH}/oracleinput12.sql >/dev/null 2>&1
51 elif [ $DSN = "sybase" ]
52 then
53 isql $DS < ${REL_PATH}/sybaseinput12.sql >/dev/null 2>&1
54 elif [ $DSN = "db2" ]
55 then
56 isql $DS < ${REL_PATH}/db2input12.sql >/dev/null 2>&1
57 else
58 isql $DS < ${REL_PATH}/psqlinput12.sql >/dev/null 2>&1
60 if [ $? -ne 0 ]
61 then
62 rm -f /tmp/csql/csqltable.conf
63 touch /tmp/csql/csqltable.conf
64 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
65 exit 2;
67 rm -f /tmp/csql/csqltable.conf
68 touch /tmp/csql/csqltable.conf
70 sleep 1
72 $CSQL_INSTALL_ROOT/bin/cachetable -t t1
73 if [ $? -ne 0 ]
74 then
75 rm -f /tmp/csql/csqltable.conf
76 touch /tmp/csql/csqltable.conf
77 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
78 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
79 exit 3;
82 sleep 1
83 echo cacheverify -t t1
84 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1
85 if [ $? -ne 0 ]
86 then
87 rm -f /tmp/csql/csqltable.conf
88 touch /tmp/csql/csqltable.conf
89 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
90 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
91 exit 4;
94 echo cacheverify -t t1 -p
95 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
96 if [ $? -ne 0 ]
97 then
98 rm -f /tmp/csql/csqltable.conf
99 touch /tmp/csql/csqltable.conf
100 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
101 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
102 exit 5;
105 echo cacheverify -t t1 -f
106 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
107 if [ $? -ne 0 ]
108 then
109 rm -f /tmp/csql/csqltable.conf
110 touch /tmp/csql/csqltable.conf
111 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
112 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
113 exit 6;
116 echo updating 2 records in csql through gateway
117 $CSQL_INSTALL_ROOT/bin/csql -g -s ${REL_PATH}/csqlupd.sql >/dev/null 2>&1
118 if [ $? -ne 0 ]
119 then
120 rm -f /tmp/csql/csqltable.conf
121 touch /tmp/csql/csqltable.conf
122 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
123 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
124 exit 7;
127 echo cacheverify -t t1 -f
128 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
129 if [ $? -ne 0 ]
130 then
131 rm -f /tmp/csql/csqltable.conf
132 touch /tmp/csql/csqltable.conf
133 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
134 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
135 exit 8;
138 echo deleting 2 records in csql through gateway
139 $CSQL_INSTALL_ROOT/bin/csql -g -s ${REL_PATH}/csqldel.sql >/dev/null 2>&1
140 if [ $? -ne 0 ]
141 then
142 rm -f /tmp/csql/csqltable.conf
143 touch /tmp/csql/csqltable.conf
144 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
145 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
146 exit 9;
149 echo cacheverify -t t1 -p
150 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
151 if [ $? -ne 0 ]
152 then
153 rm -f /tmp/csql/csqltable.conf
154 touch /tmp/csql/csqltable.conf
155 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
156 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
157 exit 10;
160 echo updating 2 records in mysql
161 isql $DS < ${REL_PATH}/mysqlupd.sql >/dev/null 2>&1
162 if [ $? -ne 0 ]
163 then
164 rm -f /tmp/csql/csqltable.conf
165 touch /tmp/csql/csqltable.conf
166 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
167 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
168 exit 11;
171 echo cacheverify -t t1 -f
172 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
173 if [ $? -ne 0 ]
174 then
175 rm -f /tmp/csql/csqltable.conf
176 touch /tmp/csql/csqltable.conf
177 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
178 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
179 exit 12;
182 echo deleting 2 records in mysql
183 isql $DS < ${REL_PATH}/mysqldel.sql >/dev/null 2>&1
184 if [ $? -ne 0 ]
185 then
186 rm -f /tmp/csql/csqltable.conf
187 touch /tmp/csql/csqltable.conf
188 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
189 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
190 exit 13;
193 echo cacheverify -t t1 -p
194 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
195 if [ $? -ne 0 ]
196 then
197 rm -f /tmp/csql/csqltable.conf
198 touch /tmp/csql/csqltable.conf
199 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
200 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
201 exit 14;
204 rm -f /tmp/csql/csqltable.conf
205 touch /tmp/csql/csqltable.conf
206 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
207 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
208 exit 0;