version 1.0
[csql.git] / test / cache / Bidirectional / test002.ksh
blobdd512591a33cef3aef59f6bd06b1263216c49dbf
1 #!/bin/sh
2 # Test Case
4 # Bi-directional cache test
5 # Cache t1 and t2 table
6 # Set bidirectional flag in csql.conf to true,Create log table in target database
7 #Donot run trigger
8 input=${PWD}/cache/Bidirectional/mysqlcreatelogtable.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Bidirectional
16 rm -f /tmp/csql.conf
17 cp $REL_PATH/csql.conf /tmp
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
21 isql $DSN < $REL_PATH/mysqlcreatelogtable.sql >/dev/null 2>&1
22 if [ $? -ne 0 ]
23 then
24 echo "DSN is not set for target db"
25 exit 1
28 echo Log table created in target DB
30 isql $DSN < $REL_PATH/create.sql >/dev/null 2>&1
31 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
32 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 isql $DSN <$REL_PATH/droptrigger.sql >/dev/null
35 for (( a=1; a<3; a++ ))
37 echo "1:t$a NULL NULL NULL"
38 done >> /tmp/csql/csqltable.conf
40 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
41 pid=$!
42 sleep 5
43 echo "server started"
44 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
45 if [ $? -ne 0 ]
46 then
47 echo "unable to locate cache 1"
48 exit 1
51 isql $DSN < ${REL_PATH}/insert.sql >/dev/null 2>&1
52 sleep 15
53 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
55 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
56 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
57 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
58 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
60 kill -2 $pid
61 ipcrm -M 4000 -M 4500
62 exit 0;