/*
 * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 * @(#)scalarClient4.java	1.10 02/01/12
 */

package com.sun.cts.tests.jdbc.ee.escapeSyntax.scalar4;

import java.io.*;
import java.util.*;

import java.sql.*;
import javax.sql.*;

import com.sun.cts.util.*;
import com.sun.cts.porting.*;
import com.sun.cts.harness.*;

import java.rmi.RemoteException;

import javasoft.sqe.javatest.Status;
import com.sun.cts.tests.jdbc.ee.common.*;


// Merant DataSource class
//import com.merant.sequelink.jdbcx.datasource.*;


/**
 * The scalarClient4 class tests methods of scalar Functions interface using 
 * Sun's J2EE Reference Implementation.
 * @author  
 * @version 1.7, 06/16/99
 */

public class scalarClient4 extends ServiceEETest  
{		  
	private static final String testName = "jdbc.ee.escapeSyntax";
	
	//Naming specific member variables
	private CTSNamingContextInterface jc = null;

	//Harness requirements 

	private transient Connection conn = null;
	private Statement stmt = null;
	private ResultSet rs = null;
	private	String drManager=null;
	private fnSchema fnSch=null;
	private Properties props=null;

	/* Run test in standalone mode */
	public static void main(String[] args) 
	{
		scalarClient4 theTests = new scalarClient4();
		Status s=theTests.run(args, System.out, System.err);
		s.exit();
	}

	/*  Test setup: */
	
	/*
	 *   @class.setup_props: Driver, the Driver name;
	 *                       db1, the database name with url;
	 *                       user1, the database user name;
	 *                       password1, the database password;
	 *                       db2, the database name with url;
	 *                       user2, the database user name;
	 *                       password2, the database password;
	 *			 DriverManager, flag for DriverManager;
	 *                       ptable, the primary table;
	 *                       ftable, the foreign table;
	 *                       cofSize, the initial size of the ptable;
	 *                       cofTypeSize, the initial size of the ftable;
	 *                       binarySize, size of binary data type;
	 *                       varbinarySize, size of varbinary data type;
	 *                       longvarbinarySize, size of longvarbinary data type;
	 *  @class.testArgs:     -ap ctssql.stmt
	 */
	public void setup(String[] args, Properties p) throws Fault 
	{
		try 
		{
			try
			{
				props=p;
				drManager = p.getProperty("DriverManager","");
				if (drManager.length() == 0)
					throw new Fault("Invalid DriverManager Name");


				if(drManager.equals("yes"))
				{
					logMsg("Using DriverManager");
					DriverManagerConnection dmCon = new DriverManagerConnection();
					conn = dmCon.getConnection(p);
				}
				else 
				{
					logMsg("Using DataSource");
					DataSourceConnection dsCon = new DataSourceConnection();
					conn = dsCon.getConnection(p);
				}
				stmt=conn.createStatement();
				fnSch = new fnSchema();
				fnSch.createTable(p,conn);
				
			}
			catch(SQLException ex)
			{
				logErr("SQL Exception : " + ex.getMessage());
			}
		} 
		catch  ( Exception e ) 
		{
			logErr("Setup Failed!");
		}
	}

	/*
	 * @testName:      testTimestampAdd01
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_FRAC_SECOND.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd01() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd01 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddfrac_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd01 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd01 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd02
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_SECOND.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd02() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd02 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddsecond_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd02 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd02 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd03
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_MINUTE.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd03() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd03 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddminute_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd03 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd03 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd04
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_HOUR.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd04() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd04 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddhour_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd04 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd04 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd05
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_DAY.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd05() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd05 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddday_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd05 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd05 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd06
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_WEEK.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd06() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd06 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddweek_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd06 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd06 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd07
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_MONTH.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd07() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd07 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddmonth_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd07 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd07 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd08
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_QUARTER.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd08() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd08 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddquarter_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd08 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd08 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampAdd09
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPADD(interval,count, tstampval) should return 
	 *                 a timestamp value by adding count number of intervals to timestamp 
	 *                 where interval may be one of the following SQL_TSI_FRAC_SECOND,
	 *                 SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
	 *                 SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR; 
	 *                 if TIMESTAMPADD is supported by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampadd with the
	 *                 interval value as SQL_TSI_YEAR.
	 *                 It should return a timestamp value.
	 *
	 */
	public void testTimestampAdd09() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPADD",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPADD  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPADD is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampAdd09 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampadd
				queryString = props.getProperty("Timestampaddyear_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Timestamp value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampAdd09 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampAdd09 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff01
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_FRAC_SECOND.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff01() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff01 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdifffrac_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff01 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff01 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff02
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_SECOND.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff02() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff02 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffsecond_Fn_Query","");
				
				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff02 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff02 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff03
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_MINUTE.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff03() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff03 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffminute_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff03 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff03 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff04
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_HOUR.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff04() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff04 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffhour_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff04 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff04 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff05
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_DAY.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff05() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff05 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffday_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff05 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff05 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff06
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_WEEK.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff06() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff06 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffweek_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff06 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff06 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff07
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_MONTH.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff07() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff07 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffmonth_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff07 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff07 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff08
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_QUARTER.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff08() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff08 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffquarter_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff08 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff08 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testTimestampDiff09
	 *                 
	 * @assertion:     Scalar Functions may be supported by different DBMSs with 
	 *                 different syntax.  The driver should support the scalar 
	 *                 function if the DBMS supports it.  The driver may either map 
	 *                 the escaped function call into appropriate syntax or implement 
	 *                 the function directly itself. The scalar functions supported by 
	 *                 the DBMS can be found out by calling DatabaseMetaData methods.
	 *                 The DatabaseMetaData methods should return a comma separated 
	 *                 list of the Open Group CLI names of the supported scalar functions. 
	 *                 (See 40.1 & Appendix A.1.4 JDBC 2.0 API Reference & Tutorial).
	 *                 The TIMESTAMPDIFF(interval, tstamp1, tstamp2) should return 
	 *                 a integer value representing the number of intervals by which 
	 *                 tstamp2 is greater than tstamp2, where interval may be one of 
	 *                 following SQL_TSI_FRAC_SECOND, SQL_TSI_SECOND, SQL_TSI_MINUTE,
	 *                 SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, 
	 *                 SQL_TSI_QUARTER, SQL_TSI_YEAR; if TIMESTAMPDIFF is supported 
	 *                 by DBMS.
	 *                 
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a call to the function timestampdiff with 
	 *                 the interval value as SQL_TSI_YEAR.
	 *                 It should return an integer.
	 *
	 */
	public void testTimestampDiff09() throws Fault
	{
		boolean isFuncFound;
		try
		{
			//Check if the function is supported by the DBMS
			if(fnSch.isTimeDateFuncFound("TIMESTAMPDIFF",conn)==true)
			{
				//Function is supported
				isFuncFound=true;
				logMsg("Time Date function TIMESTAMPDIFF  is supported by this DBMS");
			}
			else
			{
				//Function is not supported
				isFuncFound=false;
				logMsg("Time Date function TIMESTAMPDIFF is not supported by this DBMS");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testTimestampDiff09 failed!", e);
		}
		if(isFuncFound==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a call to the function timestampdiff
				queryString = props.getProperty("Timestampdiffyear_Fn_Query","");

				rs=stmt.executeQuery(queryString);
				rs.next();
				String retString = rs.getString(1);
				logMsg("Integer value: " + retString );
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testTimestampDiff09 Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testTimestampDiff09 Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testLeftOuterjoin
	 * @assertion:     Outer joins are an advanced feature (left, right and full
	 *                 outer joins) and are not supported by all DBMS. The 
	 *                 driver should support if the DBMS supports it.  Outer joins
	 *                 supported by the DBMS can be found by using DatabaseMetaData
	 *                 methods. (See 40.1 JDBC 2.0 API Reference & Tutorial)
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a left outer join.                 
	 *                 It should return a ResultSet object.
	 *
	 */
	public void testLeftOuterjoin() throws Fault
	{
		boolean outerJoinSupport;
		try
		{
			//Check if left outer join is supported
			DatabaseMetaData dbmd=conn.getMetaData();
			outerJoinSupport=dbmd.supportsFullOuterJoins();
			if(outerJoinSupport==true)
			{
				//Outer Join is supported
				logMsg("Outer Join is supported");
			}
			else
			{
				//Outer Join is not supported
				logMsg("Outer Join is not supported");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testOuterJoin failed!", e);
		}
		if(outerJoinSupport==true)
		{
			try
			{

				String queryString = null;
				//Query that contains a left outer join
				queryString = props.getProperty("Left_Oj_Query","");

				rs=stmt.executeQuery(queryString);
				logMsg("queryString: " + queryString);
				String retString;
				while(rs.next())
				{
					retString = rs.getString(1);
					logMsg("ResultSet value: " + retString );
				}
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testLeftOuterjoin Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testLeftOuterjoin Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testRightOuterjoin
	 * @assertion:     Outer joins are an advanced feature (left, right and full
	 *                 outer joins) and are not supported by all DBMS. The 
	 *                 driver should support if the DBMS supports it.  Outer joins
	 *                 supported by the DBMS can be found by using DatabaseMetaData
	 *                 methods. (See 40.1 JDBC 2.0 API Reference & Tutorial)
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a right outer join.                 
	 *                 It should return a ResultSet object.
	 *               
	 */
	public void testRightOuterjoin() throws Fault
	{
		boolean outerJoinSupport;
		try
		{
			//Check if right outer join is supported
			DatabaseMetaData dbmd=conn.getMetaData();
			outerJoinSupport=dbmd.supportsFullOuterJoins();
			if(outerJoinSupport==true)
			{
				//Outer Join is supported
				logMsg("Outer Join is supported");
			}
			else
			{
				//Outer Join is not supported
				logMsg("Outer Join is not supported");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testRightOuterjoin failed!", e);
		}
		if(outerJoinSupport==true)
		{
			try
			{

				String queryString = null;
				//Query that contains a right outer join
				queryString = props.getProperty("Right_Oj_Query","");

				rs=stmt.executeQuery(queryString);
				logMsg("queryString: " + queryString);
				String retString;
				while(rs.next())
				{
					retString = rs.getString(1);
					logMsg("ResultSet value: " + retString );
				}
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testRightOuterjoin Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testRightOuterjoin Failed!", e);
			}
		}
	}

	/*
	 * @testName:      testFullOuterjoin
	 * @assertion:     Outer joins are an advanced feature (left, right and full
	 *                 outer joins) and are not supported by all DBMS. The 
	 *                 driver should support if the DBMS supports it.  Outer joins
	 *                 supported by the DBMS can be found by using DatabaseMetaData
	 *                 methods. (See 40.1 JDBC 2.0 API Reference & Tutorial)
	 * @test_Strategy: Get a Statement object and call the method executeQuery.
	 *                 The query contains a full outer join.                 
	 *                 It should return a ResultSet object.
	 *
	 */
	public void testFullOuterjoin() throws Fault
	{
		boolean fullOuterJoinSupport;
		try
		{
			//Check if full outer join is supported
			DatabaseMetaData dbmd=conn.getMetaData();
			fullOuterJoinSupport=dbmd.supportsFullOuterJoins();
			if(fullOuterJoinSupport==true)
			{
				//Full Outer Join is supported
				logMsg("Full Outer Join is supported");
			}
			else
			{
				//Full Outer Join is not supported
				logMsg("Full Outer Join is not supported");
			}
		}
		catch(Exception e)
		{
			logErr("Unexpected Exception: " + e.getMessage());
			throw new Fault("Call to testFullOuterjoin failed!", e);
		}
		if(fullOuterJoinSupport==true)
		{
			try
			{
				String queryString = null;
				//Query that contains a full outer join
				queryString = props.getProperty("Full_Oj_Query","");

				rs=stmt.executeQuery(queryString);
				logMsg("queryString: " + queryString);
				String retString;
				while(rs.next())
				{
					retString = rs.getString(1);
					logMsg("ResultSet value: " + retString );
				}
				rs.close();    
    
			}
			catch(SQLException sqle)
			{
				logErr("SQLException: " + sqle.getMessage());
				throw new Fault("Call to testFullOuterjoin Failed!", sqle);
			}
			catch(Exception e)
			{
				logErr("Unexpected Exception: " + e.getMessage());
				throw new Fault("Call to testFullOuterjoin Failed!", e);
			}
		}
	}

	/* cleanup */
	public void cleanup() throws Fault
	{
		try
		{
			stmt.close();
			//Close the database
			fnSch.dropTable(props,conn);
			fnSch.dbUnConnect(conn);
			logMsg("Cleanup ok;");
		}
		catch(Exception e)
		{
			logErr("An error occurred while closing the database connection");
		}
	}

}

