version 1.0
[csql.git] / test / cache / Bidirectional / test006.ksh
blob00cb785d202e0e5c7710a0b39d88b13ac9ea3f61
1 #!/bin/sh
2 # Test Case
4 # Bi-directional cache test
5 # Cache t1 and t2 table with primary key field
6 # Set bidirectional flag in csql.conf to true,Create log table from target db .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/trigger.sql >/dev/null
34 isql $DSN <$REL_PATH/trigger1.sql >/dev/null
37 for (( a=1; a<3; a++ ))
39 echo "1:t$a NULL NULL NULL"
40 done >> /tmp/csql/csqltable.conf
42 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
43 pid=$!
44 sleep 5
45 echo "server started"
46 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
47 if [ $? -ne 0 ]
48 then
49 echo "unable to locate cache 1"
50 exit 1
52 echo "Update some record in target database"
53 isql $DSN < ${REL_PATH}/update.sql >/dev/null 2>&1
54 sleep 15
55 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql
57 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
58 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
59 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
60 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
61 isql $DSN < $REL_PATH/mysqldeletelogtable.sql >/dev/null 2>&1
62 kill -2 $pid
63 ipcrm -M 4000 -M 4500
64 exit 0;