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');
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
20 if [ -s "$CREATEFILE" ]
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" ]
31 valgrind
--tool=memcheck
--leak-check=full
$CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/time_add_hour.sql
33 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/time_add_hour.sql
36 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/dropt1.sql
37 rm -f ${REL_PATH}/dropt1.sql
42 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/dropt1.sql
48 rm -f ${REL_PATH}/dropt1.sql