core reorg
[csql.git] / test / sql / ScalarFunction / test036.ksh
bloba473e31b119fde05ecf8f0db2734edf1ef89afba
1 #!/bin/ksh
2 #Testing extract hour from time
3 # Create table t1(f1 date, f2 time);
4 # insert into t1 values('2001-01-01', '23:59:59');
5 # insert into t1 values('2002-01-01', '22:58:58');
6 # insert into t1 values('2003-01-03', '12:30:30');
7 # insert into t1 values('2004-01-01', '02:02:02');
8 # insert into t1 values('2005-01-01', '01:01:01');
9 # select * from t1;
10 # select * from t1 where extract(hour from f2) = 12;
11 # select * from t1 where extract(hour from f2) < 12;
12 # select * from t1 where extract(hour from f2)<= 12;
13 # select * from t1 where extract(hour from f2) > 12;
14 # select * from t1 where extract(hour from f2)>= 12;
15 # select * from t1 where extract(hour from f2)!= 12;
17 CREATEFILE=${PWD}/sql/ScalarFunction/csql.conf
18 REL_PATH=.
19 if [ -s "$CREATEFILE" ]
20 then
21 REL_PATH=`pwd`/sql/ScalarFunction
24 echo "drop table t1;" >${REL_PATH}/dropt1.sql
26 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql >/dev/null 2>&1
28 if [ "$VALGRIND" = "true" ]
29 then
30 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_hour_from_time.sql
31 else
32 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_hour_from_time.sql
33 if [ $? -ne 0 ]
34 then
35 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
36 rm -f ${REL_PATH}/dropt1.sql
37 exit 1;
41 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
42 if [ $? -ne 0 ]
43 then
44 exit 2;
47 rm -f ${REL_PATH}/dropt1.sql
48 exit 0;