*** empty log message ***
[csql.git] / test / cache / CacheTable / test012.ksh
blobb40c500eed6e58633d9673d6811965724ab837d4
1 #!/bin/sh
2 # Test Case
4 # 9.create table t1 (f1 int, f2 int) in mysql and
5 # create table t1 (f1 int, f2 int, f3 int) in csql.
6 # load with no definition option. should fail.
8 #Run this test only under csql/test or on this directory.
9 #Otherwise, it may fail
11 input=${PWD}/cache/CacheTable/create.sql
12 REL_PATH=.
13 if [ -s "$input" ]
14 then
15 REL_PATH=${PWD}/cache/CacheTable
18 cp $CSQL_CONFIG_FILE /tmp/csql.conf
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
20 isql $DSN < ${REL_PATH}/create.sql >/dev/null 2>&1
21 echo table t1 and t2 are created with records in target db
23 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
24 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
26 # write to the csqltable.conf file
27 echo "1:t1 NULL NULL NULL" > /tmp/csql/csqltable.conf
28 echo "2:t2 NULL t2f1>5 NULL" >> /tmp/csql/csqltable.conf
30 $CSQL_INSTALL_ROOT/bin/cachetable -R
31 if [ $? -ne 0 ]
32 then
33 cp /tmp/csql.conf $CSQL_CONFIG_FILE
34 exit 1;
37 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectstar.sql
39 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/deletefromt1csql.sql
40 isql $DSN < $REL_PATH/deletefromt2mysql.sql
42 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -r
43 if [ $? -ne 0 ]
44 then
45 cp /tmp/csql.conf $CSQL_CONFIG_FILE
46 exit 2;
48 echo table t1 reloaded
49 $CSQL_INSTALL_ROOT/bin/cachetable -t t2 -r
50 if [ $? -ne 0 ]
51 then
52 cp /tmp/csql.conf $CSQL_CONFIG_FILE
53 exit 3;
55 echo table t2 reloaded
57 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectstar.sql
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}/dropall.sql >/dev/null 2>&1
62 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/dropall.sql > /dev/null 2>&1
63 cp /tmp/csql.conf $CSQL_CONFIG_FILE
64 exit 0;