*** empty log message ***
[csql.git] / test / cache / Recovery / test004.ksh
blob280256c91dc1bf30add2cc0be35d83034c704bbe
1 #!/bin/ksh
3 # 4. Create table t1(f1 int, f2 int, primary key (f1)); in mysql
4 # insert into t1 values(1, 11);
5 # Cache the table in CSQL.
6 # Insert the same tuple in csql.
7 # It should fail with unique key violation.
9 #Run this test only under csql/test or on this directory.
10 #Otherwise, it may fail
11 CSQL_CONF=${PWD}/cache/Recovery/csql.conf
12 input=${PWD}/cache/Recovery/createt1.sql
13 REL_PATH=.
14 if [ -s "$input" -a -s "$CSQL_CONF" ]
15 then
16 REL_PATH=${PWD}/cache/Recovery
19 rm -f /tmp/csql.conf
20 cp $REL_PATH/csql.conf /tmp
21 export CSQL_CONFIG_FILE=/tmp/csql.conf
23 echo DSN=$DSN >>$CSQL_CONFIG_FILE
24 DS="$DSN $DBUSER $PASSWORD"
25 rm -f /tmp/csql/csqlds.conf
26 touch /tmp/csql/csqlds.conf
27 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
28 if [ $? -ne 0 ]
29 then
30 exit 1;
34 if [ $DSN = "oracle" ]
35 then
36 isql $DS < $REL_PATH/createt1.oracle > /dev/null 2>&1
37 if [ $? -ne 0 ]
38 then
39 rm -f /tmp/csql/csqlds.conf
40 touch /tmp/csql/csqlds.conf
41 exit 2;
43 else
44 isql $DS < $REL_PATH/createt1.sql > /dev/null 2>&1
45 if [ $? -ne 0 ]
46 then
47 rm -f /tmp/csql/csqlds.conf
48 touch /tmp/csql/csqlds.conf
49 exit 2;
53 if [ $? -ne 0 ]
54 then
55 exit 1;
58 # edit /tmp/csql/csqltable.conf
59 rm -f /tmp/csql/csqltable.conf
60 touch /tmp/csql/csqltable.conf
61 echo "1 t1 NULL NULL NULL $DSN" >> /tmp/csql/csqltable.conf
63 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
64 pid=$!
65 sleep 5
67 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert.sql >/dev/null 2>&1
69 rm -f /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
70 touch /tmp/csql/csqltable.conf /tmp/csql/csqlds.conf
72 $CSQL_INSTALL_ROOT/bin/csqldump
73 if [ $? -ne 0 ]
74 then
75 exit 5;
78 kill -9 $pid > /dev/null 2>&1
80 isql $DS < $REL_PATH/drop.sql > /dev/null 2>&1
81 ipcrm -M 1199 -M 2277
82 rm -f /tmp/csql/csqltable.conf
83 touch /tmp/csql/csqltable.conf
84 exit 0;