adding test scripts
[csql.git] / test / cache / CacheTable / test017.ksh
blobadbe4aa3be4e2af28da699c94dfbe1ec75457e1a
1 #!/bin/ksh
2 #Test Case
3 #17. Create table t1 and t2 in target DB with 10 records.
4 # Add following entries in csqltable.conf file:
5 # 1:t1 NULL
6 # 2:t2 t2f1<5
7 # Recover the two tables from the target DB with -R option.
8 # CSQL should contain 10 records of t1 and 4 records of t2
10 #Run this test only under csql/test or on this directory
11 #otherwise it may fail.
13 #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 # create table t1,t2 in target DB.
36 isql $DS < ${REL_PATH}/create.sql >/dev/null 2>&1
37 if [ $? -ne 0 ]
38 then
39 cp /tmp/csql.conf $CSQL_CONFIG_FILE
40 exit 1;
42 echo Table t1 and t2 created in target DB.
44 rm -f /tmp/csql/csqltable.conf
45 touch /tmp/csql/csqltable.conf
47 echo "1 t1 NULL NULL NULL $DSN" > /tmp/csql/csqltable.conf
48 echo "2 t2 NULL t2f1<5 NULL $DSN" >> /tmp/csql/csqltable.conf
50 # caching with -R option
51 $CSQL_INSTALL_ROOT/bin/cachetable -R
52 if [ $? -ne 0 ]
53 then
54 cp /tmp/csql.conf $CSQL_CONFIG_FILE
55 exit 2;
58 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectstar.sql
59 if [ $? -ne 0 ]
60 then
61 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql > /dev/null 2>&1
62 isql $DS < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
63 rm -f /tmp/csql/csqltable.conf
64 touch /tmp/csql/csqltable.conf
65 cp /tmp/csql.conf $CSQL_CONFIG_FILE
66 exit 3;
69 rm -f /tmp/csql/csqltable.conf
70 touch /tmp/csql/csqltable.conf
71 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1t2.sql > /dev/null 2>&1
72 isql $DS < ${REL_PATH}/dropt1t2.sql >/dev/null 2>&1
73 cp /tmp/csql.conf $CSQL_CONFIG_FILE
74 exit 0;