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