adding test scripts
[csql.git] / test / cache / CacheVerify / test010.ksh
blob0f582e0cd53ca885b469e0b109d814978744ad69
1 #!/bin/ksh
2 # Test Case
3 #cacheverify test after all Non-select dml (primary key on tinyint field) (cache/CacheVerify/test010.ksh)
4 #Create table t1 in mysql with primary key on tinyint 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 CACHE_TABLE=true>>$CSQL_CONFIG_FILE
35 echo DSN=$DSN >>$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}/mysqlinput10.sql >/dev/null 2>&1
48 elif [ $DSN = "oracle" ]
49 then
50 isql $DS < ${REL_PATH}/oracleinput10.sql >/dev/null 2>&1
51 elif [ $DSN = "sybase" ]
52 then
53 isql $DS < ${REL_PATH}/sybaseinput10.sql >/dev/null 2>&1
54 elif [ $DSN = "db2" ]
55 then
56 isql $DS < ${REL_PATH}/db2input10.sql >/dev/null 2>&1
57 else
58 isql $DS < ${REL_PATH}/psqlinput10.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
71 $CSQL_INSTALL_ROOT/bin/cachetable -t t1
72 if [ $? -ne 0 ]
73 then
74 rm -f /tmp/csql/csqltable.conf
75 touch /tmp/csql/csqltable.conf
76 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
77 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
78 exit 3;
81 sleep 1
82 echo cacheverify -t t1
83 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1
84 if [ $? -ne 0 ]
85 then
86 rm -f /tmp/csql/csqltable.conf
87 touch /tmp/csql/csqltable.conf
88 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
89 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
90 exit 4;
93 echo cacheverify -t t1 -p
94 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
95 if [ $? -ne 0 ]
96 then
97 rm -f /tmp/csql/csqltable.conf
98 touch /tmp/csql/csqltable.conf
99 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
100 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
101 exit 5;
104 echo cacheverify -t t1 -f
105 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
106 if [ $? -ne 0 ]
107 then
108 rm -f /tmp/csql/csqltable.conf
109 touch /tmp/csql/csqltable.conf
110 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
111 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
112 exit 6;
115 echo updating 2 records in csql through gateway
116 $CSQL_INSTALL_ROOT/bin/csql -g -s ${REL_PATH}/csqlupd.sql >/dev/null 2>&1
117 if [ $? -ne 0 ]
118 then
119 rm -f /tmp/csql/csqltable.conf
120 touch /tmp/csql/csqltable.conf
121 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
122 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
123 exit 7;
126 echo cacheverify -t t1 -f
127 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
128 if [ $? -ne 0 ]
129 then
130 rm -f /tmp/csql/csqltable.conf
131 touch /tmp/csql/csqltable.conf
132 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
133 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
134 exit 8;
137 echo deleting 2 records in csql through gateway
138 $CSQL_INSTALL_ROOT/bin/csql -g -s ${REL_PATH}/csqldel.sql >/dev/null 2>&1
139 if [ $? -ne 0 ]
140 then
141 rm -f /tmp/csql/csqltable.conf
142 touch /tmp/csql/csqltable.conf
143 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
144 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
145 exit 9;
148 echo cacheverify -t t1 -p
149 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
150 if [ $? -ne 0 ]
151 then
152 rm -f /tmp/csql/csqltable.conf
153 touch /tmp/csql/csqltable.conf
154 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
155 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
156 exit 10;
159 echo updating 2 records in mysql
160 isql $DS < ${REL_PATH}/mysqlupd.sql >/dev/null 2>&1
161 if [ $? -ne 0 ]
162 then
163 rm -f /tmp/csql/csqltable.conf
164 touch /tmp/csql/csqltable.conf
165 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
166 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
167 exit 11;
170 echo cacheverify -t t1 -f
171 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
172 if [ $? -ne 0 ]
173 then
174 rm -f /tmp/csql/csqltable.conf
175 touch /tmp/csql/csqltable.conf
176 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
177 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
178 exit 12;
181 echo deleting 2 records in mysql
182 isql $DS < ${REL_PATH}/mysqldel.sql >/dev/null 2>&1
183 if [ $? -ne 0 ]
184 then
185 rm -f /tmp/csql/csqltable.conf
186 touch /tmp/csql/csqltable.conf
187 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
188 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
189 exit 13;
192 echo cacheverify -t t1 -p
193 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
194 if [ $? -ne 0 ]
195 then
196 rm -f /tmp/csql/csqltable.conf
197 touch /tmp/csql/csqltable.conf
198 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
199 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
200 exit 14;
203 rm -f /tmp/csql/csqltable.conf
204 touch /tmp/csql/csqltable.conf
205 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
206 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
207 exit 0;