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
12 REL_PATH
=${PWD}/cache
/Gateway
15 cp $REL_PATH/csql.conf
/tmp
/csql.conf
16 echo CSQL_SQL_SERVER
=true
>>/tmp
/csql.conf
17 echo PORT
=6026 >>/tmp
/csql.conf
18 export CSQL_CONFIG_FILE
=/tmp
/csql.conf
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
27 echo DSN
=$DSN >>$CSQL_CONFIG_FILE
28 if [ $DSN = "sybase" ]
30 echo "create table t1 (f1 int ,f2 char(10) NULL,primary key(f1));" >${REL_PATH}/t1create.sql
33 echo "create table t1 (f1 int NOT NULL ,f2 char(10) ,primary key(f1));" >${REL_PATH}/t1create.sql
35 echo "create table t1 (f1 int,f2 char(10),primary key(f1));" >${REL_PATH}/t1create.sql
40 echo "insert into t1 values($a,'INDIA$a');"
41 echo "insert into t1 values($a+10 , NULL);"
42 done>>${REL_PATH}/t1create.sql
43 echo "t1create.sql file created"
44 echo "select * from t1;">${REL_PATH}/sel.sql
45 echo "select file created"
46 isql
$DS < ${REL_PATH}/t1create.sql
>/dev
/null
2>&1
49 rm -f ${REL_PATH}/sel.sql
50 rm -f ${REL_PATH}/t1create.sql
54 rm -f /tmp
/csql
/csqltable.conf
55 touch /tmp
/csql
/csqltable.conf
56 echo "drop table t1;">${REL_PATH}/dp.sql
58 $CSQL_INSTALL_ROOT/bin
/csqlserver
>/dev
/null
2>&1 &
62 echo "Select * from t1 in CSQL"
63 $CSQL_INSTALL_ROOT/bin
/csql
-H localhost
-P 6026 -g -s ${REL_PATH}/sel.sql
66 rm -f ${REL_PATH}/sel.sql
67 rm -f ${REL_PATH}/t1create.sql
68 isql
$DS < ${REL_PATH}/dp.sql
>/dev
/null
2>&1
72 echo "Checking for table created or not"
73 $CSQL_INSTALL_ROOT/bin
/catalog
-u root
-p manager
-l
76 rm -f ${REL_PATH}/sel.sql
77 rm -f ${REL_PATH}/t1create.sql
78 isql
$DS < ${REL_PATH}/dp.sql
>/dev
/null
2>&1
82 rm -f /tmp
/csql
/csqltable.conf
83 touch /tmp
/csql
/csqltable.conf
84 isql
$DS < ${REL_PATH}/dp.sql
>/dev
/null
2>&1
86 rm -f ${REL_PATH}/dp.sql
87 rm -f ${REL_PATH}/sel.sql
88 rm -f ${REL_PATH}/t1create.sql
91 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`