*** empty log message ***
[csql.git] / test / sql / ScalarFunction / test026.ksh
blobabc0ab0e413dfc4ccd38dc2967476110bb3b2b5c
1 #!/bin/ksh
2 #Testing TIMESTAMP_SUB function by adding second value
3 # Create table t1(f1 timestamp, f2 timestamp);
4 # insert into t1 values('2001-01-01 01:01:01', '2001-05-05 05:05:01');
5 # insert into t1 values('2002-01-01 01:01:01', '2002-03-05 05:05:01');
6 # insert into t1 values('2003-01-01 01:01:01', '2003-03-05 05:05:01');
7 # insert into t1 values('2004-01-01 01:01:01', '2004-03-05 05:05:01');
8 # insert into t1 values('2005-01-01 01:01:01', '2005-01-05 05:05:01');
9 # select * from t1;
10 # select * from t1 where timestamp_sub(f2 interval 14640 second) ='2003-03-05 01:01:01';
11 # select * from t1 where timestamp_sub(f2 interval 14640 second)<='2003-03-05 01:01:01';
12 # select * from t1 where timestamp_sub(f2 interval 14640 second) >'2003-03-05 01:01:01';
13 # select * from t1 where timestamp_sub(f2 interval 864000 second) ='2003-02-23 05:05:01';
14 # select * from t1 where timestamp_sub(f2 interval 864000 second)>='2003-02-23 05:05:01';
15 # select * from t1 where timestamp_sub(f2 interval 31622400 second) ='2004-01-05 05:05:01';
16 # select * from t1 where timestamp_sub(f2 interval 31622400 second)!='2004-01-05 05:05: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}/timestamp_sub_second.sql
32 else
33 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_sub_second.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;