2 #create table t1 with f1 int and f2 char(20). insert 10 different record.
3 # a. create a copy of table t1 [ create table ct1 as select * from t1]
4 # b. create a conditional copy of table t1 [create table ct2 as select * from t1 where f1 < conditon]
5 # c. create a copy of table t1 [create table ct3 as select f2 from t1]
6 # d. create a copy of table t1 [create table ct4 as select f2 from t1 where f1 < conditon ]
9 QUITFILE
=${PWD}/tools
/copystmt
/quit.sql
13 REL_PATH
=`pwd`/tools
/copystmt
16 echo "echo create table t1(f1 int,f2 char(20));" >${REL_PATH}/create_t1.sql
17 echo "create table t1(f1 int,f2 char(20));" >>${REL_PATH}/create_t1.sql
21 echo "insert into t1 values($i,'CSQL$i');" >>${REL_PATH}/create_t1.sql
25 echo "echo create table ct1 as select * from t1;" >${REL_PATH}/create_ct1.sql
26 echo "create table ct1 as select * from t1;" >>${REL_PATH}/create_ct1.sql
28 echo "echo create table ct2 as select * from t1 where f1 < 6;" >${REL_PATH}/create_ct2.sql
29 echo "create table ct2 as select * from t1 where f1 < 6;" >>${REL_PATH}/create_ct2.sql
31 echo "echo create table ct3 as select f2 from t1;" >${REL_PATH}/create_ct3.sql
32 echo "create table ct3 as select f2 from t1;" >>${REL_PATH}/create_ct3.sql
34 echo "echo create table ct4 as select f2 from t1 where f1 >3 and f1 <8;" >${REL_PATH}/create_ct4.sql
35 echo "create table ct4 as select f2 from t1 where f1 >3 and f1 <8;" >>${REL_PATH}/create_ct4.sql
37 echo "Drop table t1;" >${REL_PATH}/drop.sql
38 echo "Drop table ct1;">>${REL_PATH}/drop.sql
39 echo "Drop table ct2;">>${REL_PATH}/drop.sql
40 echo "Drop table ct3;">>${REL_PATH}/drop.sql
41 echo "Drop table ct4;">>${REL_PATH}/drop.sql
43 if [ "$VALGRIND" = "true" ]
45 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_t1.sql
2> $0.valgr
47 $CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_t1.sql
51 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql
56 if [ "$VALGRIND" = "true" ]
58 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct1.sql
2>> $0.valgr
60 $CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct1.sql
64 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql
69 if [ "$VALGRIND" = "true" ]
71 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct2.sql
2>> $0.valgr
73 $CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct2.sql
77 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql
82 if [ "$VALGRIND" = "true" ]
84 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct3.sql
2>> $0.valgr
86 $CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct3.sql
90 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql
95 if [ "$VALGRIND" = "true" ]
97 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct4.sql
2>> $0.valgr
99 $CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/create_ct4.sql
103 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql
108 if [ "$VALGRIND" = "true" ]
110 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csqldump
2>> $0.valgr
112 $CSQL_INSTALL_ROOT/bin
/csqldump
116 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql
121 $CSQL_INSTALL_ROOT/bin
/csql
-u root
-p manager
-s ${REL_PATH}/drop.sql
122 rm -f ${REL_PATH}/create_t1.sql ${REL_PATH}/create_ct1.sql.sql ${REL_PATH}/create_ct2.sql ${REL_PATH}/create_ct3.sql ${REL_PATH}/create_ct4.sql ${REL_PATH}/drop.sql