modified to accept hostname and connect to the network
[csql.git] / test / cache / Gateway / test013.ksh
blobeeefe6fe158f43ce90b9e1b7a121ffcdc448d83b
1 #!/bin/sh
3 # Create 't1' table with f1 int, f2 char(10) ,primarykey(f1) in target database
4 # Insert some records with null values
5 # Select from CSQL with -g .It should give actual data as in target database
6 # it should be unloaded by -u option
8 input=${PWD}/cache/Gateway/complex.sql
9 REL_PATH=.
10 if [ -s "$input" ]
11 then
12 REL_PATH=${PWD}/cache/Gateway
15 echo "create table t1 (f1 int,f2 char(10),primary key(f1));" >${REL_PATH}/t1create.sql
17 for((a=1;a<=5;a++))
19 echo "insert into t1 values($a,'INDIA$a');"
20 echo "insert into t1 values($a+10 , NULL);"
21 done>>${REL_PATH}/t1create.sql
22 echo "t1create.sql file created"
23 echo "select * from t1;">${REL_PATH}/sel.sql
24 echo "select file created"
25 isql $DSN < ${REL_PATH}/t1create.sql >/dev/null 2>&1
26 if [ $? -ne 0 ]
27 then
28 rm -f ${REL_PATH}/sel.sql
29 rm -f ${REL_PATH}/t1create.sql
30 exit 1;
32 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
33 rm -f /tmp/csql/csqltable.conf /tmp/csql.db
34 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
35 echo "drop table t1;">${REL_PATH}/dp.sql
36 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
37 pid=$!
38 sleep 5
40 echo "Select * from t1 in CSQL"
41 $CSQL_INSTALL_ROOT/bin/csql -g -s ${REL_PATH}/sel.sql
42 if [ $? -ne 0 ]
43 then
44 rm -f ${REL_PATH}/sel.sql
45 rm -f ${REL_PATH}/t1create.sql
46 isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1
47 exit 3;
50 echo "Checking for table created or not"
51 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l
52 if [ $? -ne 0 ]
53 then
54 rm -f ${REL_PATH}/sel.sql
55 rm -f ${REL_PATH}/t1create.sql
56 isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1
57 exit 3;
60 rm -f /tmp/csql/csqltable.conf /tmp/csql.db
61 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
62 isql $DSN < ${REL_PATH}/dp.sql >/dev/null 2>&1
64 rm -f ${REL_PATH}/dp.sql
65 rm -f ${REL_PATH}/sel.sql
66 rm -f ${REL_PATH}/t1create.sql
67 kill -9 $pid
68 ipcrm -M 1199 -M 2277
69 exit 0;