adding test scripts
[csql.git] / test / cache / CacheTable / test009.ksh
blobde0441e1a20bb7e29bac3730358642d8ef515575
1 #!/bin/ksh
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 dropAll() {
12 rm -f /tmp/csql/csqltable.conf
13 touch /tmp/csql/csqltable.conf
14 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
15 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql > /dev/null 2>&1
19 input=${PWD}/cache/CacheTable/inputtest4.sql
20 REL_PATH=.
21 if [ -s "$input" ]
22 then
23 REL_PATH=${PWD}/cache/CacheTable
26 cp $CSQL_CONFIG_FILE /tmp/csql.conf
27 echo DSN=$DSN >>$CSQL_CONFIG_FILE
28 DS="$DSN $DBUSER $PASSWORD"
29 rm -f /tmp/csql/csqlds.conf
30 touch /tmp/csql/csqlds.conf
31 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
32 if [ $? -ne 0 ]
33 then
34 cp /tmp/csql.conf $CSQL_CONFIG_FILE
35 exit 1;
38 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
39 echo "Inserting table t1 with records in targetDB"
40 isql $DS < ${REL_PATH}/inputtest4.sql 2>/dev/null
42 rm -f /tmp/csql/csqltable.conf
43 touch /tmp/csql/csqltable.conf
45 echo "Creating the same table t1 in csql without records"
46 if [ "$DSN" = "oracle" ]
47 then
48 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest9oracle.sql
49 else
50 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest9.sql
52 if [ $? -ne 0 ]
53 then
54 dropAll
55 cp /tmp/csql.conf $CSQL_CONFIG_FILE
56 exit 2;
59 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
60 if [ $? -ne 0 ]
61 then
62 dropAll
63 cp /tmp/csql.conf $CSQL_CONFIG_FILE
64 exit 3;
67 echo "Caching the table with -s (only load records)"
68 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -s
69 if [ $? -ne 0 ]
70 then
71 dropAll
72 cp /tmp/csql.conf $CSQL_CONFIG_FILE
73 exit 4;
76 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
77 if [ $? -ne 0 ]
78 then
79 dropAll
80 cp /tmp/csql.conf $CSQL_CONFIG_FILE
81 exit 5;
84 dropAll
85 cp /tmp/csql.conf $CSQL_CONFIG_FILE
86 exit 0;