code reorg for Transactionw!
[csql.git] / test / cache / CacheVerify / test006.ksh
blob07de8d5c59ab46bb3a55b2348108bd4a8726a5a5
1 #!/bin/ksh
2 # Test Case
3 # 6. Create table t1 in mysql with primary key. Insert 10 rows.
4 # Cache the table in csql.
5 # Run $ cacheverify -t t1
6 # The output should display the number of records present in csql
7 # and mysql separately.
8 # Run $ cacheverify -t t1 -p
9 # The output should display no missing records in either database.
10 # Run $ cacheverify -t t1 -f
11 # The output should display no missing records and should display
12 # the data is consistent in both databases.
15 #Run this test only under csql/test or on this directory.
16 #Otherwise, it may fail
18 input=${PWD}/cache/CacheVerify/mysqlinput.sql
19 REL_PATH=.
20 if [ -s "$input" ]
21 then
22 REL_PATH=${PWD}/cache/CacheVerify
25 cp $CSQL_CONFIG_FILE /tmp/csql.conf
26 export CSQL_CONFIG_FILE=/tmp/csql.conf
27 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
28 echo DSN=$DSN >>$CSQL_CONFIG_FILE
29 DS="$DSN $DBUSER $PASSWORD"
30 rm -f /tmp/csql/csqlds.conf
31 touch /tmp/csql/csqlds.conf
32 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
33 if [ $? -ne 0 ]
34 then
35 exit 1;
38 if [ $DSN = "oracle" ]
39 then
40 isql $DS < ${REL_PATH}/oracleinput.sql >/dev/null 2>&1
41 if [ $? -ne 0 ]
42 then
43 exit 1;
45 elif [ $DSN = "myodbc3" ]
46 then
47 isql $DS < ${REL_PATH}/mysqlinput.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}/sybaseinput.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 rm -f /tmp/csql/csqltable.conf
75 touch /tmp/csql/csqltable.conf
78 $CSQL_INSTALL_ROOT/bin/cachetable -t t1
79 if [ $? -ne 0 ]
80 then
81 exit 2;
84 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1
85 if [ $? -ne 0 ]
86 then
87 exit 3;
90 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
91 if [ $? -ne 0 ]
92 then
93 exit 4;
96 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
97 if [ $? -ne 0 ]
98 then
99 exit 5;
102 exit 0;