You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2006/07/20 18:22:21 UTC
svn commit: r423976 [2/2] - 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/...
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/compatibility/JDBCDriverTest.java?rev=423976&r1=423975&r2=423976&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 Thu Jul 20 09:22:18 2006
@@ -46,9 +46,7 @@
/////////////////////////////////////////////////////////////
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.
@@ -119,11 +117,6 @@
( 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 ),
};
//
@@ -155,44 +148,9 @@
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.
@@ -207,39 +165,38 @@
//
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|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 } ),
+ // 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 } ),
};
/////////////////////////////////////////////////////////////
@@ -264,18 +221,6 @@
/////////////////////////////////////////////////////////////
//
- // DATABASE-SIDE FUNCTIONS
- //
- /////////////////////////////////////////////////////////////
-
- public static void ricochetBooleanProc( Boolean inValue, Boolean[] outValue )
- throws Exception
- {
- outValue[ 0 ] = inValue;
- }
-
- /////////////////////////////////////////////////////////////
- //
// TEST ENTRY POINTS
//
/////////////////////////////////////////////////////////////
@@ -314,54 +259,6 @@
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
@@ -718,11 +615,6 @@
switch( originalJDbcType )
{
- 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:
@@ -733,16 +625,6 @@
}
}
- 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.
@@ -894,275 +776,10 @@
/////////////////////////////////////////////////////////////
//
- // 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
@@ -1271,16 +888,7 @@
// client does not support nulls of this type.
- switch( jdbcType )
- {
- case JDBC_BOOLEAN:
- ps.setNull( param, Types.SMALLINT );
- break;
-
- default:
- fail( "Unsupported Derby type: " + type.getDerbyTypeName() );
- break;
- }
+ fail( "Unsupported Derby type: " + type.getDerbyTypeName() );
}
//
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java?rev=423976&r1=423975&r2=423976&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/BooleanTest.java Thu Jul 20 09:22:18 2006
@@ -1,706 +0,0 @@
-/*
-
- 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.derby.tools.ij;
-import org.apache.derbyTesting.functionTests.util.BigDecimalHandler;
-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";
- private static boolean HAVE_BIG_DECIMAL;
-
- static{
- if(BigDecimalHandler.representation != BigDecimalHandler.BIGDECIMAL_REPRESENTATION)
- HAVE_BIG_DECIMAL = false;
- else
- HAVE_BIG_DECIMAL = true;
- }
-
- /////////////////////////////////////////////////////////////
- //
- // 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 = ij.startJBMS();
-
- 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 = null;
- if (HAVE_BIG_DECIMAL)
- {
- 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"
- );
- }
- else
- {
- 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 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();
- if (HAVE_BIG_DECIMAL)
- {
- 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",
- }
- );
- }
- else
- {
- assertRow
- (
- rs,
- new Object[]
- {
- new Integer( 1 ),
- new Integer( 1 ),
- new Integer( 1 ),
- new Long( 1L ),
- new Float( 1.0 ),
- new Double( 1.0 ),
- new Float( 1.0 ),
- "true ",
- "true",
- "true",
- "true",
- }
- );
- }
-
- rs.next();
- if (HAVE_BIG_DECIMAL)
- {
- 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",
- }
- );
- }
- else
- {
- assertRow
- (
- rs,
- new Object[]
- {
- new Integer( 2 ),
- new Integer( 0 ),
- new Integer( 0 ),
- new Long( 0L ),
- new Float( 0.0 ),
- new Double( 0.0 ),
- new Float( 0.0 ),
- "false",
- "false",
- "false",
- "false",
- }
- );
- }
-
- rs.next();
- if (HAVE_BIG_DECIMAL)
- {
- assertRow
- (
- rs,
- new Object[]
- {
- new Integer( 3 ),
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- }
- );
- }
- else
- {
- assertRow
- (
- rs,
- new Object[]
- {
- new Integer( 3 ),
- 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
- );
- }
-
-}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java?rev=423976&r1=423975&r2=423976&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/LangSuite.java Thu Jul 20 09:22:18 2006
@@ -1,94 +0,0 @@
-/*
-
- 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() );
- }
-
-
-
-}
-
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml?rev=423976&r1=423975&r2=423976&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/build.xml Thu Jul 20 09:22:18 2006
@@ -1,76 +0,0 @@
-<?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
- source="1.3"
- target="1.3"
- 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>
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties?rev=423976&r1=423975&r2=423976&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/junitTests/lang/default_app.properties Thu Jul 20 09:22:18 2006
@@ -1,31 +0,0 @@
-#
-# 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.
-#
-#
-
-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
-
-# DataSource properties, only used if ij.dataSource is set
-ij.dataSource.databaseName=wombat
-ij.dataSource.createDatabase=create
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/db2Compatibility.sql?rev=423976&r1=423975&r2=423976&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 Thu Jul 20 09:22:18 2006
@@ -99,6 +99,7 @@
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);
@@ -306,6 +307,7 @@
-- 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;
@@ -334,6 +336,8 @@
-- 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);
@@ -612,6 +616,18 @@
-- (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/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/logop.sql?rev=423976&r1=423975&r2=423976&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 Thu Jul 20 09:22:18 2006
@@ -156,6 +156,7 @@
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;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureInTrigger.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureInTrigger.sql?rev=423976&r1=423975&r2=423976&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureInTrigger.sql (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/procedureInTrigger.sql Thu Jul 20 09:22:18 2006
@@ -508,7 +508,7 @@
--- check delete failed
select * from t2;
--- check index is not created
-select count(*) from SYS.SYSCONGLOMERATES where CONGLOMERATENAME='IX' and ISINDEX=true;
+select count(*) from SYS.SYSCONGLOMERATES where CONGLOMERATENAME='IX' and ISINDEX=1;
drop trigger create_index_trig;
--- create an index to test we cannot drop it from a procedure called by a trigger
@@ -521,5 +521,5 @@
--- check delete failed
select * from t1;
--- check index is not dropped
-select count(*) from SYS.SYSCONGLOMERATES where CONGLOMERATENAME='IX' and ISINDEX=true;
+select count(*) from SYS.SYSCONGLOMERATES where CONGLOMERATENAME='IX' and ISINDEX=1;
drop trigger drop_index_trig;
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/schemas.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/schemas.sql?rev=423976&r1=423975&r2=423976&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 Thu Jul 20 09:22:18 2006
@@ -430,6 +430,7 @@
where i = (select i from test.t t2 where s = (select i from test.t t3 where s = 2));
-- correlated subqueries
+-- exists disallowed in select clause
select (exists (select * from test.ttt
where iii = (select 11 from test.tt where ii = i and ii <> 1)) )
a