code reorg for Transactionw!
[csql.git] / test / cache / CacheVerify / test009.ksh
blob4a784bfcffc89aa974fa13f758ada4faeb94a96f
1 #!/bin/ksh
2 # Test Case
3 # 9. Create table t1 in mysql with primary key. Insert 10 rows.
4 # Cache the table in csql.
5 # Update 2 rows in csql and 2 rows in mysql with different primary keys.
6 # Run $ cacheverify -t t1.
7 # The output should display number of records as 10 for both csql and
8 # mysql respectively.
9 # Run $ cacheverify -t t1 -p.
10 # The output should display no missing records in either of the
11 # databases.
12 # Run $ cacheverify -t t1 -f.
13 # The output should display the 4 inconsistent records.
14 # Only those fields with different values should be displayed
15 # for inconsistent records.
17 #Run this test only under csql/test or on this directory.
18 #Otherwise, it may fail
20 input=${PWD}/cache/CacheVerify/mysqlinput.sql
21 REL_PATH=.
22 if [ -s "$input" ]
23 then
24 REL_PATH=${PWD}/cache/CacheVerify
27 cp $CSQL_CONFIG_FILE /tmp/csql.conf
28 export CSQL_CONFIG_FILE=/tmp/csql.conf
29 echo DSN=$DSN >>$CSQL_CONFIG_FILE
30 DS="$DSN $DBUSER $PASSWORD"
31 rm -f /tmp/csql/csqlds.conf
32 touch /tmp/csql/csqlds.conf
33 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
34 if [ $? -ne 0 ]
35 then
36 exit 1;
38 if [ $DSN = "myodbc3" ]
39 then
40 isql $DS < ${REL_PATH}/mysqlinput.sql >/dev/null 2>&1
41 if [ $? -ne 0 ]
42 then
43 exit 1;
45 elif [ "$DSN" = "oracle" ]
46 then
47 isql $DS < ${REL_PATH}/oracleinput.sql >/dev/null 2>&1
48 if [ $? -ne 0 ]
49 then
50 exit 1;
52 elif [ "$DSN" = "sybase" ]
53 then
54 isql $DS < ${REL_PATH}/oracleinput.sql >/dev/null 2>&1
55 if [ $? -ne 0 ]
56 then
57 exit 1;
59 elif [ "$DSN" = "db2" ]
60 then
61 isql $DS < ${REL_PATH}/db2input.sql >/dev/null 2>&1
62 if [ $? -ne 0 ]
63 then
64 exit 1;
66 else
67 isql $DS < ${REL_PATH}/psqlinput.sql >/dev/null 2>&1
68 if [ $? -ne 0 ]
69 then
70 exit 1;
74 if [ "$DSN" = "oracle" ]
75 then
76 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqloracleinput.sql >/dev/null 2>&1
77 if [ $? -ne 0 ]
78 then
79 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
80 exit 2;
82 else
83 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/mysqlinput.sql >/dev/null 2>&1
84 if [ $? -ne 0 ]
85 then
86 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
87 exit 2;
90 echo "1 t1 NULL NULL NULL $DSN" > /tmp/csql/csqltable.conf
93 if [ "$DSN" = "oracle" ]
94 then
95 isql $DS < ${REL_PATH}/oracleupdate.sql >/dev/null 2>&1
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 exit 3;
103 else
104 if [ $DSN = "db2" ]
105 then
106 isql $DS < ${REL_PATH}/db2update.sql >/dev/null 2>&1
107 if [ $? -ne 0 ]
108 then
109 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
110 exit 3;
112 else
113 isql $DS < ${REL_PATH}/mysqlupdate.sql >/dev/null 2>&1
114 if [ $? -ne 0 ]
115 then
116 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
117 exit 3;
122 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlupdate.sql >/dev/null 2>&1
123 if [ $? -ne 0 ]
124 then
125 rm -f /tmp/csql/csqltable.conf
126 touch /tmp/csql/csqltable.conf
127 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
128 exit 4;
131 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1
132 if [ $? -ne 0 ]
133 then
134 echo $?
135 rm -f /tmp/csql/csqltable.conf
136 touch /tmp/csql/csqltable.conf
137 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
138 exit 5;
141 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
142 if [ $? -ne 0 ]
143 then
144 rm -f /tmp/csql/csqltable.conf
145 touch /tmp/csql/csqltable.conf
146 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
147 exit 6;
150 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
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 exit 7;
159 rm -f /tmp/csql/csqltable.conf
160 touch /tmp/csql/csqltable.conf
161 isql $DS < $REL_PATH/drop.sql >/dev/null 2>&1
162 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
164 exit 0;