*** empty log message ***
[csql.git] / test / cache / Gateway / test012bn.ksh
blob45d3aecd938e710545b8e6f63425cd7d718922e8
1 #!/bin/ksh
3 # 12.csqlserver not running
4 # b)connect, update
5 # noncached table in mysql(should work), cached table (work), csql table (fail)
7 #Run this test only under csql/test or on this directory.
8 #Otherwise, it may fail
9 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Gateway
15 rm /tmp/csql.conf
17 cp $REL_PATH/csql.conf /tmp/csql.conf
18 echo CSQL_SQL_SERVER=true >>/tmp/csql.conf
19 echo PORT=6024 >>/tmp/csql.conf
20 export CSQL_CONFIG_FILE=/tmp/csql.conf
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 if [ $DSN = "oracle" ]
33 then
34 isql $DS < $REL_PATH/orainputt1.oracle >/dev/null 2>&1
35 elif [ $DSN = "sybase" ]
36 then
37 isql $DS < $REL_PATH/sybaseinputtest1.sql >/dev/null 2>&1
38 elif [ $DSN = "db2" ]
39 then
40 isql $DS < $REL_PATH/db2inputtest1.sql >/dev/null 2>&1
41 else
42 isql $DS < $REL_PATH/mysqlinputtest1.sql > /dev/null 2>&1
45 if [ $? -ne 0 ]
46 then
47 echo "DSN is not set for target db"
48 exit 1
51 if [ $DSN = "oracle" ]
52 then
53 isql $DS < $REL_PATH/orainputt2.oracle > /dev/null 2>&1
54 else
55 isql $DS < $REL_PATH/mysqlinputtest12.sql > /dev/null 2>&1
57 # edit /tmp/csql/csqltable.conf
58 rm -f /tmp/csql/csqltable.conf
59 touch /tmp/csql/csqltable.conf
61 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
62 pid=$!
63 sleep 5
65 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $DSN
66 if [ $? -ne 0 ]
67 then
68 kill -9 $pid
69 ipcrm -M 1199 -M 2277
70 exit 3;
73 if [ $DSN = "oracle" ]
74 then
75 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/orainputt3.oracle >/dev/null 2>&1
76 else
77 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest12.sql >/dev/null 2>&1
80 kill -9 $pid
81 ipcrm -M 1199 -M 2277
83 if [ $DSN = "oracle" ]
84 then
85 echo "update t2 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdatet2.sql
86 echo "update t1 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdatet1.sql
87 echo "update t3 set f2='LLL' where f1=20;" >> $REL_PATH/oraupdatet3.sql
88 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/oraupdatet2.sql
89 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/oraupdatet1.sql
90 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/oraupdatet3.sql
91 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/selectstart2.sql
92 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/selectstar.sql
93 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/selectstart3.sql
94 else
95 if [ $DSN = "db2" ]
96 then
97 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/db2updatet2.sql
98 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/db2update.sql
99 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/db2updatet3.sql
100 else
101 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/updatet2.sql
102 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/update.sql
103 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/updatet3.sql
105 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/selectstart2.sql
106 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/selectstar.sql
107 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6024 -g -s $REL_PATH/selectstart3.sql
110 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
112 rm -f /tmp/csql/csqltable.conf
113 rm -f $REL_PATH/ora*.sql
114 touch /tmp/csql/csqltable.conf
115 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
116 exit 0;