adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / CacheTable / test008.ksh
blob51245f4ef0ae06ee238e85d50393924d080534e2
1 #!/bin/sh
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 #cp $CSQL_CONFIG_FILE /tmp/csql.conf
14 #echo DSN=$DSN >>$CSQL_CONFIG_FILE
15 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
16 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
17 #cp /tmp/csql.conf $CSQL_CONFIG_FILE
19 input=${PWD}/cache/CacheTable/inputtest4.sql
20 REL_PATH=.
21 if [ -s "$input" ]
22 then
23 REL_PATH=${PWD}/cache/CacheTable
26 cp $CSQL_CONFIG_FILE /tmp/csql.conf
27 echo DSN=$DSN >>$CSQL_CONFIG_FILE
28 isql $DSN < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
30 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
31 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 > /dev/null 2>&1
34 if [ $? -ne 0 ]
35 then
36 dropAll
37 cp /tmp/csql.conf $CSQL_CONFIG_FILE
38 exit 1;
41 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
42 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
44 $CSQL_INSTALL_ROOT/bin/csqldump
46 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
47 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
48 echo "1:t1" > /tmp/csql/csqltable.conf
49 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u > /dev/null 2>&1
50 if [ $? -ne 0 ]
51 then
52 dropAll
53 cp /tmp/csql.conf $CSQL_CONFIG_FILE
54 exit 2;
57 $CSQL_INSTALL_ROOT/bin/csqldump
59 isql $DSN < ${REL_PATH}/insert.sql >/dev/null 2>&1
61 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 > /dev/null 2>&1
62 if [ $? -ne 0 ]
63 then
64 dropAll
65 cp /tmp/csql.conf $CSQL_CONFIG_FILE
66 exit 3;
69 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
70 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
72 $CSQL_INSTALL_ROOT/bin/csqldump
74 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
75 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
76 dropAll
78 cp /tmp/csql.conf $CSQL_CONFIG_FILE
79 exit 0;