adding test scripts
[csql.git] / test / cache / CacheTable / test008.ksh
blob06420df98c48b51cb37f78ace5d0682a965a7ea6
1 #!/bin/ksh
2 # Test Case
4 # 8.load table. csqldump ,
5 # unload table csqldump, insert record to mysql directly,
6 # reload table, csqldump and verify the results.
7 # reload should get the inserted record also.
9 #Run this test only under csql/test or on this directory.
10 #Otherwise, it may fail
12 dropAll() {
13 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
14 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
17 input=${PWD}/cache/CacheTable/inputtest4.sql
18 REL_PATH=.
19 if [ -s "$input" ]
20 then
21 REL_PATH=${PWD}/cache/CacheTable
24 cp $CSQL_CONFIG_FILE /tmp/csql.conf
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 cp /tmp/csql.conf $CSQL_CONFIG_FILE
33 exit 1;
36 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
37 isql $DS < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
39 rm -f /tmp/csql/csqltable.conf
40 touch /tmp/csql/csqltable.conf
42 $CSQL_INSTALL_ROOT/bin/cachetable -t t1
43 if [ $? -ne 0 ]
44 then
45 dropAll
46 cp /tmp/csql.conf $CSQL_CONFIG_FILE
47 exit 1;
50 mv /tmp/csql/csqltable.conf /tmp/csql/csqltable.conf.temp
51 rm -f /tmp/csql/csqltable.conf
52 touch /tmp/csql/csqltable.conf
54 $CSQL_INSTALL_ROOT/bin/csqldump
56 mv /tmp/csql/csqltable.conf.temp /tmp/csql/csqltable.conf
57 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u >/dev/null 2>&1
58 if [ $? -ne 0 ]
59 then
60 dropAll
61 cp /tmp/csql.conf $CSQL_CONFIG_FILE
62 exit 2;
65 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
67 $CSQL_INSTALL_ROOT/bin/csqldump
69 isql $DS < ${REL_PATH}/insert.sql >/dev/null 2>&1
71 $CSQL_INSTALL_ROOT/bin/cachetable -t t1
72 if [ $? -ne 0 ]
73 then
74 dropAll
75 cp /tmp/csql.conf $CSQL_CONFIG_FILE
76 exit 3;
79 rm -f /tmp/csql/csqltable.conf
80 touch /tmp/csql/csqltable.conf
82 $CSQL_INSTALL_ROOT/bin/csqldump
84 dropAll
86 cp /tmp/csql.conf $CSQL_CONFIG_FILE
87 exit 0;