code reorg for Transactionw!
[csql.git] / test / cache / CacheVerify / test004.ksh
blob05a25ff884f4edf05a13641b9b28923d000675b4
1 #!/bin/ksh
2 # Test Case
3 # 4. Create a table t1 with no primary key in mysql. and insert 2 tuples.
4 # Cache the table in csql.
5 # Run cacheverify -t t1.
6 # It should display number of records for csql and mysql respectively.
7 # Run cacheverify -t t1 -p.
8 # It should give an error saying no primary key is present on table t1.
9 # Run cacheverify -t t1 -f.
10 # It should give an error saying no primary key is present on table t1.
12 #Run this test only under csql/test or on this directory.
13 #Otherwise, it may fail
15 input=${PWD}/cache/CacheVerify/inputtest4.sql
16 REL_PATH=.
17 if [ -s "$input" ]
18 then
19 REL_PATH=${PWD}/cache/CacheVerify
22 cp $CSQL_CONFIG_FILE /tmp/csql.conf
23 export CSQL_CONFIG_FILE=/tmp/csql.conf
24 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
25 echo DSN=$DSN >>$CSQL_CONFIG_FILE
26 DS="$DSN $DBUSER $PASSWORD"
27 rm -f /tmp/csql/csqlds.conf
28 touch /tmp/csql/csqlds.conf
29 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
30 if [ $? -ne 0 ]
31 then
32 exit 1;
35 if [ $DSN = "oracle" ]
36 then
37 isql $DS < ${REL_PATH}/inputtest4.oracle > /dev/null 2>&1
38 if [ $? -ne 0 ]
39 then
40 exit 1;
42 else
43 isql $DS < ${REL_PATH}/inputtest4.sql > /dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 exit 1;
49 if [ $? -ne 0 ]
50 then
51 exit 1;
54 rm -f /tmp/csql/csqltable.conf
55 touch /tmp/csql/csqltable.conf
56 echo "1 t1 NULL NULL NULL $DSN" >/tmp/csql/csqltable.conf
57 sleep 2
58 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -R>/dev/null 2>&1
59 if [ $? -ne 0 ]
60 then
61 isql $DS < ${REL_PATH}/drop.sql > /dev/null 2>&1
62 exit 2;
65 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1
66 if [ $? -ne 0 ]
67 then
68 isql $DS < ${REL_PATH}/drop.sql > /dev/null 2>&1
69 exit 3;
72 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -p
73 if [ $? -eq 0 ]
74 then
75 isql $DS < ${REL_PATH}/drop.sql > /dev/null 2>&1
76 exit 4;
79 $CSQL_INSTALL_ROOT/bin/cacheverify -t t1 -f
80 if [ $? -eq 0 ]
81 then
82 isql $DS < ${REL_PATH}/drop.sql > /dev/null 2>&1
83 exit 5;
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 0;