code reorg
[csql.git] / test / sql / ScalarFunction / test009.ksh
bloba1d339f17bd859bdfa20ca3b82896874ff84ab99
1 #!/bin/ksh
2 #Testing TIME_ADD function by adding hour value
3 # Create table t1(f1 time, f2 time);
4 # insert into t1 values('01:01:01', '01:30:01');
5 # insert into t1 values('02:01:01', '06:30:01');
6 # insert into t1 values('03:01:01', '11:30:01');
7 # insert into t1 values('04:01:01', '16:30:01');
8 # insert into t1 values('05:01:01', '21:30:01');
9 # select * from t1;
10 # select * from t1 where time_add(f2 interval 2 hour) = '13:30:01';
11 # select * from t1 where time_add(f2 interval 2 hour) <= '13:30:01';
12 # select * from t1 where time_add(f2 interval 2 hour) >= '13:30:01';
13 # select * from t1 where time_add(f2 interval 10 hour) = '11:30:01';
14 # select * from t1 where time_add(f2 interval 10 hour) <= '11:30:01';
15 # select * from t1 where time_add(f2 interval 10 hour) >= '11:30:01';
16 # select * from t1 where time_add(f2 interval 10 hour) != '11:30:01';
18 CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf
19 REL_PATH=.
20 if [ -s "$CREATEFILE" ]
21 then
22 REL_PATH=`pwd`/sql/ScalarFunction
25 echo "drop table t1;" >${REL_PATH}/dropt1.sql
27 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1
29 if [ "$VALGRIND" = "true" ]
30 then
31 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_hour.sql
32 else
33 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/time_add_hour.sql
34 if [ $? -ne 0 ]
35 then
36 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
37 rm -f ${REL_PATH}/dropt1.sql
38 exit 1;
42 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
43 if [ $? -ne 0 ]
44 then
45 exit 2;
48 rm -f ${REL_PATH}/dropt1.sql
49 exit 0;