core reorg
[csql.git] / test / sqlgw / Select / test004.ksh
bloba609606f59497f7dee1ae4f3d71a69917bd2bf12
1 #!/bin/ksh
3 CSQL_CONF=${PWD}/sqlgw/Select/csql.conf
4 REL_PATH=.
5 if [ -s "$CSQL_CONF" ]
6 then
7 REL_PATH=${PWD}/sqlgw/Select
8 fi
9 rm -f /tmp/csql.conf
10 cp $REL_PATH/csql.conf /tmp/csql.conf
12 export CSQL_CONFIG_FILE=/tmp/csql.conf
13 echo DSN=$DSN >>$CSQL_CONFIG_FILE
14 DS="$DSN $DBUSER $PASSWORD"
16 rm -f /tmp/csql/csqlds.conf
17 touch /tmp/csql/csqlds.conf
18 rm -f /tmp/csql/csqltable.conf
19 touch /tmp/csql/csqltable.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 if [ $DSN = "psql" ]
29 then
30 echo "CREATE TABLE t1(f1 INT,f2 CHAR(20));" > create.sql
31 elif [ $DSN = "oracle" ]
32 then
33 echo "CREATE TABLE t1(f1 INT,f2 CHAR(20));" > create.sql
34 elif [ $DSN = "db2" ]
35 then
36 echo "CREATE TABLE t1(f1 INT,f2 CHAR(20))" > create.sql
37 else
38 echo "CREATE TABLE t1(f1 INT,f2 CHAR(20));" > create.sql
41 isql $DS < create.sql >/dev/null 2>&1
43 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
44 pid=$!
45 sleep 5
47 echo "drop table t1;" > drop.sql
49 $CSQL_INSTALL_ROOT/bin/cachetable -t t1
50 if [ $? -ne 0 ]
51 then
52 isql $DS < drop.sql >/dev/null 2>&1
53 kill -9 $pid
54 ipcrm -M 4567 -M 5678 -M 1950
55 rm -f create.sql drop.sql
56 exit 1;
59 if [ $VALGRIND = "true" ]
60 then
61 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/selecttest4 2> $0.valgr
62 else
63 ${REL_PATH}/selecttest4
64 if [ $? -ne 0 ]
65 then
66 isql $DS < drop.sql >/dev/null 2>&1
67 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u
68 kill -9 $pid
69 ipcrm -M 4567 -M 5678 -M 1950
70 rm -f create.sql drop.sql
71 exit 2;
75 isql $DS < drop.sql >/dev/null 2>&1
76 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u
77 kill -9 $pid
78 ipcrm -M 4567 -M 5678 -M 1950
79 rm -f /tmp/csql.conf
80 rm -f create.sql drop.sql
81 exit 0;