*** empty log message ***
[csql.git] / test / cache / CacheTable / test031.ksh
bloba3bbf936e6a45517797b71787e21abf621584e17
1 #!/bin/sh
3 # Create 't1' table with f1 int, f2 binary(4) ,primarykey(f1)
4 # Insert some records
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
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/CacheTable
16 echo "create table t1 (f1 int,f2 binary(4),primary key(f1));" >${REL_PATH}/t1create.sql
18 for((a=1;a<=5;a++))
20 echo "insert into t1 values($a,'32eb$a');"
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 myodbc3 < ${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;
33 rm -f /tmp/csql/csqltable.conf /tmp/csql.db
34 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
36 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 >/dev/null 2>&1
37 if [ $? -ne 0 ]
38 then
39 rm -f ${REL_PATH}/sel.sql
40 rm -f ${REL_PATH}/t1create.sql
41 exit 2;
43 echo "Select * from t1 in CSQL"
44 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/sel.sql
45 if [ $? -ne 0 ]
46 then
47 rm -f ${REL_PATH}/sel.sql
48 rm -f ${REL_PATH}/t1create.sql
49 exit 3;
52 echo "Checking for table created or not"
53 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -l
54 if [ $? -ne 0 ]
55 then
56 rm -f ${REL_PATH}/sel.sql
57 rm -f ${REL_PATH}/t1create.sql
58 exit 4;
61 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -u >/dev/null 2>&1
62 if [ $? -ne 0 ]
63 then
64 rm -f ${REL_PATH}/sel.sql
65 rm -f ${REL_PATH}/t1create.sql
66 exit 5;
68 echo "cache table 't1' unloaded by -u option"
69 echo "drop table t1;">${REL_PATH}/dp.sql
70 rm -f /tmp/csql/csqltable.conf /tmp/csql.db
71 touch /tmp/csql/csqltable.conf /tmp/csql/csql.db
72 isql myodbc3 < ${REL_PATH}/dp.sql >/dev/null 2>&1
74 rm -f ${REL_PATH}/dp.sql
75 rm -f ${REL_PATH}/sel.sql
76 rm -f ${REL_PATH}/t1create.sql
77 exit 0;