adding test scripts
[csql.git] / test / sql / ScalarFunction / test038.ksh
blob1fb0b6d774aef8eca1cbf604c93799b10cc0b548
1 #!/bin/ksh
2 #Testing extract second 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(second from f2) = 30;
11 # select * from t1 where extract(second from f2) < 30;
12 # select * from t1 where extract(second from f2)<= 30;
13 # select * from t1 where extract(second from f2) > 30;
14 # select * from t1 where extract(second from f2)>= 30;
15 # select * from t1 where extract(second from f2)!= 30;
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_second_from_time.sql
31 else
32 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_second_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;