adding test scripts
[csql.git] / test / cache / CacheTable / test019.ksh
blob9009f9363b56b94104e42e7cb22e80eef0f57fed
1 #!/bin/ksh
2 #Test Case
4 #19. create t1 table with some records in TDB,
5 # cache it with -c option.
6 # Insert some records which satisfy the cache condition into t1 in TDB.
7 # Insert some records which do not satisfy cache condition into t1 in TDB.
8 # Reload t1 with -r option
9 # CSQL should contain all records which satisfies cache condition from TDB
11 #Run this test only under csql/test or on this directory.
12 #otherwise, it may fail.
14 # AUTHOR : Jitendra Lenka
15 input=${PWD}/cache/CacheTable/inputtest4.sql
16 REL_PATH=.
17 if [ -s "$input" ]
18 then
19 REL_PATH=${PWD}/cache/CacheTable
22 cp $CSQL_CONFIG_FILE /tmp/csql.conf
23 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
24 echo DSN=$DSN >>$CSQL_CONFIG_FILE
25 DS="$DSN $DBUSER $PASSWORD"
26 rm -f /tmp/csql/csqlds.conf
27 touch /tmp/csql/csqlds.conf
28 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
29 if [ $? -ne 0 ]
30 then
31 cp /tmp/csql.conf $CSQL_CONFIG_FILE
32 exit 1;
35 isql $DS < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
36 if [ $? -ne 0 ]
37 then
38 cp /tmp/csql.conf $CSQL_CONFIG_FILE
39 exit 1;
42 rm -f /tmp/csql/csqltable.conf
43 touch /tmp/csql/csqltable.conf
45 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -c "f1=1" >/dev/null 2>&1
46 if [ $? -ne 0 ]
47 then
48 rm -f /tmp/csql/csqltable.conf
49 touch /tmp/csql/csqltable.conf
50 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
51 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
52 cp /tmp/csql.conf $CSQL_CONFIG_FILE
53 exit 2;
56 echo after cahe with -c option
57 echo "select * from t1"
59 #select from t1 table
60 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
61 if [ $? -ne 0 ]
62 then
63 rm -f /tmp/csql/csqltable.conf
64 touch /tmp/csql/csqltable.conf
65 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
66 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
67 cp /tmp/csql.conf $CSQL_CONFIG_FILE
68 exit 3;
72 isql $DS < ${REL_PATH}/insert.sql >/dev/null 2>&1
74 # again reload table with -r option.
75 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -r >/dev/null 2>&1
76 if [ $? -ne 0 ]
77 then
78 rm -f /tmp/csql/csqltable.conf
79 touch /tmp/csql/csqltable.conf
80 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
81 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
82 cp /tmp/csql.conf $CSQL_CONFIG_FILE
83 exit 4;
86 #after reload, select from t1
87 echo "after reload , select * from t1;"
88 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
89 if [ $? -ne 0 ]
90 then
91 rm -f /tmp/csql/csqltable.conf
92 touch /tmp/csql/csqltable.conf
93 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
94 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
95 cp /tmp/csql.conf $CSQL_CONFIG_FILE
96 exit 5;
99 rm -f /tmp/csql/csqltable.conf
100 touch /tmp/csql/csqltable.conf
101 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
102 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
103 cp /tmp/csql.conf $CSQL_CONFIG_FILE
104 exit 0;