common.h added to support AbsSqlConnection and AbsSqlStatement creations
[csql.git] / test / cache / CacheTable / test034.ksh
blob37ea87682ed057b6ffaa6525901e0bc47f8c8d17
1 #!/bin/sh
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 pass
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 echo "create table t1(f1 int ,f2 char(12),f3 smallint , f4 bigint);">$REL_PATH/t1.sql
21 for((a=1;a<10;a++))
23 echo "insert into t1 values($a,'papu',12,$a+123124);"
24 done>>t1.sql
25 isql $DSN < $REL_PATH/t1.sql >/dev/null 2>&1
26 if [ $? -ne 0 ]
27 then
28 echo "unable to creste in target db"
29 rm -f $REL_PATH/t1.sql
30 exit 1
33 echo "drop table t1;">${REL_PATH}/dt1.sql
34 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
35 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
37 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
38 pid=$!
39 sleep 5
40 echo "server started"
41 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -p f1
42 if [ $? -eq 0 ]
43 then
44 echo "Unable to cache"
45 isql $DSN <${REL_PATH}/dt1.sql >/dev/null 2>&1
46 rm -f $REL_PATH/t1.sql ${REL_PATH}/dt1.sql
47 kill -2 $pid
48 ipcrm -M 4000 -M 4500
49 exit 2
51 isql $DSN <${REL_PATH}/dt1.sql >/dev/null 2>&1
52 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
53 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
54 rm -f $REL_PATH/t1.sql ${REL_PATH}/dt1.sql
55 kill -2 $pid
56 ipcrm -M 4000 -M 4500
57 exit 0;