adding test scripts
[csql.git] / test / cache / CacheTable / test034.ksh
blob3ce5a4f0160aeec29789d396736b9920582550d1
1 #!/bin/ksh
2 # Test Case
4 # Bi-directional cache test
5 # Create table t1 with field f1 int ,f2 char,f3 smallint, f4 bigint . Make bidirectional flag and cache flag true. Cache the table with -p fieldname it should fail
6 # Author:=bijaya
9 input=${PWD}/cache/CacheTable/csql1.conf
11 REL_PATH=.
12 if [ -s "$input" ]
13 then
14 REL_PATH=${PWD}/cache/CacheTable
16 rm -f /tmp/csql1.conf
17 cp $REL_PATH/csql1.conf /tmp
18 export CSQL_CONFIG_FILE=/tmp/csql1.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
20 DS="$DSN $DBUSER $PASSWORD"
21 rm -f /tmp/csql/csqlds.conf
22 touch /tmp/csql/csqlds.conf
23 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
24 if [ $? -ne 0 ]
25 then
26 exit 1;
29 echo "create table t1(f1 int ,f2 char(12),f3 smallint , f4 bigint);">$REL_PATH/t1.sql
30 for a in 1 2 3 4 5 6 7 8 9
32 echo "insert into t1 values($a,'papu',12,$a+123124);"
33 done>>t1.sql
34 isql $DS < $REL_PATH/t1.sql >/dev/null 2>&1
35 if [ $? -ne 0 ]
36 then
37 echo "unable to creste in target db"
38 rm -f $REL_PATH/t1.sql
39 exit 1
42 echo "drop table t1;">${REL_PATH}/dt1.sql
43 rm -f /tmp/csql/csqltable.conf
44 touch /tmp/csql/csqltable.conf
46 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
47 pid=$!
48 sleep 5
49 echo "server started"
50 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -p f1
51 if [ $? -eq 0 ]
52 then
53 echo "Unable to cache"
54 isql $DS <${REL_PATH}/dt1.sql >/dev/null 2>&1
55 rm -f $REL_PATH/t1.sql ${REL_PATH}/dt1.sql
56 kill -9 $pid
57 ipcrm -M 4000 -M 4500
58 exit 2
60 isql $DS <${REL_PATH}/dt1.sql >/dev/null 2>&1
61 rm -f /tmp/csql/csqltable.conf
62 touch /tmp/csql/csqltable.conf
63 rm -f $REL_PATH/t1.sql ${REL_PATH}/dt1.sql
64 kill -9 $pid
65 ipcrm -M 4000 -M 4500
66 exit 0;