code reorg
[csql.git] / test / sql / ScalarFunction / test031.ksh
blob7e8224c09f7b6831125d9500d087f56a655c539b
1 #!/bin/ksh
2 #Testing TIMESTAMP_DIFF function using minute
3 # Create table t1(f1 timestamp, f2 timestamp);
4 # insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:01:01');
5 # insert into t1 values('2002-01-01 01:01:01', '2002-01-01 01:10:01');
6 # insert into t1 values('2002-01-01 01:01:01', '2002-01-01 05:10:01');
7 # insert into t1 values('2002-01-01 01:01:01', '2002-02-03 05:05:01');
8 # insert into t1 values('2002-01-01 01:01:01', '2002-03-01 05:05:01');
9 # insert into t1 values('2004-01-01 01:01:01', '2004-02-01 05:05:01');
10 # insert into t1 values('2004-01-01 01:01:01', '2004-03-01 05:05:01');
11 # insert into t1 values('2002-01-01 01:01:01', '2004-03-01 05:05:01');
12 # select * from t1;
13 # select * from t1 where timestamp_diff(minute,f1,f2) =0;
14 # select * from t1 where timestamp_diff(minute,f2,f1) =9;
15 # select * from t1 where timestamp_diff(minute,f2,f1)<=249;
16 # select * from t1 where timestamp_diff(minute,f2,f1) =85204;
17 # select * from t1 where timestamp_diff(minute,f2,f1)>=85204;
18 # select * from t1 where timestamp_diff(minute,f2,f1) =44884;
19 # select * from t1 where timestamp_diff(minute,f2,f1) =86644;
20 # select * from t1 where timestamp_diff(minute,f2,f1)!=86644;
21 # select * from t1 where timestamp_diff(minute,f2,f1) =1137844;
22 # select * from t1 where timestamp_diff(minute,f2,f1)!=1137844;
24 CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf
25 REL_PATH=.
26 if [ -s "$CREATEFILE" ]
27 then
28 REL_PATH=`pwd`/sql/ScalarFunction
31 echo "drop table t1;" >${REL_PATH}/dropt1.sql
33 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1
35 if [ "$VALGRIND" = "true" ]
36 then
37 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_minute.sql
38 else
39 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/timestamp_diff_minute.sql
40 if [ $? -ne 0 ]
41 then
42 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
43 rm -f ${REL_PATH}/dropt1.sql
44 exit 1;
48 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
49 if [ $? -ne 0 ]
50 then
51 exit 2;
54 rm -f ${REL_PATH}/dropt1.sql
55 exit 0;