separating database engine and cache tests
[csql.git] / test / cache / Recovery / test004.ksh
blobd4c0a969d6343450dc0c961cde58b5d084056ed4
1 #!/bin/sh
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
18 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
20 isql $DSN < $REL_PATH/createt1.sql > /dev/null 2>&1
22 if [ $? -ne 0 ]
23 then
24 exit 1;
27 # edit /tmp/csql/csqltable.conf
28 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
29 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
30 for (( a=1; a<2; a++ ))
32 echo "1:t$a NULL"
33 done >> /tmp/csql/csqltable.conf
35 $CSQL_INSTALL_ROOT/bin/csqlserver -c >/dev/null 2>&1 &
36 pid=$!
37 sleep 5
39 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/insert.sql >/dev/null 2>&1
41 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
42 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
44 $CSQL_INSTALL_ROOT/bin/csqldump
46 if [ $? -ne 0 ]
47 then
48 exit 5;
51 kill $pid > /dev/null 2>&1
53 isql $DSN < $REL_PATH/drop.sql > /dev/null 2>&1
55 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
56 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
57 exit 0;