adding test scripts
[csql.git] / test / cache / CacheTable / test027.ksh
bloba99fc39159ee99f90b72f7db3a80357185b19e23
1 #!/bin/ksh
2 #Test case 27.
3 # create t1 table with some records in target DB.
4 # cache it with -c and -f option
5 # Insert some records which satisfy the cache condition
6 # Insert some records which do not satisfy the cache condition
7 # Reload table with -r option
8 # It should get all records which satisfy the condition for specified fields
10 # AUTHOR : Jitendra Lenka
12 input=${PWD}/cache/CacheTable/
13 REL_PATH=.
14 if [ -s "$input" ]
15 then
16 REL_PATH=${PWD}/cache/CacheTable
18 rm -f /tmp/csql.conf
19 cp $CSQL_CONFIG_FILE /tmp
20 export CSQL_CONFIG_FILE=/tmp/csql.conf
21 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
22 echo DSN=$DSN >>$CSQL_CONFIG_FILE
23 DS="$DSN $DBUSER $PASSWORD"
24 rm -f /tmp/csql/csqlds.conf
25 touch /tmp/csql/csqlds.conf
26 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
27 if [ $? -ne 0 ]
28 then
29 exit 1;
31 isql $DS < ${REL_PATH}/fmodeinsert.sql >/dev/null 2>&1
32 if [ $? -ne 0 ]
33 then
34 exit 1;
37 rm -f /tmp/csql/csqltable.conf
38 touch /tmp/csql/csqltable.conf
40 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -c "f1=1" -f "f1,f3,f5"
41 if [ $? -ne 0 ]
42 then
43 rm -f /tmp/csql/csqltable.conf
44 touch /tmp/csql/csqltable.conf
46 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
47 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
48 exit 2;
51 isql $DS < ${REL_PATH}/frecords.sql >/dev/null 2>&1
53 # again reload table with -r option.
54 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -r >/dev/null 2>&1
55 if [ $? -ne 0 ]
56 then
57 rm -f /tmp/csql/csqltable.conf
58 touch /tmp/csql/csqltable.conf
60 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
61 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
62 exit 3;
65 #after reload, select from t1
66 echo "after reload , select * from t1;"
67 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
68 if [ $? -ne 0 ]
69 then
70 rm -f /tmp/csql/csqltable.conf
71 touch /tmp/csql/csqltable.conf
73 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
74 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
75 exit 5;
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 exit 0;