*** empty log message ***
[csql.git] / test / cache / CacheTable / test027.ksh
blobfaa276442fd485ccdf814637cf6038679daa46e8
1 #!/bin/sh
2 #Test case 27.
3 # create t1 table with some records in target DB.
4 # cache it with -c and -f option
5 # again add some more records into t1 in target db.
6 # now cache it with -r option
7 # it will reload the table t1 in csql with latest records.
9 #Run this test only under csql/test or on this directory.
10 #otherwise, it may fail.
11 # AUTHOR : Jitendra Lenka
13 input=${PWD}/cache/CacheTable/
14 REL_PATH=.
15 if [ -s "$input" ]
16 then
17 REL_PATH=${PWD}/cache/CacheTable
20 isql myodbc3 < ${REL_PATH}/fmodeinsert.sql >/dev/null 2>&1
21 if [ $? -ne 0 ]
22 then
23 exit 1;
26 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
27 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
29 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -c "f1=1" -f "f1,f3,f5" >/dev/null 2>&1
30 if [ $? -ne 0 ]
31 then
32 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
35 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
36 isql myodbc3 < ${REL_PATH}/drop.sql >/dev/null 2>&1
37 exit 2;
40 isql myodbc3 < ${REL_PATH}/frecords.sql >/dev/null 2>&1
42 # again reload table with -r option.
43 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -r >/dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
47 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
49 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
50 isql myodbc3 < ${REL_PATH}/drop.sql >/dev/null 2>&1
51 exit 3;
54 #after reload, select from t1
55 echo "after reload , select * from t1;"
56 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
57 if [ $? -ne 0 ]
58 then
59 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
60 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
62 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
63 isql myodbc3 < ${REL_PATH}/drop.sql >/dev/null 2>&1
64 exit 5;
67 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
68 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
69 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
70 isql myodbc3 < ${REL_PATH}/drop.sql >/dev/null 2>&1
71 exit 0;