adding test scripts
[csql.git] / test / cache / CacheTable / test035.ksh
blob61f0d4126b48d16432033b9110bd53a9e08f6386
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 f5 it should fail
7 # Author:=bijaya
10 input=${PWD}/cache/CacheTable/inputtest4.sql
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 f5
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 rm -f /tmp/csql/csqltable.conf
57 touch /tmp/csql/csqltable.conf
58 kill -9 $pid
59 ipcrm -M 4000 -M 4500
60 exit 2
62 isql $DS <${REL_PATH}/dt1.sql >/dev/null 2>&1
63 rm -f /tmp/csql/csqltable.conf
64 touch /tmp/csql/csqltable.conf
65 rm -f $REL_PATH/t1.sql ${REL_PATH}/dt1.sql
66 kill -9 $pid
67 ipcrm -M 4000 -M 4500
68 exit 0;