adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / CacheTable / test015.ksh
blobb30caa2f3127f46072b30d85a29639ada1e19e78
1 #!/bin/sh
2 #Test Case
3 #15. create table t1 and t2 in target DB with 10 records
4 # Load t1 table without condition option
5 # Load t2 with condition " t2f1 < 5 ".
7 # table t1 should be loaded in CSQL with mode 1.
8 # and table t2 should be loaded with mode 2 in csqltable .conf file.
10 # select * from t1, should show all the records,
11 # select * from t2 should show the records as per the condition in the time o f caching.
13 #Run the test only under csql/test or on this directory.
14 #otherwise it may fail.
16 # Author : Jitendra Lenka
18 input=${PWD}/cache/CacheTable/inputtest4.sql
19 REL_PATH=.
20 if [ -s "$input" ]
21 then
22 REL_PATH=${PWD}/cache/CacheTable
25 cp $CSQL_CONFIG_FILE /tmp/csql.conf
26 echo DSN=$DSN >>$CSQL_CONFIG_FILE
27 # create table t1,t2 in target DB.
28 isql $DSN < ${REL_PATH}/create.sql >/dev/null 2>&1
29 if [ $? -ne 0 ]
30 then
31 cp /tmp/csql.conf $CSQL_CONFIG_FILE
32 exit 1;
35 echo Table t1 and t2 created in target DB.
37 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
38 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
40 echo "cachetable -t t1"
41 echo "cachetable -t t2 -c \"t2f1<5\" "
43 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 >/dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 isql $DSN < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
47 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
49 cp /tmp/csql.conf $CSQL_CONFIG_FILE
50 exit 2;
53 $CSQL_INSTALL_ROOT/bin/cachetable -t t2 -c "t2f1<5"
54 if [ $? -ne 0 ]
55 then
56 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
57 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
58 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
59 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
60 cp /tmp/csql.conf $CSQL_CONFIG_FILE
61 exit 3;
65 echo "select query on t1 and t2 table"
66 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectstar.sql
68 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
69 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
71 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql > /dev/null 2>&1
72 isql $DSN <${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
73 cp /tmp/csql.conf $CSQL_CONFIG_FILE
74 exit 0;