adding test scripts
[csql.git] / test / cache / CacheTable / test016.ksh
bloba87c14c1b801d01ae0c2406dae8d101d1a07b9ad
1 #!/bin/ksh
2 #Test case
3 #16. create table t1,t2 in target DB with 10 records.
4 # load t1 table with condition option
5 # load t2 table with condition .
7 # unload the two tables t1,t2 with -u option.
9 # AUTHOR : Jitendra Lenka
11 input=${PWD}/cache/CacheTable/inputtest4.sql
12 REL_PATH=.
13 if [ -s "$input" ]
14 then
15 REL_PATH=${PWD}/cache/CacheTable
18 cp $CSQL_CONFIG_FILE /tmp/csql.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
20 DS="$DSN $DBUSER $PASSWORD"
21 rm -f /tmp/csql/csqlds.conf
22 touch /tmp/csql/csqlds.conf
23 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
24 if [ $? -ne 0 ]
25 then
26 exit 1;
29 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
30 # create table t1,t2 in target DB.
31 isql $DS < ${REL_PATH}/create.sql >/dev/null 2>&1
32 if [ $? -ne 0 ]
33 then
34 cp /tmp/csql.conf $CSQL_CONFIG_FILE
35 exit 1;
38 echo Table t1 and t2 created in target DB.
40 rm -f /tmp/csql/csqltable.conf
41 touch /tmp/csql/csqltable.conf
43 echo "cachetable -t t1"
44 echo "cachetable -t t2 -c \"t2f1<5\" "
46 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 >/dev/null 2>&1
47 if [ $? -ne 0 ]
48 then
49 isql $DS < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
50 rm -f /tmp/csql/csqltable.conf
52 cp /tmp/csql.conf $CSQL_CONFIG_FILE
53 exit 2;
56 echo "Table t1 unloaded from CSQL"
58 $CSQL_INSTALL_ROOT/bin/cachetable -t t2 -c "t2f1<5" >/dev/null 2>&1
59 if [ $? -ne 0 ]
60 then
61 rm -f /tmp/csql/csqltable.conf
62 touch /tmp/csql/csqltable.conf
64 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql >/dev/null 2>&1
65 isql $DS < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
66 cp /tmp/csql.conf $CSQL_CONFIG_FILE
67 exit 3;
70 # unload the two tables from csql and remove entry from csqltable.conf
72 echo "Table t2 unloaded from CSQl"
73 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u >/dev/null 2>&1
74 if [ $? -ne 0 ]
75 then
76 rm -f /tmp/csql/csqltable.conf
77 touch /tmp/csql/csqltable.conf
79 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql >/dev/null 2>&1
80 isql $DS < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
82 cp /tmp/csql.conf $CSQL_CONFIG_FILE
83 exit 4;
86 $CSQL_INSTALL_ROOT/bin/cachetable -t t2 -u >/dev/null 2>&1
87 if [ $? -ne 0 ]
88 then
89 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropt1t2.sql >/dev/null 2>&1
90 isql $DS < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
91 rm -f /tmp/csql/csqltable.conf
93 cp /tmp/csql.conf $CSQL_CONFIG_FILE
94 exit 5;
97 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql > /dev/null 2>&1
98 isql $DS <${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
99 rm -f /tmp/csql/csqltable.conf
100 touch /tmp/csql/csqltable.conf
101 cp /tmp/csql.conf $CSQL_CONFIG_FILE
102 exit 0;