adding test scripts
[csql.git] / test / cache / CacheTable / test029.ksh
blobde9be7875420eed001ab51fda55f417f0f130323
1 #!/bin/ksh
2 #Test Case
3 # Create table t5 and t6 in target DB
4 # Load t5 and t6 table without condition option with direct option
5 # Insert some record in CSQL tool as csql -g option
6 # It should insert into target database not in CSQL database
9 input=${PWD}/cache/CacheTable/inputtest4.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/CacheTable
15 rm -f /tmp/csql.conf
16 cp $CSQL_CONFIG_FILE /tmp
17 export CSQL_CONFIG_FILE=/tmp/csql.conf
19 # create table t1,t2 in target DB.
20 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
21 echo DSN=$DSN >>$CSQL_CONFIG_FILE
22 DS="$DSN $DBUSER $PASSWORD"
23 rm -f /tmp/csql/csqlds.conf
24 touch /tmp/csql/csqlds.conf
25 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
26 if [ $? -ne 0 ]
27 then
28 exit 1;
30 if [ $DSN = "db2" ]
31 then
32 isql $DS < ${REL_PATH}/createt5db2.sql >/dev/null 2>&1
33 else
34 isql $DS < ${REL_PATH}/createt5.sql >/dev/null 2>&1
36 if [ $? -ne 0 ]
37 then
38 exit 2;
41 echo Table t1 and t2 created in target DB.
43 rm -f /tmp/csql/csqltable.conf
44 touch /tmp/csql/csqltable.conf
46 echo "cachetable -t t5 -D"
47 echo "cachetable -t t6 -D"
49 $CSQL_INSTALL_ROOT/bin/cachetable -t t5 -D
50 if [ $? -ne 0 ]
51 then
52 isql $DS < ${REL_PATH}/drop5.sql >/dev/null 2>&1
53 rm -f /tmp/csql/csqltable.conf
54 touch /tmp/csql/csqltable.conf
55 exit 3;
58 $CSQL_INSTALL_ROOT/bin/cachetable -t t6 -D
59 if [ $? -ne 0 ]
60 then
61 rm -f /tmp/csql/csqltable.conf
62 touch /tmp/csql/csqltable.conf
63 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop5.sql >/dev/null 2>&1
64 isql $DS < ${REL_PATH}/drop5.sql >/dev/null 2>&1
65 exit 4;
68 for a in 5 6
70 echo "insert into t$a values(15,20);"
71 echo "insert into t$a values(16,21);"
72 done>>${REL_PATH}/insertt5t6.sql
74 echo "select query on t1 and t2 table"
75 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/insertt5t6.sql
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/drop5.sql >/dev/null 2>&1
81 isql $DS < ${REL_PATH}/drop5.sql >/dev/null 2>&1
82 rm -f $REL_PATH/insertt5t6.sql
83 exit 5;
85 for a in 5 6
87 echo "select * from t$a;"
88 done>>${REL_PATH}/selectt5t6.sql
90 $CSQL_INSTALL_ROOT/bin/csql -g -s $REL_PATH/selectt5t6.sql
91 if [ $? -ne 0 ]
92 then
93 rm -f /tmp/csql/csqltable.conf
94 touch /tmp/csql/csqltable.conf
95 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop5.sql >/dev/null 2>&1
96 isql $DS < ${REL_PATH}/drop5.sql >/dev/null 2>&1
97 rm -f $REL_PATH/insertt5t6.sql
98 rm -f $REL_PATH/selectt5t6.sql
99 exit 6;
101 isql $DS < ${REL_PATH}/selectt5t6.sql
102 $CSQL_INSTALL_ROOT/bin/cachetable -t t6 -u
103 if [ $? -ne 0 ]
104 then
105 rm -f /tmp/csql/csqltable.conf
106 touch /tmp/csql/csqltable.conf
107 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop5.sql >/dev/null 2>&1
108 isql $DS < ${REL_PATH}/drop5.sql >/dev/null 2>&1
109 rm -f $REL_PATH/insertt5t6.sql
110 rm -f $REL_PATH/selectt5t6.sql
111 exit 7;
113 $CSQL_INSTALL_ROOT/bin/cachetable -t t5 -u
114 if [ $? -ne 0 ]
115 then
116 rm -f /tmp/csql/csqltable.conf
117 touch /tmp/csql/csqltable.conf
118 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop5.sql >/dev/null 2>&1
119 isql $DS < ${REL_PATH}/drop5.sql >/dev/null 2>&1
120 rm -f $REL_PATH/insertt5t6.sql
121 rm -f $REL_PATH/selectt5t6.sql
122 exit 8;
125 rm -f /tmp/csql/csqltable.conf
126 touch /tmp/csql/csqltable.conf
128 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop5.sql > /dev/null 2>&1
129 isql $DS <${REL_PATH}/drop5.sql >/dev/null 2>&1
130 rm -f $REL_PATH/insertt5t6.sql
131 rm -f $REL_PATH/selectt5t6.sql
133 exit 0;