adding test scripts
[csql.git] / test / sql / ScalarFunction / test035.ksh
blobc638e69267423923865b870e243c242c86c0e816
1 #!/bin/ksh
2 #Testing extract day from date
3 # Create table t1(f1 date, f2 date);
4 # insert into t1 values('2001-01-01', '2001-01-01');
5 # insert into t1 values('2002-01-01', '2001-02-01');
6 # insert into t1 values('2003-01-03', '2002-03-02');
7 # insert into t1 values('2004-01-01', '2002-04-02');
8 # insert into t1 values('2005-01-01', '2003-05-03');
9 # select * from t1;
10 # select * from t1 where extract(day from f2) = 02;
11 # select * from t1 where extract(day from f2) < 02;
12 # select * from t1 where extract(day from f2)<= 02;
13 # select * from t1 where extract(day from f2) > 02;
14 # select * from t1 where extract(day from f2)>= 02;
15 # select * from t1 where extract(day from f2)!= 02;
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_day_from_date.sql
31 else
32 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/extract_day_from_date.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;