version 1.0
[csql.git] / test / cache / Bidirectional / test003.ksh
blobf0f521e6e9e9f45284ffc39c7fcf8e205cab1160
1 #!/bin/sh
2 # Test Case
4 # Bi-directional cache test
5 # Create two table t1,t1 that has no primary key
6 # Set bidirectional flag in csql.conf to true,Create log table in the cache and 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 /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/create1.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
36 for (( a=1; a<3; a++ ))
38 echo "1:t$a NULL NULL NULL"
39 done >> /tmp/csql/csqltable.conf
41 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
42 pid=$!
43 sleep 5
44 echo "server started"
45 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/select.sql >/dev/null 2>&1
46 if [ $? -eq 0 ]
47 then
48 exit 2
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 >/dev/null 2>&1
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;