adding DSN to csql.conf based on the cache test mode
[csql.git] / test / cache / CacheTable / test019.ksh
blob2760104c50b33853ef5e72adfc8efcccb78b8a17
1 #!/bin/sh
2 #Test Case
4 #19. create t1 table with some records in target DB,
5 # cache it with -c option.
6 # Again add some more record into t1 which is in target DB.
7 # now cache it with -r option
8 # it will reload the table t1 in CSQL with latest record.
10 #Run this test only under csql/test or on this directory.
11 #otherwise, it may fail.
13 # AUTHOR : Jitendra Lenka
14 input=${PWD}/cache/CacheTable/inputtest4.sql
15 REL_PATH=.
16 if [ -s "$input" ]
17 then
18 REL_PATH=${PWD}/cache/CacheTable
21 cp $CSQL_CONFIG_FILE /tmp/csql.conf
22 echo DSN=$DSN >>$CSQL_CONFIG_FILE
23 isql $DSN < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
24 if [ $? -ne 0 ]
25 then
26 cp /tmp/csql.conf $CSQL_CONFIG_FILE
27 exit 1;
30 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
31 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
33 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -c "f1=1" >/dev/null 2>&1
34 if [ $? -ne 0 ]
35 then
36 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
37 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
39 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
40 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
41 cp /tmp/csql.conf $CSQL_CONFIG_FILE
42 exit 2;
45 echo after cahe with -c option
46 echo "select * from t1"
48 #select from t1 table
49 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
50 if [ $? -ne 0 ]
51 then
52 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
53 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
55 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
56 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
57 cp /tmp/csql.conf $CSQL_CONFIG_FILE
58 exit 3;
62 isql $DSN < ${REL_PATH}/insert.sql >/dev/null 2>&1
64 # again reload table with -r option.
65 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -r >/dev/null 2>&1
66 if [ $? -ne 0 ]
67 then
68 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
69 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
71 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
72 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
73 cp /tmp/csql.conf $CSQL_CONFIG_FILE
74 exit 4;
77 #after reload, select from t1
78 echo "after reload , select * from t1;"
79 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
80 if [ $? -ne 0 ]
81 then
82 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
83 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
85 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
86 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
87 cp /tmp/csql.conf $CSQL_CONFIG_FILE
88 exit 5;
91 rm -f /tmp/csql/csqltable.conf /tmp/csql/csql.db
92 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
93 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
94 isql $DSN < ${REL_PATH}/drop.sql >/dev/null 2>&1
95 cp /tmp/csql.conf $CSQL_CONFIG_FILE
96 exit 0;