db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r358163 [3/4] - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/reference/ engine/org/apache/derby/impl/sql/compile/ testing/...
Date Wed, 21 Dec 2005 00:54:02 GMT
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/CompatibilitySuite.java Tue Dec 20 16:53:42 2005
@@ -59,59 +59,21 @@
 	public	static	final	Version	VM_1_4 = new Version( 1, 4 );
 	public	static	final	Version	VM_1_5 = new Version( 1, 5 );
 
-	public	static	final	String	DEFAULT_USER_NAME = "APP";
-	public	static	final	String	DEFAULT_PASSWORD = "APP";
-
-	//
-	// These are properties for the Derby connection URL.
-	//
+	public	static	final	String	SERVER_VERSION_FUNCTION = "getVMVersion";
+	
 	private	static	final			String	VERSION_PROPERTY = "java.version";
-	private	static	final			String	SERVER_URL = "jdbc:derby://localhost:1527/";
-	private	static	final			String	CREATE_PROPERTY = "create=true";
 
 	private	static	final			int		EXPECTED_CLIENT_COUNT = 1;
 
-	//
-	// Indexes into the array of client-specific strings. E.g., DB2JCC_CLIENT,
-	// DERBY_CLIENT, and EMBEDDED_CLIENT.
-	//
-	private	static	final			int		DATABASE_URL = 0;
-	private	static	final			int		DRIVER_NAME = DATABASE_URL + 1;
-
-	// indexed by DATABASE_URL and DRIVER_NAME
-	private	static	final	String[]	DB2JCC_CLIENT =
-	{
-		"jdbc:derby:net://localhost:1527/",
-		"com.ibm.db2.jcc.DB2Driver"
-	};
-	private	static	final	String[]	DERBY_CLIENT =
-	{
-		"jdbc:derby://localhost:1527/",
-		"org.apache.derby.jdbc.ClientDriver"
-	};
-	private	static	final	String[]	EMBEDDED_CLIENT =
-	{
-		"jdbc:derby:",
-		"org.apache.derby.jdbc.EmbeddedDriver"
-	};
-
-	private	static	final	String[][]	LEGAL_CLIENTS =
-	{
-		DB2JCC_CLIENT,
-		DERBY_CLIENT,
-		EMBEDDED_CLIENT
-	};
-	
 	/////////////////////////////////////////////////////////////
 	//
 	//	STATE
 	//
 	/////////////////////////////////////////////////////////////
 
-	private	static	String[]	_defaultClientSettings;	// one of the clients in LEGAL_CLIENTS
 	private	static	Driver		_driver;				// the corresponding jdbc driver
-	private	static	String		_databaseName;			// sandbox for tests
 	private	static	Version		_clientVMLevel;			// level of client-side vm
+	private	static	Version		_serverVMLevel;			// level of server vm
 	private	static	Version		_driverLevel;			// client rev level
 	private	static	Version		_serverLevel;			// server rev level
 
@@ -202,17 +164,33 @@
 
 	/**
 	 * <p>
+	 * Get the vm level of the server.
+	 * </p>
+	 */
+	public	static	Version	getServerVMVersion()	{ return _serverVMLevel; }
+
+	/**
+	 * <p>
 	 * Get the vm level of the client.
 	 * </p>
 	 */
 	public	Version	getClientVMVersion() { return _clientVMLevel; }
 
+	/////////////////////////////////////////////////////////////
+	//
+	//	DATABASE-SIDE FUNCTIONS
+	//
+	/////////////////////////////////////////////////////////////
+	
 	/**
 	 * <p>
-	 * Return true if we're using the embedded driver.
+	 * Get the vm level of the server.
 	 * </p>
 	 */
-	public	boolean	usingEmbeddedClient() { return ( _defaultClientSettings == EMBEDDED_CLIENT ); }
+	public	static	String	getVMVersion()
+	{
+		return System.getProperty( VERSION_PROPERTY );
+	}
 
 	/////////////////////////////////////////////////////////////
 	//
@@ -246,7 +224,7 @@
 		// In that case, we don't bother looking for a client on
 		// the classpath.
 		//
-		if ( _defaultClientSettings != null ) { faultInDriver( _defaultClientSettings ); }
+		if ( getClientSettings() != null ) { faultInDriver( getClientSettings() ); }
 		else
 		{
 			String	currentClientName = null;
@@ -259,7 +237,7 @@
 
 				if ( faultInDriver( candidate ) )
 				{
-					_defaultClientSettings = candidate;
+					setClient( candidate );
 					foundCount++;
 				}
 			}
@@ -273,7 +251,7 @@
 		// Now make sure that the JDBC driver is what we expect
 
 		try {
-			_driver = DriverManager.getDriver( _defaultClientSettings[ DATABASE_URL ] );
+			_driver = DriverManager.getDriver( getClientSettings()[ DATABASE_URL ] );
 			_driverLevel = new Version( _driver.getMajorVersion(), _driver.getMinorVersion() );
 		}
 		catch (SQLException e)
@@ -281,7 +259,7 @@
 			printStackTrace( e );
 			
 			throw new Exception
-				( "Driver doesn't understand expected URL: " + _defaultClientSettings[ DATABASE_URL ] );
+				( "Driver doesn't understand expected URL: " + getClientSettings()[ DATABASE_URL ] );
 		}
 
 		println
@@ -306,6 +284,8 @@
 			String				dbProductVersion = dmd.getDatabaseProductVersion();
 
 			_serverLevel = new Version( dbProductVersion );
+			
+			parseServerVMVersion( conn );
 		}
 		catch (Exception e)
 		{
@@ -319,26 +299,10 @@
 		return true;
 	}
 
-	protected	static	boolean	faultInDriver( String[] clientSettings )
-	{
-		String	currentClientName = clientSettings[ DRIVER_NAME ];
-		
-		try {
-			Class.forName( currentClientName );
-
-			return true;
-		}
-		catch (Exception e)
-		{
-			println( "Could not find " + currentClientName );
-			return false;
-		}
-	}
-
 	private	static	boolean	parseVMLevel()
 		throws Exception
 	{
-		String				vmVersion = System.getProperty( VERSION_PROPERTY );
+		String				vmVersion = getVMVersion();
 
 		try {
 			_clientVMLevel = new Version( vmVersion );
@@ -359,7 +323,7 @@
 		if ( ( args == null ) || (args.length == 0 ) )
 		{ throw new Exception( "Missing database name." ); }
 		
-		_databaseName = args[ 0 ];
+		setDatabaseName( args[ 0 ] );
 
 		if ( (args.length > 1) && !"".equals( args[ 1 ] ) )
 		{
@@ -372,12 +336,12 @@
 
 				if ( desiredClientName.equals( candidate[ DRIVER_NAME ] ) )
 				{
-					_defaultClientSettings = candidate;
+					setClient( candidate );
 					break;
 				}
 			}
 
-			if ( _defaultClientSettings == null )
+			if ( getClientSettings() == null )
 			{
 				throw new Exception
 					( "Could not find client " + desiredClientName + " on the classpath." );
@@ -387,88 +351,48 @@
 		return true;
 	}
 
-	//////////////////////////
-	//
-	//	CONNECTION MINIONS
-	//
-	//////////////////////////
-	
-	// Get a connection to the server.
-	protected	static	Connection	getConnection()
-		throws Exception
-	{
-		return getConnection( _defaultClientSettings, _databaseName, new Properties() );
-	}
-	protected	static	Connection	getConnection
-	(
-	    String[]	clientSettings,
-		String		databaseName,
-		Properties	properties
-	)
-		throws Exception
-	{
-		faultInDriver( clientSettings );
-
-		properties.put( "user", DEFAULT_USER_NAME );
-		properties.put( "password", DEFAULT_PASSWORD );
-		properties.put( "retreiveMessagesFromServerOnGetMessage", "true" );
-
-		Connection		conn = DriverManager.getConnection
-			( makeDatabaseURL( clientSettings, databaseName ), properties );
-
-		println( "Connection is a " + conn.getClass().getName() );
-		
-		return conn;
-	}
-
-	// Build the connection URL.
-	private	static	String	makeDatabaseURL( String[] clientSettings, String databaseName )
-	{
-		return clientSettings[ DATABASE_URL ] + databaseName;
-	}
-
-   
-	///////////////
-	//
-	//	SQL MINIONS
-	//
-	///////////////
-
 	/**
 	 * <p>
-	 * Create an empty database.
+	 * Get the vm level of the server.
 	 * </p>
 	 */
-	protected	void	createDB( String databaseName )
-		throws Exception
+	private	static	void	parseServerVMVersion( Connection conn )
+		throws SQLException
 	{
-		String[]	clientSettings = _defaultClientSettings;
-		String		dbURL = makeDatabaseURL( clientSettings, databaseName );
+		dropFunction( conn, SERVER_VERSION_FUNCTION );
 
-		dbURL = dbURL + ';' + CREATE_PROPERTY;
-
-		Properties	properties = new Properties();
-
-		properties.put( "user", DEFAULT_USER_NAME );
-		properties.put( "password", DEFAULT_PASSWORD );
+		PreparedStatement	ps = prepare
+			(
+			    conn,
+				"create function " + SERVER_VERSION_FUNCTION + "() returns varchar(50)\n" +
+				"parameter style java no sql language java\n" +
+				"external name 'org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite.getVMVersion'"
+			);
+		ps.execute();
+		close( ps );
 
-		faultInDriver( clientSettings );
+		ps = prepare
+			(
+			    conn,
+				"values " + SERVER_VERSION_FUNCTION + "()"
+			);
 
-		Connection		conn = DriverManager.getConnection( dbURL, properties );
+		ResultSet	rs = ps.executeQuery();
+		rs.next();
+		String		rawVersion = rs.getString( 1 );
+		close( rs );
+		close( ps );
 
-		conn.close();
+		_serverVMLevel = new Version( rawVersion );
+			
+		println( "Server VM Version = " + _serverVMLevel );
 	}
 
+	///////////////
 	//
-	// Thin wrapper around jdbc layer to support debugging.
+	//	SQL MINIONS
 	//
-	protected	PreparedStatement	prepare( Connection conn, String text )
-		throws SQLException
-	{
-		println( "Preparing: " + text );
-
-		return conn.prepareStatement( text );
-	}
+	///////////////
 
 	/////////////////////////////////////////////////////////////
 	//

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java Tue Dec 20 16:53:42 2005
@@ -46,8 +46,10 @@
 	/////////////////////////////////////////////////////////////
 
 	private	static	final			String	ALL_TYPES_TABLE = "allTypesTable";
+	private	static	final			String	BOOLEAN_TABLE = "booleanTable";
 	private	static	final			String	KEY_COLUMN = "keyCol";
-	
+	private	static	final			String	RICOCHET_BOOLEAN_PROC = "ricochetBooleanProc";
+
 	//
 	// Data values to be stuffed into columns of ALL_TYPES_TABLE.
 	//
@@ -117,6 +119,11 @@
 		( Types.VARCHAR,		"varchar(5)",					IBM_2_4,	DRB_10_0,	VM_1_3 ),
 		new TypeDescriptor
 		( Types.VARBINARY,		"varchar(5) for bit data",		IBM_2_4,	DRB_10_0,	VM_1_3 ),
+
+		// 10.2 types
+		
+		new TypeDescriptor
+		( JDBC_BOOLEAN,			"boolean",						null,		DRB_10_2,	VM_1_3 ),
 	};
 
 	//
@@ -125,6 +132,8 @@
 	//
 	private	static	final	Object[]	ROW_1 =
 	{
+		// 10.0 columns
+		
 		new Long( 1L ),
 		new MyBlob( SAMPLE_BYTES ),
 		SAMPLE_STRING,
@@ -146,9 +155,44 @@
 		new Timestamp( 1L ),
 		SAMPLE_STRING,
 		SAMPLE_BYTES,
+
+		// 10.2 columns
+
+		new Boolean( true ),
+	};
+
+	//
+	// Describes columns for the boolean table test.
+	//
+	private	static	final	TypeDescriptor[]	BOOLEAN_TABLE_TYPES =
+	{
+		new TypeDescriptor
+		( JDBC_BOOLEAN,			"boolean",						null,		DRB_10_2,	VM_1_3 ),
+	};
+	
+	//
+	// This table needs to have the same number of entries as BOOLEAN_TABLE_TYPES.
+	//
+	private	static	final	Object[][]	BOOLEAN_ROWS =
+	{
+		new Object[] { new Boolean( true ) },
+		new Object[] { new Boolean( false ) },
 	};
 
 	//
+	// Describe signature of the RICOCHET_BOOLEAN_PROC procedure
+	//
+	private	static	final	int					INVALUE = 0;
+	private	static	final	int					OUTVALUE = INVALUE + 1;
+	private	static	final	TypeDescriptor[]	RICOCHET_BOOLEAN_PROC_TYPES =
+	{
+		new TypeDescriptor
+		( JDBC_BOOLEAN,			"INVALUE",						null,		DRB_10_2,	VM_1_3 ),
+		new TypeDescriptor
+		( JDBC_BOOLEAN,			"OUTVALUE",						null,		DRB_10_2,	VM_1_3 ),
+	};
+	
+	//
 	// This table needs to have the same number of rows as ALL_TYPES.
 	// Each row in this table needs to have the same number of columns as
 	// rows in ALL_TYPES. The testSanity() test case enforces this at run time.
@@ -163,38 +207,39 @@
 	//
 	private	static	final	T_CN[]	COERCIONS =
 	{
-		//												  B|B|C|B|C|D|D|D|R|I|L|L|N|R|S|T|T|V|V
-		//												  I|L|H|I|L|A|E|O|E|N|O|O|U|E|M|I|I|A|A
-		//												  G|O|A|N|O|T|C|U|A|T|N|N|M|A|A|M|M|R|R
-		//												  I|B|R|A|B|E|I|B|L|E|G|G|E|L|L|E|E|C|B
-		//												  N|-|-|R|-|-|M|L|-|G|V|V|R|-|L|-|S|H|I
-		//												  T|-|-|Y|-|-|A|E|-|E|A|A|I|-|I|-|T|A|N
-		//												  -|-|-|-|-|-|L|-|-|R|R|R|C|-|N|-|A|R|A
-		//												  -|-|-|-|-|-|-|-|-|-|C|B|-|-|T|-|M|-|R
-		//												  -|-|-|-|-|-|-|-|-|-|H|I|-|-|-|-|P|-|Y
-		//												  -|-|-|-|-|-|-|-|-|-|A|N|-|-|-|-|-|-|-
-		//												  -|-|-|-|-|-|-|-|-|-|R|A|-|-|-|-|-|-|-
-		//												  -|-|-|-|-|-|-|-|-|-|-|R|-|-|-|-|-|-|-
-		//												  -|-|-|-|-|-|-|-|-|-|-|Y|-|-|-|-|-|-|-
-		new T_CN( Types.BIGINT, new boolean[]			{ Y,_,Y,_,_,_,_,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.BLOB, new boolean[] 			{ _,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_, } ),
-		new T_CN( Types.CHAR, new boolean[]				{ _,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_, } ),
-		new T_CN( Types.BINARY, new boolean[]			{ _,_,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y, } ),
-		new T_CN( Types.CLOB, new boolean[]				{ _,_,_,_,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_, } ),
-		new T_CN( Types.DATE, new boolean[]				{ _,_,_,_,_,Y,_,_,_,_,_,_,_,_,_,_,_,_,_, } ),
-		new T_CN( Types.DECIMAL, new boolean[]			{ Y,_,_,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.DOUBLE, new boolean[]			{ Y,_,_,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.REAL, new boolean[]				{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.INTEGER, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.LONGVARCHAR, new boolean[]		{ _,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_, } ),
-		new T_CN( Types.LONGVARBINARY, new boolean[]	{ _,_,_,_,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y, } ),
-		new T_CN( Types.NUMERIC, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.REAL, new boolean[]				{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.SMALLINT, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_, } ),
-		new T_CN( Types.TIME, new boolean[]				{ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,Y,_,_,_, } ),
-		new T_CN( Types.TIMESTAMP, new boolean[]		{ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,Y,_,_, } ),
-		new T_CN( Types.VARCHAR, new boolean[]			{ _,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_, } ),
-		new T_CN( Types.VARBINARY, new boolean[]		{ _,_,_,_,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y, } ),
+		//												  B|B|C|B|C|D|D|D|R|I|L|L|N|R|S|T|T|V|V|B
+		//												  I|L|H|I|L|A|E|O|E|N|O|O|U|E|M|I|I|A|A|O
+		//												  G|O|A|N|O|T|C|U|A|T|N|N|M|A|A|M|M|R|R|O
+		//												  I|B|R|A|B|E|I|B|L|E|G|G|E|L|L|E|E|C|B|L
+		//												  N|-|-|R|-|-|M|L|-|G|V|V|R|-|L|-|S|H|I|E
+		//												  T|-|-|Y|-|-|A|E|-|E|A|A|I|-|I|-|T|A|N|A
+		//												  -|-|-|-|-|-|L|-|-|R|R|R|C|-|N|-|A|R|A|N
+		//												  -|-|-|-|-|-|-|-|-|-|C|B|-|-|T|-|M|-|R|-
+		//												  -|-|-|-|-|-|-|-|-|-|H|I|-|-|-|-|P|-|Y|-
+		//												  -|-|-|-|-|-|-|-|-|-|A|N|-|-|-|-|-|-|-|-
+		//												  -|-|-|-|-|-|-|-|-|-|R|A|-|-|-|-|-|-|-|-
+		//												  -|-|-|-|-|-|-|-|-|-|-|R|-|-|-|-|-|-|-|-
+		//												  -|-|-|-|-|-|-|-|-|-|-|Y|-|-|-|-|-|-|-|-
+		new T_CN( Types.BIGINT, new boolean[]			{ Y,_,Y,_,_,_,_,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.BLOB, new boolean[] 			{ _,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ } ),
+		new T_CN( Types.CHAR, new boolean[]				{ _,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_,_ } ),
+		new T_CN( Types.BINARY, new boolean[]			{ _,_,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_ } ),
+		new T_CN( Types.CLOB, new boolean[]				{ _,_,_,_,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ } ),
+		new T_CN( Types.DATE, new boolean[]				{ _,_,_,_,_,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_ } ),
+		new T_CN( Types.DECIMAL, new boolean[]			{ Y,_,_,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.DOUBLE, new boolean[]			{ Y,_,_,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.REAL, new boolean[]				{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.INTEGER, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.LONGVARCHAR, new boolean[]		{ _,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_,_ } ),
+		new T_CN( Types.LONGVARBINARY, new boolean[]	{ _,_,_,_,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_ } ),
+		new T_CN( Types.NUMERIC, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.REAL, new boolean[]				{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.SMALLINT, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
+		new T_CN( Types.TIME, new boolean[]				{ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,Y,_,_,_,_ } ),
+		new T_CN( Types.TIMESTAMP, new boolean[]		{ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,Y,_,_,_ } ),
+		new T_CN( Types.VARCHAR, new boolean[]			{ _,_,Y,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_,_ } ),
+		new T_CN( Types.VARBINARY, new boolean[]		{ _,_,_,_,_,_,_,_,_,_,_,Y,_,_,_,_,_,_,Y,_ } ),
+		new T_CN( JDBC_BOOLEAN, new boolean[]			{ Y,_,Y,_,_,_,Y,Y,Y,Y,Y,_,Y,Y,Y,_,_,Y,_,Y } ),
 	};
 
 	/////////////////////////////////////////////////////////////
@@ -219,6 +264,18 @@
 
 	/////////////////////////////////////////////////////////////
 	//
+	//	DATABASE-SIDE FUNCTIONS
+	//
+	/////////////////////////////////////////////////////////////
+	
+	public	static	void	ricochetBooleanProc( Boolean inValue, Boolean[] outValue )
+		throws Exception
+	{
+		outValue[ 0 ] = inValue;
+	}
+
+	/////////////////////////////////////////////////////////////
+	//
 	//	TEST ENTRY POINTS
 	//
 	/////////////////////////////////////////////////////////////
@@ -230,7 +287,8 @@
 	 */
 	public	void	testSanity()
 	{
-		assertEquals( "ALL_TYPES.length == ROW_1.length", ALL_TYPES.length, ROW_1.length );
+		assertEquals
+			( "ALL_TYPES.length == ROW_1.length", ALL_TYPES.length, ROW_1.length );
 
 		// make sure there we completely describe the coercibility of every jdbc type
 		int		coercionCount = COERCIONS.length;
@@ -256,6 +314,54 @@
 		close( conn );
 	}
 	
+	/**
+	 * <p>
+	 * Test the boolean datatype added in release 10.2.
+	 * </p>
+	 */
+	public	void	testBoolean()
+		throws Exception
+	{
+		Connection			conn = getConnection();
+
+		// make sure we can read a legacy BOOLEAN column, regardless
+		// of the client/server/vm combination
+		readLegacyBooleanColumn( conn );
+		readLegacyBooleanMetadata( conn );
+		
+		if ( getServerVersion().atLeast( DRB_10_2 ) )
+		{		
+			TypeDescriptor[]	types = BOOLEAN_TABLE_TYPES;
+			String				tableName = BOOLEAN_TABLE;
+			Object[][]			rows = makeRows( BOOLEAN_ROWS );
+			ArrayList			casts = new ArrayList();
+		
+			dropTable( conn, tableName );
+			createTable( conn, tableName, types );
+			checkDBMetadata( conn, tableName );
+			stuffTable( conn, tableName, types, rows );
+			readTable( conn, tableName, types, rows, casts );
+
+			truncateTable( conn, tableName );
+			insertCasts( conn, tableName, types, casts );
+			verifyInsertedCasts( conn, tableName, types, casts );
+
+			dropProcedure( conn, RICOCHET_BOOLEAN_PROC );
+			executeDDL
+				(
+				 conn,
+				 "create procedure " + RICOCHET_BOOLEAN_PROC +
+				 "( in inValue boolean, out outValue boolean )\n" +
+				 "parameter style java no sql language java external name\n" +
+				 "'" + getClass().getName() + "." + RICOCHET_BOOLEAN_PROC + "'"
+				 );
+			checkProcMetadata( conn, RICOCHET_BOOLEAN_PROC, RICOCHET_BOOLEAN_PROC_TYPES );
+			callBooleanProc( conn );
+		}
+		
+		close( conn );
+	}
+
 	/////////////////////////////////////////////////////////////
 	//
 	//	TEST DATATYPES
@@ -269,29 +375,30 @@
 	private	void	datatypesTest( Connection conn )
 		throws Exception
 	{
-		Object[][]	rows = new Object[][] { makeNullRow(), ROW_1 };
+		TypeDescriptor[]	types = ALL_TYPES;
+		String				tableName = ALL_TYPES_TABLE;
+		Object[][]			rows = new Object[][] { makeNullRow( types.length ), ROW_1 };
 		
-		checkTypeDBMetadata( conn );
-		stuffAllTypesTable( conn, rows );
-		readAllTypesTable( conn, rows );
+		checkDBMetadata( conn, tableName );
+		stuffTable( conn, tableName, types, rows );
+		readTable( conn, tableName, types, rows, null );
 	}
 	
 	//
-	// Verify that we get the correct DatabaseMetaData for all datatypes
-	// that are legal on the server.
+	// Verify that we get the correct DatabaseMetaData for a table.
 	//
-	private	void	checkTypeDBMetadata( Connection conn )
+	private	void	checkDBMetadata( Connection conn, String tableName )
 		throws Exception
 	{
 		String				normalizedSchema = DEFAULT_USER_NAME.toUpperCase();
-		String				normalizedTable = ALL_TYPES_TABLE.toUpperCase();
+		String				normalizedTable = tableName.toUpperCase();
 		DatabaseMetaData	dbmd = conn.getMetaData();
 
 		ResultSet			rs = dbmd.getColumns
 			( null, normalizedSchema, normalizedTable, "%" );
 
-		println( "Pawing through metadata for " + normalizedSchema + '.' + normalizedTable );
-		
+		println( "Pawing through database metadata for " + normalizedSchema + '.' + normalizedTable );
+
 		while( rs.next() )
 		{
 			String			columnName = rs.getString( "COLUMN_NAME" );
@@ -311,17 +418,72 @@
 
 			println( buffer.toString() );
 			
-			assertEquals( columnName, typeDesc.getJdbcType(), actualJdbcType );
+			assertEquals( columnName, ddmdTypeKludge( typeDesc.getJdbcType() ), actualJdbcType );
 		}
 
 		close( rs );
 	}
 
 	//
-	// Verify that we can insert all datatypes that are legal on the
-	// server.
+	// Verify that we get the correct DatabaseMetaData for a procedure
 	//
-	private	void	stuffAllTypesTable( Connection conn, Object[][] rows )
+	private	void	checkProcMetadata( Connection conn, String procName, TypeDescriptor[] signature )
+		throws Exception
+	{
+		String				normalizedSchema = DEFAULT_USER_NAME.toUpperCase();
+		String				normalizedProc = procName.toUpperCase();
+		DatabaseMetaData	dbmd = conn.getMetaData();
+
+		ResultSet			rs = dbmd.getProcedureColumns
+			( null, normalizedSchema, normalizedProc, "%" );
+
+		println( "Pawing through database metadata for " + normalizedSchema + '.' + normalizedProc );
+
+		while( rs.next() )
+		{
+			String			columnName = rs.getString( "COLUMN_NAME" );
+			int				actualJdbcType = rs.getInt( "DATA_TYPE" );
+			TypeDescriptor	typeDesc = getType( signature, columnName );
+
+			if ( columnName.equals( KEY_COLUMN ) ) { continue; }
+
+			StringBuffer	buffer = new StringBuffer();
+
+			buffer.append( "[ " );
+			buffer.append( rs.getString( "COLUMN_NAME" ) );
+			buffer.append( ",\t" );
+			buffer.append( "type( " + rs.getInt( "DATA_TYPE" ) + " ),\t" );
+			buffer.append( rs.getString( "TYPE_NAME" ) );
+			buffer.append( " ]" );
+
+			println( buffer.toString() );
+			
+			assertEquals( columnName, ddmdTypeKludge( typeDesc.getJdbcType() ), actualJdbcType );
+		}
+
+		close( rs );
+	}
+
+	//
+	// Stuff a table with rows
+	//
+	private	void	stuffTable
+		( Connection conn, String tableName, TypeDescriptor[] types, Object[][] rows )
+		throws Exception
+	{
+		PreparedStatement	ps = makeInsert( conn, tableName, types );
+		int					rowCount = rows.length;
+
+		for ( int i = 0; i < rowCount; i++ )
+		{
+			setRow( ps, i + 1, types, rows[ i ] );
+		}
+		
+		close( ps );
+	}
+
+	private	PreparedStatement	makeInsert
+		( Connection conn, String tableName, TypeDescriptor[] types )
 		throws Exception
 	{
 		StringBuffer	masterBuffer = new StringBuffer();
@@ -329,7 +491,7 @@
 		StringBuffer	valuesBuffer = new StringBuffer();
 		int				columnNumber = 0;
 		int				valuesNumber = 0;
-		int				typeCount = ALL_TYPES.length;
+		int				typeCount = types.length;
 
 		beginColumnList( columnBuffer );
 		beginColumnList( valuesBuffer );
@@ -339,7 +501,7 @@
 		
 		for ( int i = 0; i < typeCount; i++ )
 		{
-			TypeDescriptor	type = ALL_TYPES[ i ];
+			TypeDescriptor	type = types[ i ];
 			
 			if ( getServerVersion().atLeast( type.getDerbyVersion() ) )
 			{
@@ -354,31 +516,43 @@
 		endColumnList( columnBuffer );
 		endColumnList( valuesBuffer );
 
-		masterBuffer.append( "insert into " + ALL_TYPES_TABLE + "\n" );
+		masterBuffer.append( "insert into " + tableName + "\n" );
 		masterBuffer.append( columnBuffer.toString() );
 		masterBuffer.append( "values\n" );
 		masterBuffer.append( valuesBuffer.toString() );
 
 		PreparedStatement	ps = prepare( conn, masterBuffer.toString() );
-		int					rowCount = rows.length;
 
-		for ( int i = 0; i < rowCount; i++ )
-		{
-			setRow( ps, i + 1, rows[ i ] );
-		}
+		return ps;
+	}
+
+	//
+	// Verify that we can select all legal datatypes in a table.
+	//
+	private	void	readTable
+		( Connection conn, String tableName, TypeDescriptor[] types, Object[][] rows, List casts )
+		throws Exception
+	{
+		PreparedStatement	ps = readTableQuery( conn, tableName, types );
+		ResultSet			rs = ps.executeQuery();
+
+		checkRSMD( rs );
+		checkRows( rs, types, rows, casts );
 		
+		close( rs );
 		close( ps );
 	}
 
 	//
-	// Verify that we can select all datatypes that are legal on the server.
+	// Make the select query
 	//
-	private	void	readAllTypesTable( Connection conn, Object[][] rows )
+	private	PreparedStatement	readTableQuery
+		( Connection conn, String tableName, TypeDescriptor[] types )
 		throws Exception
 	{
 		StringBuffer	buffer = new StringBuffer();
 		int				columnNumber = 0;
-		int				typeCount = ALL_TYPES.length;
+		int				typeCount = types.length;
 
 		buffer.append( "select \n" );
 
@@ -386,7 +560,7 @@
 		
 		for ( int i = 0; i < typeCount; i++ )
 		{
-			TypeDescriptor	type = ALL_TYPES[ i ];
+			TypeDescriptor	type = types[ i ];
 			
 			if ( getServerVersion().atLeast( type.getDerbyVersion() ) )
 			{
@@ -397,19 +571,14 @@
 			}
 		}
 
-		buffer.append( "\nfrom " + ALL_TYPES_TABLE + "\n" );
+		buffer.append( "\nfrom " + tableName + "\n" );
 		buffer.append( "order by " + doubleQuote( KEY_COLUMN ) );
 
 		PreparedStatement	ps = prepare( conn, buffer.toString() );
-		ResultSet			rs = ps.executeQuery();
 
-		checkRSMD( rs );
-		checkRows( rs, rows );
-		
-		close( rs );
-		close( ps );
+		return ps;
 	}
-
+	
 	//
 	// Verify that we get the correct ResultSetMetaData for all datatypes
 	// which are legal on the server.
@@ -421,29 +590,39 @@
 		int					columnCount = rsmd.getColumnCount();
 		int					firstTastyColumn = 0;
 
-		println( "Column count = " + columnCount );
+		println( "ResultSetMetaData:\n" );
 		
 		firstTastyColumn++;				// skip uninteresting key column
 
 		for ( int i = firstTastyColumn; i < columnCount; i++ )
 		{
+			StringBuffer		buffer = new StringBuffer();
 			int				columnID = i + 1;
 			String			columnName = rsmd.getColumnName( columnID );
 			TypeDescriptor	typeDesc = getType( columnName );
 			int				expectedType = rsmdTypeKludge( typeDesc.getJdbcType() );
 			int				actualType = rsmd.getColumnType( columnID );
+
+			buffer.append( "[ " );
+			buffer.append( columnName );
+			buffer.append( ", type( " );
+			buffer.append( actualType );
+			buffer.append( " ), " );
+			buffer.append( rsmd.getColumnTypeName( columnID ) );
+			buffer.append( " ]\n" );
 			
-			println( "Checking type of " + columnName );
+			println( buffer.toString() );
 
 			assertEquals( columnName, expectedType, actualType );
 		}
+
 	}
 
 	//
 	// Verify that we select the values we
 	// originally inserted into a table.
 	//
-	private	void	checkRows( ResultSet rs, Object[][] rows )
+	private	void	checkRows( ResultSet rs, TypeDescriptor[] types, Object[][] rows, List casts )
 		throws Exception
 	{
 		int					rowCount = rows.length;
@@ -451,7 +630,7 @@
 		for ( int i = 0; i < rowCount; i++ )
 		{
 			rs.next();
-			checkRow( rs, rows[ i ] );
+			checkRow( rs, types, rows[ i ], casts );
 		}
 	}
 
@@ -459,14 +638,14 @@
 	// Verify that we select the values we
 	// originally inserted into a row.
 	//
-	private	void	checkRow( ResultSet rs, Object[] row )
+	private	void	checkRow( ResultSet rs, TypeDescriptor[] types, Object[] row, List casts )
 		throws Exception
 	{
-		int				typeCount = ALL_TYPES.length;
+		int				typeCount = types.length;
 
 		for ( int i = 0; i < typeCount; i++ )
 		{
-			TypeDescriptor	type = ALL_TYPES[ i ];
+			TypeDescriptor	type = types[ i ];
 			
 			if ( getServerVersion().atLeast( type.getDerbyVersion() ) )
 			{
@@ -477,7 +656,7 @@
 				println( "Comparing column " + columnName + ": " + expectedValue + " to " + actualValue );
 				compareObjects( columnName, expectedValue, actualValue );
 
-				checkCoercions( rs, columnName, type );
+				checkCoercions( rs, columnName, type, casts );
 			}
 		}
 	}
@@ -485,7 +664,7 @@
 	//
 	// Verify all legal jdbc coercions of a data value.
 	//
-	private	void	checkCoercions( ResultSet rs, String columnName, TypeDescriptor type )
+	private	void	checkCoercions( ResultSet rs, String columnName, TypeDescriptor type, List casts )
 		throws Exception
 	{
 		T_CN		coercionDesc = COERCIONS[ getCoercionIndex( type.getJdbcType() ) ];
@@ -500,26 +679,81 @@
 			if ( coercions[ i ] )
 			{
 				legalCoercions++;
-				
-				Object	retval = getColumn( rs, columnName, COERCIONS[ i ].getJdbcType() );
+
+				int		jdbcType = COERCIONS[ i ].getJdbcType();
+				Object	retval = getColumn( rs, columnName, jdbcType );
+
+				if ( casts != null ) { casts.add( retval ); }
+
+				println( "\t" + jdbcType + ":\t" + retval );
 			}
+
 		}
+		// finally, try getObject()
 
-		println( "   Checked " + legalCoercions + " coercions for " + columnName );
+		Object	objval = rs.getObject( columnName );
+		if ( objval == null ) { println( "\tgetObject() = null" ); }
+		else
+		{
+			StringBuffer	buffer = new StringBuffer();
+			buffer.append( "\tgetObject() = " );
+			buffer.append( objval.getClass().getName() );
+			buffer.append( "( " );
+			buffer.append( objval );
+			buffer.append( " )" );
+			println( buffer.toString() );
+		}
 	}
 	
 	//
 	// This kludge compensates for the fact that the DRDA clients report
 	// that NUMERIC columns are DECIMAL. See bug 584.
 	//
+	// In addition, booleans are handled oddly by down-rev clients.
+	//
 	private	int	rsmdTypeKludge( int originalJDbcType )
 	{
 		// The embedded client does the right thing.
-		if ( usingEmbeddedClient() ) { return originalJDbcType; }
+		if ( usingEmbeddedClient() && getServerVMVersion().atLeast( VM_1_4 ) ) { return originalJDbcType; }
 		
 		switch( originalJDbcType )
 		{
-			case Types.NUMERIC:	return Types.DECIMAL;
+			case JDBC_BOOLEAN:
+				if ( usingEmbeddedClient() )	{ return Types.BIT; }
+				else if ( doesNotSupportBoolean() )	{ return Types.SMALLINT; }
+				else { return originalJDbcType; }
+
+			//This kludge compensates for the fact that the DRDA clients report
+			// that NUMERIC columns are DECIMAL. See bug 584.
+			case Types.NUMERIC:
+				if ( usingEmbeddedClient() )	{ return originalJDbcType; }
+				else { return Types.DECIMAL; }
+
+		    default:			return originalJDbcType;
+		}
+	}
+
+	private	boolean	supportsBoolean() { return !doesNotSupportBoolean(); }
+	
+	private	boolean	doesNotSupportBoolean()
+	{
+		return
+			( getServerVMVersion().equals( VM_1_3 ) ) ||
+			( usingDerbyClient() && !getDriverVersion().atLeast( DRB_10_2 ) ) ||
+			( usingDB2Client() );
+	}
+	
+	//
+	// This kludge compensates for the fact that servers return
+	// different jdbc types depending on their vm.
+	//
+	private	int	ddmdTypeKludge( int originalJDbcType )
+	{
+		switch( originalJDbcType )
+		{
+			case JDBC_BOOLEAN:
+				if ( getServerVMVersion().atLeast( VM_1_4 ) ) { return originalJDbcType; }
+				else { return Types.BIT; }
 
 		    default:			return originalJDbcType;
 		}
@@ -529,17 +763,17 @@
 	// Insert a row into the ALL_TYPES table. The row contains all datatypes
 	// that are legal on the server.
 	//
-	private	void	setRow( PreparedStatement ps, int keyValue, Object[] row )
+	private	void	setRow( PreparedStatement ps, int keyValue, TypeDescriptor[] types, Object[] row )
 		throws Exception
 	{
 		int				param = 1;
-		int				typeCount = ALL_TYPES.length;
+		int				typeCount = types.length;
 
 		ps.setInt( param++, keyValue );
 
 		for ( int i = 0; i < typeCount; i++ )
 		{
-			TypeDescriptor	type = ALL_TYPES[ i ];
+			TypeDescriptor	type = types[ i ];
 			Object			value = row[ i ];
 			
 			if ( getServerVersion().atLeast( type.getDerbyVersion() ) )
@@ -551,9 +785,29 @@
 		ps.execute();
 	}
 
-	private	Object[]	makeNullRow()
+	//
+	// Add a row of null columns.
+	//
+	private	Object[][]	makeRows( Object[][] rows )
+	{
+		int			count = rows.length;
+		int			columns = rows[0].length;
+		Object[][]	result = new Object[ count + 1 ][];
+		int			idx = 0;
+
+		result[ idx++ ] = makeNullRow( columns );
+		
+		for ( int i = 0; i < count; i++ )
+		{
+			result[ idx++ ] = rows[ i ];
+		}
+
+		return result;
+	}
+
+	private	Object[]	makeNullRow( int rowLength )
 	{
-		return new Object[ ALL_TYPES.length ];
+		return new Object[ rowLength ];
 	}
 
 	//
@@ -571,7 +825,7 @@
 	}
 
 	//
-	// Lookup TypeDescriptors by Derby tgype name.
+	// Lookup TypeDescriptors by Derby type name.
 	//
 	private	TypeDescriptor	getType( String typeName )
 	{
@@ -581,6 +835,40 @@
 	}
 
 	//
+	// Lookup TypeDescriptors by jdbc type
+	//
+	private	TypeDescriptor	getType( int jdbcType )
+	{
+		int			count = ALL_TYPES.length;
+
+		for ( int i = 0; i < count; i++ )
+		{
+			TypeDescriptor	type = ALL_TYPES[ i ];
+
+			if ( type.getJdbcType() == jdbcType ) { return type; }
+		}
+
+		return null;
+	}
+
+	//
+	// Lookup TypeDescriptors by column name in an array of types
+	//
+	private	TypeDescriptor	getType( TypeDescriptor[] types, String typeName )
+	{
+		int		count = types.length;
+
+		for ( int i = 0; i < count; i++ )
+		{
+			TypeDescriptor	type = types[ i ];
+
+			if ( type.getDerbyTypeName().equals( typeName ) ) { return type; }
+		}
+		
+		return null;
+	}
+
+	//
 	// Index legal coercions by jdbc type.
 	//
 	private	void	buildCoercionMap()
@@ -606,10 +894,275 @@
 	
 	/////////////////////////////////////////////////////////////
 	//
+	//	TEST BOOLEAN
+	//
+	/////////////////////////////////////////////////////////////
+
+	//
+	// Read a system column that is BOOLEAN
+	//
+	private	void	readLegacyBooleanColumn( Connection conn )
+		throws Exception
+	{
+		PreparedStatement	ps = prepare( conn, "select systemalias from sys.sysaliases" );
+		ResultSet			rs = ps.executeQuery();
+		int					count = 0;
+
+		while ( rs.next() )
+		{
+			boolean		result = rs.getBoolean( 1 );
+
+			count++;
+		}
+		println( "Read " + count + " booleans from sys.sysaliases" );
+
+		close( rs );
+		close( ps );
+	}
+
+	//
+	// Read a metadata scrap that is BOOLEAN. Just make sure this succeeds.
+	//
+	private	void	readLegacyBooleanMetadata( Connection conn )
+		throws Exception
+	{
+		DatabaseMetaData	dbmd = conn.getMetaData();
+
+		boolean				allTablesAreSelectable = dbmd.allTablesAreSelectable();
+		boolean				allProceduresAreCallable = dbmd.allProceduresAreCallable();
+	}
+	
+	private	void	insertCasts( Connection conn, String tableName, TypeDescriptor[] types, List casts )
+		throws Exception
+	{
+		PreparedStatement	ps = makeInsert( conn, tableName, types );
+		int					count = casts.size();
+		int					key = 1;
+
+		for ( int i = 0; i < count; i++ )
+		{
+			Object				value = casts.get( i );
+
+			value = castTheCast( types[ 0 ], value );
+
+			if ( value != null )
+			{
+				int					param = 1;
+				ps.setInt( param++, key++ );
+				setParameter( ps, param++, value );
+				ps.execute();
+			}
+		}
+	}
+
+	/////////////////////////////////////////////////////////////
+	//
 	//	MINIONS
 	//
 	/////////////////////////////////////////////////////////////
 	
+	//
+	// Check insert casting.
+	//
+	//
+	// This method accounts for the following irregularities in our network
+	// layer:
+	//
+	// o ResultSet.getString() on a boolean column, in old clients, return
+	//   "1" rather than "true".
+	// o PreparedStatement.setBigDecimal() doesn't work on BOOLEAN columns
+	//   masquerading as SMALLINTs.
+	//
+	// Returns null if we should ignore the cast because of some deficiency
+	// in the client.
+	//
+	private	Object	castTheCast( TypeDescriptor type, Object value )
+	{
+		int			jdbctype = type.getJdbcType();
+
+		if ( value == null ) { return null; }
+		
+		switch ( jdbctype )
+		{
+		    case JDBC_BOOLEAN:
+				if ( supportsBoolean() ) { return value; }
+				//
+				// Old clients return "1" instead of "true" from
+				// ResultSet.getString(). This will fail in the server because
+				// 1 cannot be cast to a boolean. Note that for db2jcc, we
+				// can't return "true" because db2jcc refused to coerce
+				// that to a SMALLINT.
+				//
+				else if ( value instanceof String )
+				{
+					if ( usingDerbyClient() ) { return value.equals( "1" ) ? "true" : "false"; }
+					else { return null; }
+				}
+				//
+				// Old clients can't stuff BigDecimal into a short apparently
+				//
+				else if ( value instanceof BigDecimal )	{ return null; }
+				else { return value; }
+				
+		    default: return value;
+		}
+	}
+	
+	//
+	// Verify inserted casts.
+	//
+	private	void	verifyInsertedCasts
+		( Connection conn, String tableName, TypeDescriptor[] types, List casts )
+		throws Exception
+	{
+		PreparedStatement	ps = readTableQuery( conn, tableName, types );
+		ResultSet			rs = ps.executeQuery();
+		int					count = casts.size();
+		int					tastyColumn = 2;
+
+		for ( int i = 0; i < count; i++ )
+		{
+			Object	value = casts.get( i );
+
+			if ( castTheCast( types[ 0 ], value ) != null )
+			{
+				rs.next();
+				checkParameter( rs, tastyColumn, value );
+			}
+		}
+	}
+
+	//
+	// Test the calling of a procedure with boolean args.
+	//
+	private	void	callBooleanProc( Connection conn )
+		throws Exception
+	{
+		// the db2 driver can't handle the jdbc boolean type
+		int			outParamType = ( usingDB2Client() ? Types.SMALLINT : JDBC_BOOLEAN );
+		
+		CallableStatement	cs = prepareCall
+			(
+			 conn,
+			 "call " + RICOCHET_BOOLEAN_PROC + "( ?, ? )"
+			);
+		cs.registerOutParameter( 2, outParamType );
+
+		callBooleanProc( cs, new Boolean( false ) );
+		callBooleanProc( cs, new Boolean( true ) );
+		callBooleanProc( cs, null );
+	}
+	private	void	callBooleanProc( CallableStatement cs, Boolean value )
+		throws Exception
+	{
+		TypeDescriptor	inType = RICOCHET_BOOLEAN_PROC_TYPES[ INVALUE ];
+		TypeDescriptor	outType = RICOCHET_BOOLEAN_PROC_TYPES[ OUTVALUE ];
+		ArrayList		coercedTypes = new ArrayList();
+		ArrayList		casts = new ArrayList();
+		
+		setParameter( cs, INVALUE + 1, inType, value );
+		cs.execute();
+
+		Object	retval = getOutArg( cs, OUTVALUE + 1, outType );
+
+		compareObjects( "Result should be " + value + " but is " + retval, value, retval );
+
+		// make sure getObject() works
+		retval = squeezeReturnArg( cs.getObject( OUTVALUE + 1 ) );
+		compareObjects( "Result should be " + value + " but is " + retval, value, retval );
+
+		// try all legal getXXX() methods on the output arg
+		println( "Checking coercions for " + value );
+		checkBooleanProcCoercions( cs, coercedTypes, casts );
+
+		// now try setting the input parameter using all of the legal types
+		doublecheckBooleanProcCoercions( cs, coercedTypes, casts );
+	}
+	private	Object	squeezeReturnArg( Object original )
+	{
+		if ( original == null ) { return null; }
+
+		if ( supportsBoolean() ) { return original; }
+		// Special case for embedded configuration on 1.3
+		else if ( original instanceof Boolean ) { return original; }
+		//
+		// Account for the fact that old configurations can't
+		// handle boolean values and coerce them to Integers
+		// when you call CallableStatement.getObject().
+		//
+		else
+		{
+			int		value = ((Integer) original).intValue();
+			boolean	boolValue = ( value == 0 ? false : true );
+
+			return new Boolean( boolValue );
+		}
+	}
+	private	void	checkBooleanProcCoercions
+		( CallableStatement cs, ArrayList coercedTypes, ArrayList casts )
+		throws Exception
+	{
+		TypeDescriptor	outType = RICOCHET_BOOLEAN_PROC_TYPES[ OUTVALUE ];
+		T_CN			coercionDesc = COERCIONS[ getCoercionIndex( outType.getJdbcType() ) ];
+		boolean[]		coercions = coercionDesc.getCoercions();
+		int				count = coercions.length;
+		int				legalCoercions = 0;
+
+		// make sure we can call all the appropriate getXXX() methods on
+		// the output parameter
+		for ( int i = 0; i < count; i++ )
+		{
+			if ( coercions[ i ] )
+			{
+				legalCoercions++;
+
+				int				jdbcType = COERCIONS[ i ].getJdbcType();
+				Object			retval = getOutArg( cs, OUTVALUE + 1, jdbcType );
+
+				if ( retval != null )
+				{
+					coercedTypes.add( new Integer( jdbcType ) );
+					casts.add( retval );
+				}
+
+				println( "\t" + jdbcType + ":\t" + retval );
+			}
+		}
+	}
+	private	void	doublecheckBooleanProcCoercions
+		( CallableStatement cs, ArrayList coercedTypes, ArrayList casts )
+		throws Exception
+	{
+		TypeDescriptor	inType = RICOCHET_BOOLEAN_PROC_TYPES[ INVALUE ];
+		int				castCount = casts.size();
+
+		println( "Performing " + castCount + " coercions..." );
+		for ( int i = 0; i < castCount; i++ )
+		{
+			int				jdbcType = ((Integer) coercedTypes.get( i )).intValue();
+			TypeDescriptor	type = getType( jdbcType );
+			Object			insertValue = casts.get( i );
+			Object			transmogrifiedValue = castTheCast( inType, insertValue );
+
+			if ( transmogrifiedValue != null )
+			{
+				setParameter( cs, INVALUE + 1, type, transmogrifiedValue );
+				cs.execute();
+
+				// make sure we get what we set
+				Object	outval = getOutArg( cs, OUTVALUE + 1, type );
+
+				compareObjects
+				(
+				 "Result for " + insertValue.getClass().getName() +
+				 " should be " + insertValue + " but is " + outval,
+				 insertValue,
+				 outval
+				 );
+			}
+		}
+	}
+	
 	///////////////////
 	//
 	//	TYPE MANAGEMENT
@@ -628,27 +1181,27 @@
 	private	void	createSchema( Connection conn )
 		throws Exception
 	{
-		createAllTypesTable( conn );
+		createTable( conn, ALL_TYPES_TABLE, ALL_TYPES );
 	}
 
 	//
-	// Create the table for testing legal datatypes.
+	// Create a table modelling an array of datatypes.
 	//
-	private	void	createAllTypesTable( Connection conn )
+	private	void	createTable( Connection conn, String tableName, TypeDescriptor[] types )
 		throws Exception
 	{
 		StringBuffer	buffer = new StringBuffer();
 		int				columnNumber = 0;
-		int				typeCount = ALL_TYPES.length;
+		int				typeCount = types.length;
 
-		buffer.append( "create table " + ALL_TYPES_TABLE + "\n" );
+		buffer.append( "create table " + tableName + "\n" );
 		beginColumnList( buffer );
 
 		addColumn( buffer, columnNumber++, doubleQuote( KEY_COLUMN ) + "\tint" );
 		
 		for ( int i = 0; i < typeCount; i++ )
 		{
-			TypeDescriptor	type = ALL_TYPES[ i ];
+			TypeDescriptor	type = types[ i ];
 			
 			if ( getServerVersion().atLeast( type.getDerbyVersion() ) )
 			{
@@ -668,6 +1221,7 @@
 		close( ps );
 	}
 
+
 	//
 	// Helper methods for declaring a table.
 	//
@@ -694,19 +1248,6 @@
 	{
 		dropTable( conn, ALL_TYPES_TABLE );
 	}
-	private	void	dropTable( Connection conn, String tableName )
-	{
-		PreparedStatement	ps = null;
-		
-		try {
-			ps = prepare( conn, "drop table " + tableName );
-
-			ps.execute();
-		}
-		catch (SQLException e) {}
-
-		close( ps );
-	}
 
 	//
 	// Logic for stuffing a data value into a column, given its type.
@@ -716,76 +1257,75 @@
 	{
 		int		jdbcType = type.getJdbcType();
 
-		if ( value == null )
+		if ( value != null )
+		{
+			setParameter( ps, param, jdbcType, value );
+			return;
+		}
+		else if ( clientSupports( type ) )
 		{
 			ps.setNull( param, jdbcType );
 
 			return;
 		}
 
+		// client does not support nulls of this type.
+
 		switch( jdbcType )
 		{
-		    case Types.BIGINT:
-				ps.setLong( param, ((Long) value ).longValue() );
-				break;
-				
-		    case Types.BLOB:
-				ps.setBlob( param, ((Blob) value ) );
-				break;
-				
-		    case Types.CHAR:
-		    case Types.LONGVARCHAR:
-		    case Types.VARCHAR:
-				ps.setString( param, ((String) value ) );
-				break;
-				
-		    case Types.BINARY:
-		    case Types.LONGVARBINARY:
-		    case Types.VARBINARY:
-				ps.setBytes( param, (byte[]) value );
-				break;
-				
-		    case Types.CLOB:
-				ps.setClob( param, ((Clob) value ) );
-				break;
-				
-		    case Types.DATE:
-				ps.setDate( param, ((java.sql.Date) value ) );
-				break;
-				
-		    case Types.DECIMAL:
-		    case Types.NUMERIC:
-				ps.setBigDecimal( param, ((BigDecimal) value ) );
-				break;
-				
-		    case Types.DOUBLE:
-				ps.setDouble( param, ((Double) value ).doubleValue() );
-				break;
-				
-		    case Types.REAL:
-				ps.setFloat( param, ((Float) value ).floatValue() );
-				break;
-				
-		    case Types.INTEGER:
-				ps.setInt( param, ((Integer) value ).intValue() );
-				break;
-				
-		    case Types.SMALLINT:
-				ps.setShort( param, ((Short) value ).shortValue() );
-				break;
-				
-		    case Types.TIME:
-				ps.setTime( param, (Time) value );
-				break;
-				
-		    case Types.TIMESTAMP:
-				ps.setTimestamp( param, (Timestamp) value );
+		    case JDBC_BOOLEAN:
+				ps.setNull( param, Types.SMALLINT );
 				break;
 				
 		    default:
-				fail( "Unknown jdbc type for Derby type: " + type.getDerbyTypeName() );
+				fail( "Unsupported Derby type: " + type.getDerbyTypeName() );
 				break;
+		}		
+	}
+
+	//
+	// Logic for verifying that a value was stuffed correctly.
+	//
+	private	void	checkParameter( ResultSet rs, int param, Object value )
+		throws Exception
+	{
+		Object	   	actualValue;
+
+		if ( value == null )
+		{
+			return;
+		}
+
+		println( "Checking " + value.getClass().getName() );
+
+		if ( value instanceof Boolean ) {  actualValue = new Boolean( rs.getBoolean( param ) ); }
+		else if ( value instanceof Byte ) { actualValue = new Byte( rs.getByte( param ) ); }
+		else if ( value instanceof Short ) { actualValue = new Short( rs.getShort( param ) ); }
+		else if ( value instanceof Integer ) { actualValue = new Integer( rs.getInt( param ) ); }
+		else if ( value instanceof Long ) { actualValue = new Long( rs.getLong( param ) ); }
+		else if ( value instanceof Float ) { actualValue = new Float( rs.getFloat( param ) ); }
+		else if ( value instanceof Double ) { actualValue = new Double( rs.getDouble( param ) ); }
+		else if ( value instanceof String ) { actualValue = rs.getString( param ); }
+		else if ( value instanceof BigDecimal ) { actualValue = rs.getBigDecimal( param ); }
+		else
+		{
+			actualValue = rs.getObject( param );
 		}
+
+		assertTrue( value.equals( actualValue ) );
+	}
+
+
+	// return true if the client supports this datatype
+	private	boolean	clientSupports( TypeDescriptor type )
+	{
+		Version		firstSupportedVersion;
+
+		if ( usingDB2Client() ) { firstSupportedVersion = type.getDb2jccVersion(); }
+		else { firstSupportedVersion = type.getDerbyVersion(); }
+
+		if ( firstSupportedVersion == null ) { return false; }
+		else { return getDriverVersion().atLeast( firstSupportedVersion ); }
 	}
 	
 	//
@@ -798,111 +1338,22 @@
 
 		return getColumn( rs, columnName, jdbcType );
 	}
-	private	Object	getColumn( ResultSet rs, String columnName, int jdbcType )
+	//
+	// Get a data value from a procedure's output arg, given its type.
+	//
+	private	Object	getOutArg( CallableStatement cs, int arg, TypeDescriptor type )
 		throws Exception
 	{
-		Object		retval = null;
-
-		switch( jdbcType )
-		{
-		    case Types.BIGINT:
-				retval = new Long( rs.getLong( columnName ) );
-				break;
-				
-		    case Types.BLOB:
-				retval = rs.getBlob( columnName );
-				break;
-				
-		    case Types.CHAR:
-		    case Types.LONGVARCHAR:
-		    case Types.VARCHAR:
-				retval = rs.getString( columnName );
-				break;
-				
-		    case Types.BINARY:
-		    case Types.LONGVARBINARY:
-		    case Types.VARBINARY:
-				retval = rs.getBytes( columnName );
-				break;
-				
-		    case Types.CLOB:
-				retval = rs.getClob( columnName );
-				break;
-				
-		    case Types.DATE:
-				retval = rs.getDate( columnName );
-				break;
-				
-		    case Types.DECIMAL:
-		    case Types.NUMERIC:
-				retval = rs.getBigDecimal( columnName );
-				break;
-				
-		    case Types.DOUBLE:
-				retval = new Double( rs.getDouble( columnName ) );
-				break;
-				
-		    case Types.REAL:
-				retval = new Float( rs.getFloat( columnName ) );
-				break;
-				
-		    case Types.INTEGER:
-				retval = new Integer( rs.getInt( columnName ) );
-				break;
-				
-		    case Types.SMALLINT:
-				retval = new Short( rs.getShort( columnName ) );
-				break;
-				
-		    case Types.TIME:
-				retval = rs.getTime( columnName );
-				break;
-				
-		    case Types.TIMESTAMP:
-				retval = rs.getTimestamp( columnName );
-				break;
-				
-		    default:
-				fail( "Unknown jdbc type " + jdbcType + " used to retrieve column: " + columnName );
-				break;
-		}
-
-		if ( rs.wasNull() ) { retval = null; }
+		int			jdbcType = type.getJdbcType();
 
-		return retval;
+		return getOutArg( cs, arg, jdbcType );
 	}
-
 	//
 	// SQL code generation minions 
 	//
 	private	String	doubleQuote( String text )
 	{
 		return '"' + text + '"';
-	}
-
-	//
-	// Swallow uninteresting exceptions when disposing of jdbc objects.
-	//
-	private	void	close( ResultSet rs )
-	{
-		try {
-			if ( rs != null ) { rs.close(); }
-		}
-		catch (SQLException e) {}
-	}	
-	private	void	close( Statement statement )
-	{
-		try {
-			if ( statement != null ) { statement.close(); }
-		}
-		catch (SQLException e) {}
-	}
-	private	void	close( Connection conn )
-	{
-		try {
-			if ( conn != null ) { conn.close(); }
-		}
-		catch (SQLException e) {}
 	}
 
 	/////////////////////////////////////////////////////////////

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/testScript.xml Tue Dec 20 16:53:42 2005
@@ -46,7 +46,7 @@
 
 	The basic loop runs as follows:
 
-		run compatibility tests against current embedded server in default VM
+		run compatibility tests against current embedded server in all VMs.
 
 		for each server VM
 		{
@@ -84,16 +84,18 @@
   <property name="summaryFile" value="${outDir}/SUMMARY_COMPAT.txt"/>
   <property name="databaseName" value="compatDB"/>
 
+  <property name="TEST_JARS" value="${trunk_lib}/derbyTesting.jar;${junit}"/>
+
   <!-- legal values of serverVM and clientVM -->
   <property name="VM_1.3" value="${j13lib}/../bin/java"/>
   <property name="VM_1.4" value="${j14lib}/../bin/java"/>
   <property name="VM_1.5" value="${jdk15}/bin/java"/>
 
   <!-- legal values of serverClasspath -->
-  <property name="SERVER_10.0.2.1" value="${10.0.2.1_lib}/derby.jar;${10.0.2.1_lib}/derbynet.jar"/>
-  <property name="SERVER_10.1.1.0" value="${10.1.1.0_lib}/derby.jar;${10.1.1.0_lib}/derbynet.jar"/>
-  <property name="SERVER_10.1.2.0" value="${10.1.2.0_lib}/derby.jar;${10.1.2.0_lib}/derbynet.jar"/>
-  <property name="SERVER_TRUNK" value="${trunk_lib}/derby.jar;${trunk_lib}/derbynet.jar"/>
+  <property name="SERVER_10.0.2.1" value="${10.0.2.1_lib}/derby.jar;${10.0.2.1_lib}/derbynet.jar;${TEST_JARS}"/>
+  <property name="SERVER_10.1.1.0" value="${10.1.1.0_lib}/derby.jar;${10.1.1.0_lib}/derbynet.jar;${TEST_JARS}"/>
+  <property name="SERVER_10.1.2.0" value="${10.1.2.0_lib}/derby.jar;${10.1.2.0_lib}/derbynet.jar;${TEST_JARS}"/>
+  <property name="SERVER_TRUNK" value="${trunk_lib}/derby.jar;${trunk_lib}/derbynet.jar;${TEST_JARS}"/>
 
   <!-- legal values of clientClasspath -->
   <property name="CLIENT_DB2JCC" value="${db2jcc_lib}/db2jcc.jar;${db2jcc_lib}/db2jcc_license_c.jar"/>
@@ -101,8 +103,7 @@
   <property name="CLIENT_10.1.2.0" value="${10.1.2.0_lib}/derbyclient.jar"/>
   <property name="CLIENT_TRUNK" value="${trunk_lib}/derbyclient.jar"/>
 
-  <property name="TEST_JARS" value="${trunk_lib}/derbyTesting.jar;${junit}"/>
-  <property name="FULL_TRUNK" value="${SERVER_TRUNK};${CLIENT_TRUNK};${TEST_JARS}"/>
+  <property name="FULL_TRUNK" value="${SERVER_TRUNK};${CLIENT_TRUNK}"/>
 
   <property name="CLASSPATH_TRUNK" value="${basedir}/classes;${compile.classpath}"/>
 
@@ -225,13 +226,19 @@
 	  <param name="codeline" value="${SERVER_TRUNK}"/>
     </antcall>
 
-    <antcall target="_oneTest">
-	  <param name="otTestName" value="${JDBC_SUITE}"/>
+    <antcall target="_forEmbeddedVM">
+	  <param name="eVM" value="${VM_1.3}"/>
+	  <param name="eName" value="VM-1.3"/>
+    </antcall>
 
-	  <param name="otClasspath" value="${SERVER_TRUNK}"/>
-	  <param name="otOutfile" value="embedded"/>
-	  <param name="otVM" value="${VM_DEFAULT}"/>
-	  <param name="otClientName" value="${EMBEDDED_CLIENT}"/>
+    <antcall target="_forEmbeddedVM">
+	  <param name="eVM" value="${VM_1.4}"/>
+	  <param name="eName" value="VM-1.4"/>
+    </antcall>
+
+    <antcall target="_forEmbeddedVM">
+	  <param name="eVM" value="${VM_1.5}"/>
+	  <param name="eName" value="VM-1.5"/>
     </antcall>
 
   </target>
@@ -243,6 +250,25 @@
 !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 -->
+
+  <!--
+       Run embedded tests for a given server VM.
+
+       eVM             VM to run server in
+       eName           Human-readable name for VM.
+  -->
+  <target name="_forEmbeddedVM">
+
+    <antcall target="_oneTest">
+	  <param name="otTestName" value="${JDBC_SUITE}"/>
+
+	  <param name="otClasspath" value="${SERVER_TRUNK}"/>
+	  <param name="otOutfile" value="embedded_${eName}"/>
+	  <param name="otVM" value="${eVM}"/>
+	  <param name="otClientName" value="${EMBEDDED_CLIENT}"/>
+    </antcall>
+
+  </target>
 
   <!--
        Run tests for a given server VM.

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java?rev=358163&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java Tue Dec 20 16:53:42 2005
@@ -0,0 +1,599 @@
+/*
+
+   Derby - Class org.apache.derbyTesting.functionTests.tests.junitTests.lang.BooleanTest
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+/**
+ * <p>
+ * This JUnit test verifies behavior of the BOOLEAN datatype.
+ * </p>
+ *
+ * @author Rick
+ */
+
+package org.apache.derbyTesting.functionTests.tests.junitTests.lang;
+
+import java.math.*;
+import java.sql.*;
+import java.util.*;
+
+import junit.framework.*;
+
+import org.apache.derbyTesting.functionTests.util.DerbyJUnitTest;
+
+public	class	BooleanTest	extends	DerbyJUnitTest
+{
+	/////////////////////////////////////////////////////////////
+	//
+	//	CONSTANTS
+	//
+	/////////////////////////////////////////////////////////////
+
+	private	static	final	String	BOOLEAN_TABLE = "BOOLCOL_499";
+	private	static	final	String	CASTING_TABLE = "BOOLEANCASTS";
+
+	private	static	final	Boolean	TRUE = Boolean.TRUE;
+	private	static	final	Boolean	FALSE = Boolean.FALSE;
+
+	private	static	final	String	NEGATE_BOOLEAN_FUNC = "negateBooleanFunc";
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	STATE
+	//
+	/////////////////////////////////////////////////////////////
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	CONSTRUCTOR
+	//
+	/////////////////////////////////////////////////////////////
+	
+	public	BooleanTest() {}
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	DATABASE FUNCTIONS
+	//
+	/////////////////////////////////////////////////////////////
+
+	public	static	Boolean	negateBooleanFunc( Boolean inValue )
+		throws Exception
+	{
+		return new Boolean( !inValue.booleanValue() );
+	}
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	ENTRY POINT
+	//
+	/////////////////////////////////////////////////////////////
+
+	/**
+	 * <p>
+	 * Entry point for running this suite standalone.
+	 * </p>
+	 */
+	public static void main( String args[] )
+		throws Exception
+	{
+		runUnderOldHarness( args, suite() );
+	}
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	JUnit BEHAVIOR
+	//
+	/////////////////////////////////////////////////////////////
+
+	/**
+	 * <p>
+	 * JUnit boilerplate which adds as test cases all public methods
+	 * whose names start with the string "test" in the named classes.
+	 * When you want to add a new class of tests, just wire it into
+	 * this suite.
+	 * </p>
+	 */
+	public static Test suite()
+	{
+		TestSuite	testSuite = new TestSuite();
+
+		testSuite.addTestSuite( BooleanTest.class );
+
+		return testSuite;
+	}
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	TEST ENTRY POINTS
+	//
+	/////////////////////////////////////////////////////////////
+
+	/**
+	 * <p>
+	 * Tests for the BOOLEAN datatype.
+	 * </p>
+	 */
+	public	void	testBoolean()
+		throws Exception
+	{
+		//setDebug( true );
+		
+		Connection	conn = getConnection();
+
+		createSchema( conn );
+		populateTables( conn );
+		verifyCatalogs( conn );
+		verifySort( conn );
+
+		// now verify casts
+		truncateTable( conn, BOOLEAN_TABLE );
+		castFromBoolean( conn );
+		castToBoolean( conn );
+		implicitCasts( conn );
+
+		verifyBooleanInSelect( conn );
+		verifyBooleanInValuesClause( conn );
+	}
+
+	// create schema for this test
+	private	void	createSchema( Connection conn )
+		throws Exception
+	{
+		dropTable( conn, BOOLEAN_TABLE );
+		dropTable( conn, CASTING_TABLE );
+		dropFunction( conn, NEGATE_BOOLEAN_FUNC );
+		executeDDL
+			(
+			 conn,
+			 "create table " + BOOLEAN_TABLE + "( keyCol int, booleanCol boolean )"
+			);
+		// verify that you can create an index on BOOLEAN columns
+		executeDDL
+			(
+			 conn,
+			 "create index boolIdx on " + BOOLEAN_TABLE + "( booleanCol )"
+			);
+
+		executeDDL
+			(
+			 conn,
+			 "create table " + CASTING_TABLE +
+			 "(\n" +
+			 "keyCol               int,\n" +
+			 "\n" +
+			 "smallintCol          smallint,\n" +
+			 "integerCol           integer,\n" +
+			 "bigintCol            bigint,\n" +
+			 "\n" +
+			 "decimalCol           decimal,\n" +
+			 "realCol              real,\n" +
+			 "doubleCol            double,\n" +
+			 "floatCol             float,\n" +
+			 "\n" +
+			 "charCol              char(5),\n" +
+			 "varcharCol           varchar(5),\n" +
+			 "longvarcharCol       long varchar,\n" +
+			 "\n" +
+			 "charforbitdataCol    char(5) for bit data,\n" +
+			 "varcharforbitdataCol varchar(5) for bit data,\n" +
+			 "\n" +
+			 "clobCol              clob,\n" +
+			 "blobCol              blob,\n" +
+			 "\n" +
+			 "dateCol              date,\n" +
+			 "timeCol              time,\n" +
+			 "timestampCol         timestamp\n" +
+			 ")"
+			 );
+
+		executeDDL
+			(
+			 conn,
+			 "create function " + NEGATE_BOOLEAN_FUNC +
+			 "( inValue boolean ) returns boolean\n" +
+			 "parameter style java no sql language java external name\n" +
+			 "'" + getClass().getName() + "." + NEGATE_BOOLEAN_FUNC + "'"
+			 );
+	}
+
+	// populate tables for this test
+	private	void	populateTables( Connection conn )
+		throws Exception
+	{
+		execute
+			(
+			 conn,
+			 "insert into " + BOOLEAN_TABLE +
+			 "( keyCol, booleanCol ) values\n" +
+			 "( 1, true ), ( 2, false ),\n" +
+			 "( 3, true ), ( 4, false ),\n" +
+			 "( 5, true ), ( 6, false ),\n" +
+			 "( 7, true ), ( 8, false ),\n" +
+			 "( 9, null ), ( 10, unknown )"
+			 );
+
+		// the first tuple contains values which cast to true,
+		// the second tuple contains values which cast to false,
+		// the third tuple contains values which cast to null
+		execute
+			(
+			 conn,
+			 "insert into " + CASTING_TABLE +
+			 " values\n" +
+			 "(\n" +
+			 "1,\n" +
+			 "\n" +
+			 "1,\n" +
+			 "1,\n" +
+			 "1,\n" +
+			 "\n" +
+			 "1.0,\n" +
+			 "1.0,\n" +
+			 "1.0,\n" +
+			 "1.0,\n" +
+			 "\n" +
+			 "'true',\n" +
+			 "'true',\n" +
+			 "'true',\n" +
+			 "\n" +
+			 "X'0001',\n" +
+			 "X'0001',\n" +
+			 "\n" +
+			 "cast('true' as clob),\n" +
+			 "cast(X'0001' as blob),\n" +
+			 "\n" +
+			 "date('1992-01-01'),\n" +
+			 "time('09:30:15'),\n" +
+			 "timestamp('1997-06-30 01:01:01')\n" +
+			 "),\n" +
+			 "(\n" +
+			 "2,\n" +
+			 "\n" +
+			 "0,\n" +
+			 "0,\n" +
+			 "0,\n" +
+			 "\n" +
+			 "0.0,\n" +
+			 "0.0,\n" +
+			 "0.0,\n" +
+			 "0.0,\n" +
+			 "\n" +
+			 "'false',\n" +
+			 "'false',\n" +
+			 "'false',\n" +
+			 "\n" +
+			 "X'0000',\n" +
+			 "X'0000',\n" +
+			 "\n" +
+			 "cast('false' as clob),\n" +
+			 "cast(X'0000' as blob),\n" +
+			 "\n" +
+			 "date('1992-01-01'),\n" +
+			 "time('09:30:15'),\n" +
+			 "timestamp('1997-06-30 01:01:01')\n" +
+			 "),\n" +
+			 "(\n" +
+			 "3,\n" +
+			 "\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "\n" +
+			 "null,\n" +
+			 "null,\n" +
+			 "null\n" +
+			 ")"
+			 );
+	}
+	
+	// verify that the boolean column is correctly typed in the catalogs
+	private	void	verifyCatalogs( Connection conn )
+		throws Exception
+	{
+		assertScalar
+			(
+			 conn,
+			 
+			 "select c.columndatatype\n" +
+			 "from sys.syscolumns c, sys.systables t\n" +
+			 "where t.tablename = " + singleQuote( BOOLEAN_TABLE ) + "\n" +
+			 "and c.referenceid = t.tableid\n" +
+			 "and c.columnname='BOOLEANCOL'",
+
+			 "BOOLEAN"
+			 );
+	}
+	
+	// verify that nulls sort before false which sorts before true
+		// create schema for this test
+	private	void	verifySort( Connection conn )
+		throws Exception
+	{
+		PreparedStatement	ps = prepare
+			(
+			 conn,
+			 "select booleanCol from " + BOOLEAN_TABLE + " order by booleanCol"
+			 );
+		ResultSet			rs = ps.executeQuery();
+
+		// 2 nulls, 4 falses, 4 trues
+		assertColumnEquals
+			(
+			 rs,
+			 1,
+			 new Object[]
+				{
+					null, null,
+					FALSE, FALSE, FALSE, FALSE,
+					TRUE, TRUE, TRUE, TRUE
+				}
+			 );
+
+		close( rs );
+		close( ps );		
+	}
+	
+	// verify casts from BOOLEAN to legal types
+	private	void	castFromBoolean( Connection conn )
+		throws Exception
+	{
+		execute
+			(
+			 conn,
+			 "insert into " + BOOLEAN_TABLE +
+			 "( keyCol, booleanCol ) values\n" +
+			 "( 1, true ), ( 2, false ), ( 3, null )"
+			 );
+
+		PreparedStatement	ps = prepare
+			(
+			 conn,
+			 "select\n" +
+			 "keyCol\n" +
+			 ", cast ( booleanCol as smallint )\n" +
+			 ", cast ( booleanCol as integer )\n" +
+			 ", cast ( booleanCol as bigint )\n" +
+			 ",cast ( booleanCol as decimal )\n" +
+			 ",cast ( booleanCol as real )\n" +
+			 ",cast ( booleanCol as double )\n" +
+			 ",cast ( booleanCol as float )\n" +
+			 ",cast ( booleanCol as char(5) )\n" +
+			 ",cast ( booleanCol as varchar(5) )\n" +
+			 ",cast ( booleanCol as long varchar )\n" +
+			 ",cast ( booleanCol as clob )\n" +
+			 "from " + BOOLEAN_TABLE + " order by keyCol"
+			 );
+		ResultSet			rs = ps.executeQuery();
+
+		rs.next();
+		assertRow
+			(
+			 rs,
+			 new Object[]
+				{
+					new Integer( 1 ),
+					new Integer( 1 ),
+					new Integer( 1 ),
+					new Long( 1L ),
+					new BigDecimal( 1.0 ),
+					new Float( 1.0 ),
+					new Double( 1.0 ),
+					new Float( 1.0 ),
+					"true ",
+					"true",
+					"true",
+					"true",
+				}
+			 );
+
+		rs.next();
+		assertRow
+			(
+			 rs,
+			 new Object[]
+				{
+					new Integer( 2 ),
+					new Integer( 0 ),
+					new Integer( 0 ),
+					new Long( 0L ),
+					new BigDecimal( 0.0 ),
+					new Float( 0.0 ),
+					new Double( 0.0 ),
+					new Float( 0.0 ),
+					"false",
+					"false",
+					"false",
+					"false",
+				}
+			 );
+
+		rs.next();
+		assertRow
+			(
+			 rs,
+			 new Object[]
+				{
+					new Integer( 3 ),
+					null,
+					null,
+					null,
+					null,
+					null,
+					null,
+					null,
+					null,
+					null,
+					null,
+					null,
+				}
+			 );
+
+		close( rs );
+		close( ps );			 
+	}
+
+	// verify casts to BOOLEAN from legal types
+	private	void	castToBoolean( Connection conn )
+		throws Exception
+	{
+		PreparedStatement	ps = prepare
+			(
+			 conn,
+			 "select\n" +
+			 "keyCol\n" +
+			 ", cast (smallintcol as boolean)\n" +
+			 ", cast (integercol as boolean)\n" +
+			 ", cast (bigintcol as boolean)\n" +
+			 ", cast (decimalcol as boolean)\n" +
+			 ", cast (realcol as boolean)\n" +
+			 ", cast (doublecol as boolean)\n" +
+			 ", cast (floatcol as boolean)\n" +
+			 ", cast (charcol as boolean)\n" +
+			 ", cast (varcharcol as boolean)\n" +
+			 "from " + CASTING_TABLE + " order by keyCol\n"
+			 );
+		ResultSet			rs = ps.executeQuery();
+
+		rs.next();
+		verifyCasts( rs, 2, 10, TRUE );
+		rs.next();
+		verifyCasts( rs, 2, 10, FALSE );
+		rs.next();
+		verifyCasts( rs, 2, 10, null );
+
+		close( rs );
+		close( ps );			 
+	}
+
+	// verify that the language adds the correct implicit casts
+	private	void	implicitCasts( Connection conn )
+		throws Exception
+	{
+		int	base = 100;
+		
+		base = verifyImplicitCast( conn, "smallintCol", base );
+		base = verifyImplicitCast( conn, "integerCol", base );
+		base = verifyImplicitCast( conn, "bigintCol", base );
+		base = verifyImplicitCast( conn, "decimalCol", base );
+		base = verifyImplicitCast( conn, "realCol", base );
+		base = verifyImplicitCast( conn, "doubleCol", base );
+		base = verifyImplicitCast( conn, "floatCol", base );
+		base = verifyImplicitCast( conn, "charCol", base );
+		base = verifyImplicitCast( conn, "varcharCol", base );
+		base = verifyImplicitCast( conn, "longvarcharCol", base );
+
+		//
+		// If we try to implicitly cast from clob to boolean, we
+		// get the following error:
+		//
+		// ERROR 22005: An attempt was made to get a data value of type 'boolean' from a data value of type 'CLOB'.
+	}
+	//
+	// Test a single implicit cast. Increment the base for the next round.
+	//
+	private	int	verifyImplicitCast( Connection conn, String colName, int base )
+		throws Exception
+	{
+		execute
+			(
+			 conn,
+			 "insert into " + BOOLEAN_TABLE +
+			 "( keyCol, booleanCol )\n" +
+			 "select keyCol + " + base + ", " + colName + "\n" +
+			 "from " + CASTING_TABLE
+			 );
+		PreparedStatement	ps = prepare
+			(
+			 conn,
+			 "select keyCol, booleanCol from " + BOOLEAN_TABLE + " where keyCol > " + base + "\n" +
+			 "order by keyCol\n"
+			 );
+		ResultSet			rs = ps.executeQuery();
+
+		assertColumnEquals( rs, 2, new Object[] { TRUE, FALSE, null } );
+
+		close( rs );
+		close( ps );			 
+
+		return base + 100;
+	}
+	
+	private	void	verifyCasts
+		( ResultSet rs, int firstColumn, int lastColumn, Boolean expectedValue )
+		throws Exception
+	{
+		for ( int columnNumber = firstColumn; columnNumber <= lastColumn; columnNumber++ )
+		{
+			assertColumnEquals( "Column number " + columnNumber, rs, columnNumber, expectedValue );
+		}
+	}
+	
+	// verify that we can select an expression which evaluates to a boolean value
+	private	void	verifyBooleanInSelect( Connection conn )
+		throws Exception
+	{
+		PreparedStatement	ps = prepare
+			(
+			 conn,
+			 "select (booleanCol > booleanCol) from " + BOOLEAN_TABLE
+			 );
+		ResultSet			rs = ps.executeQuery();
+
+		while( rs.next() )
+		{
+			assertFalse( rs.getBoolean( 1 ) );
+		}
+
+		close( rs );
+		close( ps );			 
+	}
+
+	// verify that we can use a boolean expression in a values clause
+	private	void	verifyBooleanInValuesClause( Connection conn )
+		throws Exception
+	{
+		assertScalar
+			(
+			 conn,
+			 "values " + NEGATE_BOOLEAN_FUNC + "( true )",
+			 FALSE
+			 );
+		assertScalar
+			(
+			 conn,
+			 "values " + NEGATE_BOOLEAN_FUNC + "( (current_date > '1994-02-23') )",
+			 FALSE
+			 );
+	}
+
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java?rev=358163&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java Tue Dec 20 16:53:42 2005
@@ -0,0 +1,94 @@
+/*
+
+   Derby - Class org.apache.derbyTesting.functionTests.tests.junitTests.lang.LangSuite
+
+   Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+/**
+ * <p>
+ * A suite for running language layer junit tests.
+ * </p>
+ */
+
+package org.apache.derbyTesting.functionTests.tests.junitTests.lang;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+
+import junit.framework.*;
+
+import org.apache.derbyTesting.functionTests.util.DerbyJUnitTest;
+
+public	class	LangSuite	extends	DerbyJUnitTest
+{
+	/////////////////////////////////////////////////////////////
+	//
+	//	CONSTANTS
+	//
+	/////////////////////////////////////////////////////////////
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	STATE
+	//
+	/////////////////////////////////////////////////////////////
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	JUnit BEHAVIOR
+	//
+	/////////////////////////////////////////////////////////////
+
+	/**
+	 * <p>
+	 * JUnit boilerplate which adds as test cases all public methods
+	 * whose names start with the string "test" in the named classes.
+	 * When you want to add a new class of tests, just wire it into
+	 * this suite.
+	 * </p>
+	 */
+	public static Test suite()
+	{
+		TestSuite	testSuite = new TestSuite();
+
+		testSuite.addTestSuite( BooleanTest.class );
+
+		return testSuite;
+	}
+
+	/////////////////////////////////////////////////////////////
+	//
+	//	ENTRY POINT
+	//
+	/////////////////////////////////////////////////////////////
+
+	/**
+	 * <p>
+	 * Entry point for running this suite inside the old-fashioned
+	 * test harness.
+	 * </p>
+	 */
+	public static void main( String args[] )
+		throws Exception
+	{
+		runUnderOldHarness( args, suite() );
+	}
+
+
+
+}
+

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml?rev=358163&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml Tue Dec 20 16:53:42 2005
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+
+<!-- ==================================================================== -->
+<!--                       Derby build file                          -->
+<!-- ==================================================================== -->
+
+<project default="FTOtestsubdir" basedir="../../../../../../../../.." >
+
+  <!-- User settings -->
+  <property file="${user.home}/ant.properties"/>
+
+  <!-- Set property lib dir -->
+  <property name="properties.dir" value="tools/ant/properties" />
+
+  <!-- Significant dirs -->
+  <property file="${properties.dir}/dirs.properties"/>
+  <property file="${properties.dir}/derbytesting.properties"/>
+
+  <!-- Compiler settings -->
+  <property file="${properties.dir}/sane${sanity}.properties"/>
+  <property file="${properties.dir}/defaultcompiler.properties"/>
+  <property file="${properties.dir}/${build.compiler}.properties"/>
+
+  <!-- Parser properties -->
+  <!--property file="${properties.dir}/parser.properties"/-->
+
+  <!-- Compile-time classpath properties files -->
+  <property file="${properties.dir}/extrapath.properties"/>
+  <property file="${properties.dir}/compilepath.properties"/>
+
+  <!-- Release and Version info -->
+  <property file="${properties.dir}/release.properties"/>
+
+  <!-- derby testing specific properties files -->
+  <property file="${ant.home}/properties/derbytesting.properties"/>
+  <property file="${user.home}/properties/derbytesting.properties"/>
+  <property name="this.dir" value="${derby.testing.functest.dir}/tests/junitTests/lang"/>
+
+<!--             ============ Begin Targets ==============                -->
+ 
+  <target name="FTOtestsubdir" depends="compilex,copyfiles"/>
+
+  <target name="compilex">
+    <javac
+      bootclasspath="${empty}"
+      nowarn="on"
+      debug="${debug}"
+      depend="${depend}"
+      deprecation="${deprecation}"
+      optimize="${optimize}"
+      proceed="${proceed}"
+      verbose="${verbose}" 
+      srcdir="${derby.testing.src.dir}"
+      destdir="${out.dir}">
+      <classpath>
+        <pathelement path="${java13compile.classpath}"/>
+		<pathelement path="${junit}"/>
+      </classpath>
+      <include name="${this.dir}/*.java"/>
+    </javac>
+  </target>
+
+  <target name="copyfiles">
+    <copy todir="${out.dir}/${derby.testing.functest.dir}/tests/junitTests/lang">
+      <fileset dir="${derby.testing.src.dir}/${this.dir}" 
+        includes="*_app.properties"/>  
+    </copy>
+  </target> 
+
+<!--             ============= End Targets ==============                -->
+
+<!--             ============= End Project ==============                -->
+
+</project>

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties?rev=358163&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties Tue Dec 20 16:53:42 2005
@@ -0,0 +1,28 @@
+#
+# This is the default system properties file for Language JUnit tests.
+#
+# *** DO NOT PUT PROPERTIES FOR THE DERBY SYSTEM IN THIS FILE.  
+# *** THEY BELONG IN default_derby.properties.
+#
+# This file will get handed to the test on the command line in a -p <filename>
+# argument.
+#
+# This causes ij to load the driver and make an
+# initial connection to the database.
+#
+# The .java test has to call util.getPropertyArg and util.startJBMS
+# to process the property file.  See any of the .java tests for this code.
+#
+# If you want to alter these to use a different driver, connect to a different
+# database, or to not be used, override this file by creating
+# a file <testname>_app.properties to be used instead of this file.
+#
+#
+noSecurityManager=true
+
+ij.database=jdbc:derby:wombat;create=true
+ij.protocol=jdbc:derby:
+
+ij.defaultResourcePackage=/org/apache/derbyTesting/functionTests/tests/junitTests/lang/
+ij.showNoConnectionsAtStart=true
+ij.showNoCountForSelect=true

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/aggregate.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/aggregate.sql?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/aggregate.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/aggregate.sql Tue Dec 20 16:53:42 2005
@@ -86,7 +86,6 @@
 select count(cast (null as int)) from t1 group by c1;
 
 -- binary list operator
--- beetle 5571 - transient boolean type not allowed in DB2
 select (1 in (1,2)), count(c1) from t1 group by c1;
 select count((1 in (1,2))) from t1 group by c1;
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql Tue Dec 20 16:53:42 2005
@@ -99,7 +99,6 @@
 drop schema "sysok" restrict;
 
 -- data types not supported
-create table NOTYPE(i int, b BOOLEAN);
 create table NOTYPE(i int, b TINYINT);
 create table NOTYPE(i int, b java.lang.String);
 create table NOTYPE(i int, b com.acme.Address);
@@ -307,7 +306,6 @@
 
 -- INSTANCEOF in where clause of select, delete, update,
 -- beetle 5224
-create table t1 (i int, s smallint, c10 char(10), vc30 varchar(30), b boolean);
 create table mm (x org.apache.derbyTesting.functionTests.util.ManyMethods);
 create table sc (x org.apache.derbyTesting.functionTests.util.SubClass);
 select i from t1 where i instanceof java.lang.Integer;
@@ -336,8 +334,6 @@
 -- beetle 5233
 create table testtype1(col1 bit);
 create table testtype2(col1 bit varying(10));
--- boolean datatype already disabled
-create table testtype3(col1 boolean);
 create table testtype4(col1 LONG NVARCHAR);
 create table testtype5(col1 LONG VARBINARY);
 create table testtype6(col1 LONG BIT VARYING);
@@ -616,18 +612,6 @@
 
 -- (4) USING should be disabled in INNER JOIN of SELECT statement
 SELECT * FROM t1 RIGHT OUTER JOIN t2 USING (col1);
-
--- (5) TRUE and FALSE constants should be disabled in WHERE clause of SELECT statement
-SELECT * FROM t1 INNER JOIN t2 ON t1.col1 = t2.col1 WHERE true;
-SELECT * FROM t1 INNER JOIN t2 ON t1.col1 = t2.col1 WHERE false;
-
--- (5) TRUE and FALSE constants should be disabled in WHERE clause of DELETE statement
-DELETE FROM t1 where true;
-DELETE FROM t1 where false;
-
--- (5) TRUE and FALSE constants should be disabled in WHERE clause of DELETE statement
-UPDATE t2 SET col1 = NULL WHERE true;
-UPDATE t2 SET col1 = NULL WHERE false;
 
 -- (6) AT ISOLATION clause should be disabled in SELECT statement
 -- AT ISOLATION not supported in both Cloudscape and DB2 mode and that is why rather than getting feature not implemented, we will get syntax error

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/logop.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/logop.sql?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/logop.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/logop.sql Tue Dec 20 16:53:42 2005
@@ -156,14 +156,13 @@
 select x from s where not ( ( (1 = 1) or (2 = 2) ) and (3 = 4) );
 select x from s where (1 = 2) and not ( (3 = 3) or (4 = 4) );
 select x from s where not ( (1 = 2) and ( (3 = 3) or (4 = 4) ) );
--- following NOTs in select clause won't work because it results in a transient boolean datatype
-select not ( (1 = 1) or (2 = 2) ) and (3 = 4) from s;
+select ( not ( (1 = 1) or (2 = 2) ) and (3 = 4) ) from s;
 --
-select not ( ( (1 = 1) or (2 = 2) ) and (3 = 4) ) from s;
+select ( not ( ( (1 = 1) or (2 = 2) ) and (3 = 4) ) ) from s;
 --
-select (1 = 2) and not ( (3 = 3) or (4 = 4) ) from s;
+select ( (1 = 2) and not ( (3 = 3) or (4 = 4) ) ) from s;
 --
-select not ( (1 = 2) and ( (3 = 3) or (4 = 4) ) ) from s;
+select ( not ( (1 = 2) and ( (3 = 3) or (4 = 4) ) ) ) from s;
 
 -- Ands under ands under ands ...
 select * from s where not (	( ( ((1=1) and (1=1)) and ((1=1) and (1=1)) ) and

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/schemas.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/schemas.sql?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/schemas.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/schemas.sql Tue Dec 20 16:53:42 2005
@@ -430,11 +430,13 @@
 where i = (select i from test.t t2 where s = (select i from test.t t3 where s = 2));
 -- correlated subqueries
 
--- negative tests
-
--- exists disallowed in select clause
 select (exists (select * from test.ttt 
-				where iii = (select 11 from test.tt where ii = i and ii <> 1)) ) from test.s;
+				where iii = (select 11 from test.tt where ii = i and ii <> 1)) )
+a
+from test.s
+order by a;
+
+-- negative tests
 
 -- multiple matches at parent level
 select * from test.s, test.t where exists (select i from test.tt);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql?rev=358163&r1=358162&r2=358163&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql Tue Dec 20 16:53:42 2005
@@ -218,9 +218,9 @@
 select * from s where (i in (select i from t where i = 0)) is null;
 
 -- select list
-select i in (select i from t) from s;
-select i in (select i from t where 1 = 0) from s;
-select (i in (select i from t where 1 = 0)) is null from s;
+select ( i in (select i from t) ) a from s order by a;
+select ( i in (select i from t where 1 = 0) ) a from s order by a;
+select ( (i in (select i from t where 1 = 0)) is null ) a from s order by a;
 
 -- subquery under an or
 select i from s where i = -1 or i in (select i from t);



Mime
View raw message