adding test scripts
[csql.git] / test / cache / CacheTable / test025.ksh
blob9e272030405b5e5db5ca2eb721fa47050b24d8dd
1 #!/bin/ksh
2 #Test case 25.
3 # Create table t1 in target database.
4 # load t1 table with condition and field mode option.
5 # unload the t1 table with -u option.
7 #AUTHOR : Jitendra Lenka
9 input=${PWD}/cache/CacheTable/inputtest4.sql
10 REL_PATH=.
12 if [ -s "$input" ]
13 then
14 REL_PATH=${PWD}/cache/CacheTable
16 rm -f /tmp/csql.conf
17 cp $CSQL_CONFIG_FILE /tmp
18 export CSQL_CONFIG_FILE=/tmp/csql.conf
20 # create table t1 in target DB.
21 echo CACHE_TABLE=true >>$CSQL_CONFIG_FILE
22 echo DSN=$DSN >>$CSQL_CONFIG_FILE
23 DS="$DSN $DBUSER $PASSWORD"
24 rm -f /tmp/csql/csqlds.conf
25 touch /tmp/csql/csqlds.conf
26 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
27 if [ $? -ne 0 ]
28 then
29 exit 1;
32 isql $DS < ${REL_PATH}/fmodeinsert.sql >/dev/null 2>&1
33 if [ $? -ne 0 ]
34 then
35 exit 1;
38 echo Table t1 created in target DB.
40 rm -f /tmp/csql/csqltable.conf
41 touch /tmp/csql/csqltable.conf
43 echo "cachetable -t t1 -c \"f1<3\" -f \"f1,f3,f5\""
44 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -c "f1<3" -f "f1,f3,f5" >/dev/null 2>&1
45 if [ $? -ne 0 ]
46 then
47 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
48 rm -f /tmp/csql/csqltable.conf
50 exit 2;
53 echo "select from t1 table"
55 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
56 if [ $? -ne 0 ]
57 then
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 exit 4;
68 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u >/dev/null 2>&1
69 if [ $? -ne 0 ]
70 then
71 rm -f /tmp/csql/csqltable.conf
72 touch /tmp/csql/csqltable.conf
74 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/drop.sql >/dev/null 2>&1
75 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
77 exit 4;
80 echo "Table t1 unloaded from CSQL"
83 rm -f /tmp/csql/csqltable.conf
84 touch /tmp/csql/csqltable.conf
86 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/drop.sql > /dev/null 2>&1
87 isql $DS <${REL_PATH}/drop.sql >/dev/null 2>&1
88 exit 0;