adding test scripts
[csql.git] / test / cache / CacheTable / test013.ksh
blob9b3e709484b8ff03dcaa4909d00b5aa0210152a1
1 #!/bin/ksh
2 # Test Case
4 # Create table t1 and t2 in mysql and insert 10 records each.
5 # Cache the tables into csql with -R option.
6 # Create table t3 in csql only and insert few records.
7 # Unload t3 table. It should return error.
9 input=${PWD}/cache/CacheTable/create.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/CacheTable
16 cp $CSQL_CONFIG_FILE /tmp/csql.conf
17 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
18 echo DSN=$DSN >>$CSQL_CONFIG_FILE
19 DS="$DSN $DBUSER $PASSWORD"
20 rm -f /tmp/csql/csqlds.conf
21 touch /tmp/csql/csqlds.conf
22 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
23 if [ $? -ne 0 ]
24 then
25 cp /tmp/csql.conf $CSQL_CONFIG_FILE
26 exit 1;
29 isql $DS < ${REL_PATH}/create.sql >/dev/null 2>&1
30 echo table t1 and t2 are created with records in target db
32 rm -f /tmp/csql/csqltable.conf
33 touch /tmp/csql/csqltable.conf
35 # write to csqltable.conf file
36 echo "1 t1 NULL NULL NULL $DSN" > /tmp/csql/csqltable.conf
37 echo "2 t2 NULL t2f1<5 NULL $DSN" >> /tmp/csql/csqltable.conf
39 $CSQL_INSTALL_ROOT/bin/cachetable -R
40 if [ $? -ne 0 ]
41 then
42 rm -f /tmp/csql/csqltable.conf
43 touch /tmp/csql/csqltable.conf
44 isql $DS < ${REL_PATH}/dropall.sql >/dev/null 2>&1
45 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropall.sql > /dev/null 2>&1
46 cp /tmp/csql.conf $CSQL_CONFIG_FILE
47 exit 1;
50 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/createt3.sql 2>&1 >/dev/null
52 $CSQL_INSTALL_ROOT/bin/cachetable -t t3 -u
53 if [ $? -eq 0 ]
54 then
55 rm -f /tmp/csql/csqltable.conf
56 touch /tmp/csql/csqltable.conf
57 isql $DS < ${REL_PATH}/dropall.sql >/dev/null 2>&1
58 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropall.sql > /dev/null 2>&1
59 cp /tmp/csql.conf $CSQL_CONFIG_FILE
60 exit 2;
63 rm /tmp/csql/csqltable.conf
64 touch /tmp/csql/csqltable.conf
65 isql $DS < ${REL_PATH}/dropall.sql >/dev/null 2>&1
66 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropall.sql > /dev/null 2>&1
67 cp /tmp/csql.conf $CSQL_CONFIG_FILE
68 exit 0;