adding test scripts
[csql.git] / test / cache / CacheTable / test041.ksh
blobccd134e9857cce9668936246de54e1c77b9f165b
1 #!/bin/ksh
2 # Test Case
4 # Bi-directional cache test
5 # Create table t1 with field f1 int ,f2 char,f3 smallint , f4 int primary key(f1).Make bidirectional flag and cache flag true. Cache the table with cachetable -t t1 -f f1,f2,f3 -p f4 it should fail
7 # Author:=bijaya
10 input=${PWD}/cache/CacheTable/csql1.conf
12 REL_PATH=.
13 if [ -s "$input" ]
14 then
15 REL_PATH=${PWD}/cache/CacheTable
17 rm -f /tmp/csql1.conf
18 cp $REL_PATH/csql1.conf /tmp
19 export CSQL_CONFIG_FILE=/tmp/csql1.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 echo "create table t1(f1 int ,f2 char(12),f3 smallint , f4 bigint,primary key(f1));">$REL_PATH/t1.sql
32 for a in 1 2 3 4 5 6 7 8 9
34 echo "insert into t1 values($a,'papu',12,$a+123124);"
35 done>>t1.sql
36 isql $DS < $REL_PATH/t1.sql >/dev/null 2>&1
37 if [ $? -ne 0 ]
38 then
39 echo "unable to creste in target db"
40 rm -f $REL_PATH/t1.sql
41 exit 1
44 echo "drop table t1;">${REL_PATH}/dt1.sql
45 rm -f /tmp/csql/csqltable.conf
46 touch /tmp/csql/csqltable.conf
48 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
49 pid=$!
50 sleep 5
51 echo "server started"
52 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -f f1,f2,f3 -p f4
53 if [ $? -eq 0 ]
54 then
55 echo "Unable to cache"
56 isql $DS <${REL_PATH}/dt1.sql >/dev/null 2>&1
57 rm -f $REL_PATH/t1.sql ${REL_PATH}/dt1.sql
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;