adding test scripts
[csql.git] / test / cache / CacheTable / test020.ksh
blobb010d945b34132483f4cdb25ca8183c4fb38bfde
1 #!/bin/ksh
3 # Create 't1' table with two records in target DB. \
4 # cache t1 from target to csql.
5 # table 't1' can't be deleted by DROP statement.
6 # it should be unloaded by -u option
8 # AUTHOR : Jitendra Lenka
10 #!/bin/ksh
11 input=${PWD}/cache/CacheTable/inputtest4.sql
12 REL_PATH=.
13 if [ -s "$input" ]
14 then
15 REL_PATH=${PWD}/cache/CacheTable
18 rm -f /tmp/csql.conf
19 cp $REL_PATH/csql.conf /tmp
20 export CSQL_CONFIG_FILE=/tmp/csql.conf
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;
31 isql $DS < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
32 if [ $? -ne 0 ]
33 then
34 exit 1;
36 rm -f /tmp/csql/csqltable.conf
37 touch /tmp/csql/csqltable.conf
39 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
40 pid=$!
41 sleep 5
43 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 >/dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 rm -f /tmp/csql/csqltable.conf
47 touch /tmp/csql/csqltable.conf
48 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
49 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
50 kill -9 $pid
51 ipcrm -M 4000 -M 4500
52 exit 2;
55 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql >/dev/null 2>&1
56 if [ $? -ne 0 ]
57 then
58 rm -f /tmp/csql/csqltable.conf
59 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 kill -9 $pid
63 ipcrm -M 4000 -M 4500
64 exit 3;
66 echo "cache table 't1' can't be dropped"
68 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
69 if [ $? -ne 0 ]
70 then
71 rm -f /tmp/csql/csqltable.conf
72 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 kill -9 $pid
76 ipcrm -M 4000 -M 4500
77 exit 4;
79 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u >/dev/null 2>&1
81 if [ $? -ne 0 ]
82 then
83 rm -f /tmp/csql/csqltable.conf
84 touch /tmp/csql/csqltable.conf
85 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
86 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
87 kill -9 $pid
88 ipcrm -M 4000 -M 4500
89 exit 4;
92 echo "cache table 't1' unloaded by -u option"
93 rm -f /tmp/csql/csqltable.conf
94 touch /tmp/csql/csqltable.conf
95 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
96 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
97 kill -9 $pid
98 ipcrm -M 4000 -M 4500
99 exit 0;