3 # Create 't1' table with f1 int, f2 char(10) ,primarykey(f1)
4 # Insert some records with null values
5 # Cache t1 from target to csql.
6 # Select from CSQL cache node .It should give actual data as in target database
7 # it should be unloaded by -u option
9 input
=${PWD}/cache
/CacheTable
/inputtest4.sql
13 REL_PATH
=${PWD}/cache
/CacheTable
16 if [ "$DSN" = "sybase" ]
18 echo "create table t1 (f1 int,f2 char(10) NULL,primary key(f1));" >${REL_PATH}/t1create.sql
19 elif [ "$DSN" = "db2" ]
21 echo "create table t1 (f1 int NOT NULL,f2 char(10),primary key(f1));" >${REL_PATH}/t1create.sql
23 echo "create table t1 (f1 int,f2 char(10) ,primary key(f1));" >${REL_PATH}/t1create.sql
29 echo "insert into t1 values($a,'INDIA$a');"
30 echo "insert into t1 values($a+10 , NULL);"
31 done>>${REL_PATH}/t1create.sql
32 echo "t1create.sql file created"
33 echo "select * from t1;">${REL_PATH}/sel.sql
34 echo "select file created"
36 cp $CSQL_CONFIG_FILE /tmp
37 export CSQL_CONFIG_FILE
=/tmp
/csql.conf
38 echo CACHE_TABLE
=true
>>$CSQL_CONFIG_FILE
39 echo DSN
=$DSN >>$CSQL_CONFIG_FILE
40 DS
="$DSN $DBUSER $PASSWORD"
41 rm -f /tmp
/csql
/csqlds.conf
42 touch /tmp
/csql
/csqlds.conf
43 $CSQL_INSTALL_ROOT/bin
/csqlds
-U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
49 isql
$DS < ${REL_PATH}/t1create.sql
>/dev
/null
2>&1
52 rm -f ${REL_PATH}/sel.sql
53 rm -f ${REL_PATH}/t1create.sql
57 rm -f /tmp
/csql
/csqltable.conf
58 touch /tmp
/csql
/csqltable.conf
60 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t1
>/dev
/null
2>&1
63 rm -f ${REL_PATH}/sel.sql
64 rm -f ${REL_PATH}/t1create.sql
67 echo "Select * from t1 in CSQL"
68 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/sel.sql
71 rm -f ${REL_PATH}/sel.sql
72 rm -f ${REL_PATH}/t1create.sql
76 echo "Checking for table created or not"
77 $CSQL_INSTALL_ROOT/bin
/catalog
-u root
-p manager
-l
80 rm -f ${REL_PATH}/sel.sql
81 rm -f ${REL_PATH}/t1create.sql
85 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t1
-u >/dev
/null
2>&1
88 rm -f ${REL_PATH}/sel.sql
89 rm -f ${REL_PATH}/t1create.sql
92 echo "cache table 't1' unloaded by -u option"
93 echo "drop table t1;">${REL_PATH}/dp.sql
94 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/dp.sql
>/dev
/null
2>&1
95 rm -f /tmp
/csql
/csqltable.conf
96 touch /tmp
/csql
/csqltable.conf
97 isql
$DS < ${REL_PATH}/dp.sql
>/dev
/null
2>&1
98 rm -f ${REL_PATH}/dp.sql
99 rm -f ${REL_PATH}/sel.sql
100 rm -f ${REL_PATH}/t1create.sql