adding test scripts
[csql.git] / test / cache / CacheTable / test043.ksh
blob2abb3937ea734cbf19b3513d159a5fed18f41bc5
1 #!/bin/ksh
2 # Create t1,t2,t3,t4 and t5 table in target Database
3 # Cache all tables specifying different caching modes
4 # Use -S option to display cache information about each table
5 # drop all tables and use -S option
6 # It should display "no cached tables"
8 input=${PWD}/cache/CacheTable/createtable.sql
9 REL_PATH=.
10 if [ -s "$input" ]
11 then
12 REL_PATH=${PWD}/cache/CacheTable
15 cp $CSQL_CONFIG_FILE /tmp/csql.conf
17 echo DSN=$DSN >>$CSQL_CONFIG_FILE
18 DS="$DSN $DBUSER $PASSWORD"
19 rm -f /tmp/csql/csqlds.conf
20 touch /tmp/csql/csqlds.conf
21 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
22 if [ $? -ne 0 ]
23 then
24 exit 1;
27 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
28 isql $DS < ${REL_PATH}/createtable.sql > /dev/null 2>&1
30 if [ $? -ne 0 ]
31 then
32 cp /tmp/csql.conf $CSQL_CONFIG_FILE
33 exit 2;
36 rm -f /tmp/csql/csqltable.conf
37 touch /tmp/csql/csqltable.conf
39 #simple caching
40 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t1 >/dev/null 2>&1
41 if [ $? -ne 0 ]
42 then
43 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
44 cp /tmp/csql.conf $CSQL_CONFIG_FILE
45 exit 3;
48 #cachetable with condition,"-c" option
49 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t2 -c "t2f1=11" > /dev/null 2>&1
51 if [ $? -ne 0 ]
52 then
53 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
54 cp /tmp/csql.conf $CSQL_CONFIG_FILE
55 exit 4;
58 #cache table with "-f" option
59 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t3 -f "t3f1" > /dev/null 2>&1
61 if [ $? -ne 0 ]
62 then
63 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
64 cp /tmp/csql.conf $CSQL_CONFIG_FILE
65 exit 5;
68 # cache table with "-d" option
69 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t4 -D > /dev/null 2>&1
71 if [ $? -ne 0 ]
72 then
73 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
74 cp /tmp/csql.conf $CSQL_CONFIG_FILE
75 exit 6;
78 #cache table with condition, field list and direct option
79 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t5 -c "t5f1=11" -f "t5f2" -D > /dev/null 2>&1
81 if [ $? -ne 0 ]
82 then
83 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
84 cp /tmp/csql.conf $CSQL_CONFIG_FILE
85 exit 7;
88 #describe the cache tables -S option
89 echo ""
90 echo "(1). cachetable -S"
91 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -S
92 if [ $? -ne 0 ]
93 then
94 cp /tmp/csql.conf $CSQL_CONFIG_FILE
95 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
96 exit 8;
99 #Describe the specific cache table with -S option
100 echo "(2). cachetable -t t5 -S"
101 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -t t5 -S
102 if [ $? -ne 0 ]
103 then
104 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/droptable.sql > /dev/null 2>&1
105 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
106 cp /tmp/csql.conf $CSQL_CONFIG_FILE
107 exit 9;
110 rm -f /tmp/csql/csqltable.conf
111 touch /tmp/csql/csqltable.conf
113 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/droptable.sql > /dev/null 2>&1
114 isql $DS < ${REL_PATH}/droptable.sql >/dev/null 2>&1
116 #use -S option when there is no table present in cache
117 echo "(3). cachetable -S (Cross Verification)"
118 $CSQL_INSTALL_ROOT/bin/cachetable -U root -P manager -S
119 if [ $? -ne 0 ]
120 then
121 cp /tmp/csql.conf $CSQL_CONFIG_FILE
122 exit 10;
125 cp /tmp/csql.conf $CSQL_CONFIG_FILE
126 exit 0;