adding test scripts
[csql.git] / test / cache / CacheTable / test014.ksh
blob494ea6380897e0ff98b46219ae294347ccd18bcd
1 #!/bin/ksh
2 # Test Case
3 #14. Create 't1' table in Target DB with two records,
4 # Load selected records into CSQL with -c "f1=1" option.
5 # Select from t1 in csql should display only one record with f1 value 1
7 # Author : Jitendra Lenka
9 input=${PWD}/cache/CacheTable/inputtest4.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/CacheTable
16 cp $CSQL_CONFIG_FILE /tmp/csql.conf
17 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
19 echo DSN=$DSN >>$CSQL_CONFIG_FILE
20 DS="$DSN $DBUSER $PASSWORD"
21 rm -f /tmp/csql/csqlds.conf
22 touch /tmp/csql/csqlds.conf
23 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
24 if [ $? -ne 0 ]
25 then
26 cp /tmp/csql.conf $CSQL_CONFIG_FILE
27 exit 1;
29 isql $DS < ${REL_PATH}/inputtest4.sql >/dev/null 2>&1
30 if [ $? -ne 0 ]
31 then
32 cp /tmp/csql.conf $CSQL_CONFIG_FILE
33 exit 1;
36 echo Table t1 created with two records in target db.
38 rm -f /tmp/csql/csqltable.conf
39 touch /tmp/csql/csqltable.conf
41 #cache from target to csql with -c option
42 echo "cachetable -t t1 -c \"f1=1\" "
43 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -c "f1=1" >/dev/null 2>&1
44 if [ $? -ne 0 ]
45 then
46 rm -f /tmp/csql/csqltable.conf
47 touch /tmp/csql/csqltable.conf
49 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
50 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
51 cp /tmp/csql.conf $CSQL_CONFIG_FILE
52 exit 2;
55 echo "select * from t1;"
56 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
58 rm -f /tmp/csql/csqltable.conf
59 touch /tmp/csql/csqltable.conf
61 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
62 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
64 cp /tmp/csql.conf $CSQL_CONFIG_FILE
65 exit 0;