adding test scripts
[csql.git] / test / cache / CacheTable / test023.ksh
blob7e488cf40b60a2f66bd944299228b2d084cc6c76
1 #!/bin/ksh
2 # Test Case
3 #23. create table 't1' with 5 fields in Target DB with records.
4 # Load the table 't1' in field mode in csql without condition.
5 # Example : select f1,f2,f3 from t1 ;
6 # Select * on CSQL should display values for f1,f2 and f3
8 #Author : Jitendra Lenka
9 input=${PWD}/cache/CacheTable/csql.conf
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/CacheTable
15 rm -f /tmp/csql.conf
16 cp $REL_PATH/csql.conf /tmp
17 export CSQL_CONFIG_FILE=/tmp/csql.conf
18 echo DSN=$DSN >>$CSQL_CONFIG_FILE
19 DS="$DSN $DBUSER $PASSWORD"
20 rm -f /tmp/csql/csqlds.conf
21 touch /tmp/csql/csqlds.conf
22 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
23 if [ $? -ne 0 ]
24 then
25 exit 1;
28 isql $DS < ${REL_PATH}/fmodeinsert.sql >/dev/null 2>&1
29 if [ $? -ne 0 ]
30 then
31 exit 1;
34 echo Table t1 created with 5 records in target DB.
36 rm -f /tmp/csql/csqltable.conf
37 touch /tmp/csql/csqltable.conf
39 # cache from target to csql with -f option.
40 echo "cachetable -t t1 -f \"f1,f2,f3\" "
41 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
42 pid=$!
43 sleep 5
45 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -f "f1,f2,f3"
46 if [ $? -ne 0 ]
47 then
48 rm -f /tmp/csql/csqltable.conf
49 touch /tmp/csql/csqltable.conf
50 kill -9 $pid
51 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
52 exit 2;
55 echo "select * from t1;"
57 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/selectt1.sql
58 rm -f /tmp/csql/csqltable.conf
59 touch /tmp/csql/csqltable.conf
61 isql $DS < ${REL_PATH}/drop.sql >/dev/null 2>&1
62 kill -9 $pid
63 ipcrm -M 4000 -M 4500
65 exit 0;