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/09/22 19:23:06 UTC

svn commit: r449013 - in /db/derby/code/branches/10.2: java/client/org/apache/derby/client/net/ java/engine/org/apache/derby/catalog/ java/engine/org/apache/derby/iapi/sql/dictionary/ java/engine/org/apache/derby/impl/sql/catalog/ java/engine/org/apach...

Author: rhillegas
Date: Fri Sep 22 10:23:05 2006
New Revision: 449013

URL: http://svn.apache.org/viewvc?view=rev&rev=449013
Log:
DERBY-1725: Merge the following patches from the trunk to the 10.2 branch: No JIRA (448472), DERBY-1826 (448900), DERBY-1834 (448833), DERBY-1854 (448758), DERBY-1776 (448691), DERBY-1846 (448617).

Modified:
    db/derby/code/branches/10.2/java/client/org/apache/derby/client/net/NetConnection.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/catalog/SystemProcedures.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/jdk16/grantRevokeDDL2.out
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/compressTable.sql
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
    db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
    db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4

Modified: db/derby/code/branches/10.2/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/client/org/apache/derby/client/net/NetConnection.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/branches/10.2/java/client/org/apache/derby/client/net/NetConnection.java Fri Sep 22 10:23:05 2006
@@ -703,7 +703,7 @@
      * using the SHA-1 algorithm, and is sent to the application server.
      *
      * The application server generates a password substitute using the same
-     * algorithm and compares it with the application requester’s password
+     * algorithm and compares it with the application requester's password
      * substitute. If equal, the user is authenticated.
      *
      * The SECTKN parameter is used to flow the client and server encryption

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/catalog/SystemProcedures.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/catalog/SystemProcedures.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/catalog/SystemProcedures.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/catalog/SystemProcedures.java Fri Sep 22 10:23:05 2006
@@ -1144,7 +1144,7 @@
 	 * SYSCS_IMPORT_TABLE(IN SCHEMANAME  VARCHAR(128), 
 	 * IN TABLENAME    VARCHAR(128),  IN FILENAME VARCHAR(32672) , 
 	 * IN COLUMNDELIMITER CHAR(1),  IN CHARACTERDELIMITER CHAR(1) ,  
-	 * IN CODESET VARCHAR(128), IN  REPLACE SMALLINT)
+	 * IN CODESET VARCHAR(128), IN  REPLACE SMALLINT)
 	 * @exception  StandardException  Standard exception policy.
      **/
 	public static void SYSCS_IMPORT_TABLE(
@@ -1177,11 +1177,11 @@
 	 * specified columns in the file.
      * <p>
      * Will be called as 
-	 * SYSCS_IMPORT_DATA (IN SCHEMANAME  VARCHAR(128), IN TABLENAME    VARCHAR(128),  
+	 * SYSCS_IMPORT_DATA (IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128),
 	 *                    IN INSERTCOLUMNLIST VARCHAR(32762), IN COLUMNINDEXES VARCHAR(32762),
-	 *                    IN FILENAME VARCHAR(32762), IN COLUMNDELIMITER CHAR(1),  
-	 *                    IN CHARACTERDELIMITER  CHAR(1) ,  IN CODESET VARCHAR(128) , 
-     *                    IN  REPLACE SMALLINT)
+	 *                    IN FILENAME VARCHAR(32762), IN COLUMNDELIMITER CHAR(1), 
+	 *                    IN CHARACTERDELIMITER CHAR(1), IN CODESET VARCHAR(128), 
+	 *                    IN REPLACE SMALLINT)
 	 *
 	 * @exception  StandardException  Standard exception policy.
      **/
@@ -1218,7 +1218,7 @@
      * Perform bulk insert using the specificed vti .
      * <p>
      * Will be called as 
-	 * SYSCS_BULK_INSERT (IN SCHEMANAME VARCHAR(128), IN TABLENAME    VARCHAR(128),  
+	 * SYSCS_BULK_INSERT (IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), 
 	 *                    IN VTINAME VARCHAR(32762), IN VTIARG VARCHAR(32762))
 	 *
 	 * @exception  StandardException  Standard exception policy.

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/ColumnDescriptor.java Fri Sep 22 10:23:05 2006
@@ -40,7 +40,7 @@
  * <ol>
  * <li>long getAutoincStart()</li>
  * <li>java.lang.String getColumnName()</li>
- * <li>DefaultDescriptor getDefaultDescriptor(DataDictionary dd)</li>
+ * <li>DefaultDescriptor getDefaultDescriptor(DataDictionary dd)</li>
  * <li>DefaultInfo getDefaultInfo</li>
  * <li>UUID getDefaultUUID</li>
  * <li>DataValueDescriptor getDefaultValue</li>

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Fri Sep 22 10:23:05 2006
@@ -5639,8 +5639,11 @@
 
 	/**
 	 * Update the conglomerateNumber for an array of ConglomerateDescriptors.
-	 * In case of more than one ConglomerateDescriptor, they are for duplicate
-	 * indexes sharing one conglomerate.
+	 * In case of more than one ConglomerateDescriptor, each descriptor 
+	 * should be updated separately, conglomerate id is not same for all 
+	 * the descriptors. Even when indexes are sharing the same 
+	 * conglomerate(conglomerate number), conglomerate ids are unique.
+	 *
 	 * This is useful, in 1.3, when doing a bulkInsert into an 
 	 * empty table where we insert into a new conglomerate.
 	 * (This will go away in 1.4.)
@@ -5657,38 +5660,35 @@
 		throws StandardException
 	{
 		ExecIndexRow				keyRow1 = null;
-		ExecRow[]    				rows = new ExecRow[cds.length];
+		ExecRow     				row;
 		DataValueDescriptor			conglomIDOrderable;
 		TabInfoImpl						ti = coreInfo[SYSCONGLOMERATES_CORE_NUM];
 		SYSCONGLOMERATESRowFactory  rf = (SYSCONGLOMERATESRowFactory) ti.getCatalogRowFactory();
-
-		/* Use conglomIDOrderable in both start 
-		 * and stop position for index 1 scan. 
-		 */
-		conglomIDOrderable = getValueAsDVD(cds[0].getUUID());
-
-		/* Set up the start/stop position for the scan */
-		keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
-		keyRow1.setColumn(1, conglomIDOrderable);
+		boolean[] bArray = {false, false, false};
 
 		for (int i = 0; i < cds.length; i++)
 		{
+			/* Use conglomIDOrderable in both start 
+			 * and stop position for index 1 scan. 
+			 */
+			conglomIDOrderable = getValueAsDVD(cds[i].getUUID());
+
+			/* Set up the start/stop position for the scan */
+			keyRow1 = (ExecIndexRow) exFactory.getIndexableRow(1);
+			keyRow1.setColumn(1, conglomIDOrderable);
+
 			cds[i].setConglomerateNumber(conglomerateNumber);
 			// build the row to be stuffed into SYSCONGLOMERATES. 
-			rows[i] = rf.makeRow(cds[i], null);
-		}
+			row = rf.makeRow(cds[i], null);
 
-		// update row in catalog (no indexes)
-		boolean[] bArray = new boolean[3];
-		for (int index = 0; index < 3; index++)
-		{
-			bArray[index] = false;
+			// update row in catalog (no indexes)
+			ti.updateRow(keyRow1, row,
+						 SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX1_ID,
+						 bArray,
+						 (int[])null,
+						 tc);
 		}
-		ti.updateRow(keyRow1, rows,
-					 SYSCONGLOMERATESRowFactory.SYSCONGLOMERATES_INDEX1_ID,
-					 bArray,
-					 (int[])null,
-					 tc);
+
 	}
 
 	

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Fri Sep 22 10:23:05 2006
@@ -4219,8 +4219,8 @@
 	{
 		throw StandardException.newException(
 			SQLState.LANG_XML_KEYWORD_MISSING, "DOCUMENT",
-			new Integer(getToken(1).beginLine),
-			new Integer(getToken(1).beginColumn));
+			ReuseFactory.getInteger(getToken(1).beginLine),
+			ReuseFactory.getInteger(getToken(1).beginColumn));
 	}
 |
 	LOOKAHEAD({ getToken(1).kind == CONTENT }) <CONTENT>
@@ -6752,8 +6752,8 @@
 	{
 		throw StandardException.newException(
 			SQLState.LANG_XML_KEYWORD_MISSING, "PRESERVE WHITESPACE",
-			new Integer(getToken(1).beginLine),
-			new Integer(getToken(1).beginColumn));
+			ReuseFactory.getInteger(getToken(1).beginLine),
+			ReuseFactory.getInteger(getToken(1).beginColumn));
 	}
 |
 	<STRIP> <WHITESPACE>
@@ -6818,8 +6818,8 @@
 	{
 		throw StandardException.newException(
 			SQLState.LANG_XML_KEYWORD_MISSING, "AS",
-			new Integer(getToken(1).beginLine),
-			new Integer(getToken(1).beginColumn));
+			ReuseFactory.getInteger(getToken(1).beginLine),
+			ReuseFactory.getInteger(getToken(1).beginColumn));
 	}
 |
 	<AS> targetType = dataTypeDDL()

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/compressTable.out Fri Sep 22 10:23:05 2006
@@ -1143,5 +1143,50 @@
 ij> drop schema inventory RESTRICT;
 0 rows inserted/updated/deleted
 ij> --end derby-437 related test cases.
+-- test case for derby-1854 
+-- perform compress on a table that has same column 
+-- as a primary key and a foreign key.  
+create table users (
+ user_id int not null generated by default as identity,
+ user_login varchar(255) not null,
+ primary key (user_id));
+0 rows inserted/updated/deleted
+ij> create table admins (
+ user_id int not null,
+ primary key (user_id),
+ constraint admin_uid_fk foreign key (user_id) references users (user_id));
+0 rows inserted/updated/deleted
+ij> insert into users (user_login) values('test1');
+1 row inserted/updated/deleted
+ij> insert into admins values (values identity_val_local());
+1 row inserted/updated/deleted
+ij> call syscs_util.syscs_compress_table('APP', 'ADMINS', 0);
+0 rows inserted/updated/deleted
+ij> -- do consistency check on the tables.
+values SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'USERS');
+1          
+-----------
+1          
+ij> values SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'ADMINS');
+1          
+-----------
+1          
+ij> select * from admins;
+USER_ID    
+-----------
+1          
+ij> select * from users;
+USER_ID    |USER_LOGIN                                                                                                                                                                                                                                                     
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+1          |test1                                                                                                                                                                                                                                                          
+ij> insert into users (user_login) values('test2');
+1 row inserted/updated/deleted
+ij> insert into admins values (values identity_val_local());
+1 row inserted/updated/deleted
+ij> drop table admins;
+0 rows inserted/updated/deleted
+ij> drop table users;
+0 rows inserted/updated/deleted
+ij> -- end derby-1854 test case. 
 ;
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/importExportThruIJ.out Fri Sep 22 10:23:05 2006
@@ -715,4 +715,48 @@
 Mickey                                                                                                                          |Mouse                                                                                                                           |Disneyland                                                                                                                      |Magic Kingdom                                                                                                                   |Los Angeles                                                                                                                     
 ij> drop table imp_temp;
 0 rows inserted/updated/deleted
+ij> -- test case for derby-1854/derby-1641
+-- perform import into a table that has same column 
+-- as a primary key and a foreign key (ADMINS table).  
+create table users (
+ user_id int not null generated by default as identity,
+ user_login varchar(255) not null,
+ primary key (user_id));
+0 rows inserted/updated/deleted
+ij> create table admins (
+ user_id int not null,
+ primary key (user_id),
+ constraint admin_uid_fk foreign key (user_id) references users (user_id));
+0 rows inserted/updated/deleted
+ij> insert into users (user_login) values('test1');
+1 row inserted/updated/deleted
+ij> insert into users (user_login) values('test2');
+1 row inserted/updated/deleted
+ij> call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select user_id from users' , 
+                    'extinout/users_id.dat', null , null , null ) ;
+0 rows inserted/updated/deleted
+ij> call syscs_util.syscs_import_table( null, 'ADMINS', 
+                    'extinout/users_id.dat', null, null, null,1);
+0 rows inserted/updated/deleted
+ij> select * from admins;
+USER_ID    
+-----------
+1          
+2          
+ij> select * from users;
+USER_ID    |USER_LOGIN                                                                                                                      
+--------------------------------------------------------------------------------------------------------------------------------------------
+1          |test1                                                                                                                           
+2          |test2                                                                                                                           
+ij> -- do consistency check on the table.
+values SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'ADMINS');
+1          
+-----------
+1          
+ij> drop table admins;
+0 rows inserted/updated/deleted
+ij> drop table users;
+0 rows inserted/updated/deleted
+ij> -- end derby-1854/derby-1641 test case. 
+;
 ij> 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/jdk16/grantRevokeDDL2.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/jdk16/grantRevokeDDL2.out?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/jdk16/grantRevokeDDL2.out (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/master/jdk16/grantRevokeDDL2.out Fri Sep 22 10:23:05 2006
@@ -308,7 +308,7 @@
 ij(USER1)> -- revoking privilege that has not been granted, expect warning
 revoke select,insert,update,delete,trigger,references on t1 from user2;
 0 rows inserted/updated/deleted
-WARNING 01006: Privilege not revoked from USER2.
+WARNING 01006: Privilege not revoked from user USER2.
 ij(USER1)> -- syntax errors, expect errors
 grant select on t1 from user2;
 ERROR: Failed with SQLSTATE 42X01
@@ -481,10 +481,10 @@
 ij(USER1)> -- expect warnings
 revoke update(c2) on t1 from user3;
 0 rows inserted/updated/deleted
-WARNING 01006: Privilege not revoked from USER3.
+WARNING 01006: Privilege not revoked from user USER3.
 ij(USER1)> revoke select(c2) on t1 from user3;
 0 rows inserted/updated/deleted
-WARNING 01006: Privilege not revoked from USER3.
+WARNING 01006: Privilege not revoked from user USER3.
 ij(USER1)> set connection user2;
 ij(USER2)> -- ok
 update user1.t1 set c2 = 'user2';
@@ -576,10 +576,10 @@
 ij(USER1)> -- expect warning
 revoke select(c1) on t3 from user2;
 0 rows inserted/updated/deleted
-WARNING 01006: Privilege not revoked from USER2.
+WARNING 01006: Privilege not revoked from user USER2.
 ij(USER1)> revoke update(c2) on t3 from user2;
 0 rows inserted/updated/deleted
-WARNING 01006: Privilege not revoked from USER2.
+WARNING 01006: Privilege not revoked from user USER2.
 ij(USER1)> set connection user2;
 ij(USER2)> select * from user1.t3;
 C1         |C2        |C3         

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SQLAuthorizationPropTest.java Fri Sep 22 10:23:05 2006
@@ -34,7 +34,6 @@
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
 import org.apache.derbyTesting.functionTests.util.SQLStateConstants;
-import org.apache.derbyTesting.functionTests.util.TestUtil;
 
 public class SQLAuthorizationPropTest extends BaseJDBCTestCase {
 
@@ -116,7 +115,7 @@
 		// Shutdown the database for derby.database.sqlAuthorization property 
 		// to take effect. This was set by DatabasePropertyTestSetup decorator.
 		try{ 
-			TestUtil.getConnection("wombat", "shutdown=true");
+			getDefaultConnection("shutdown=true");
 			fail("FAIL: Failed to shutdown database");
 		} catch (SQLException sqle) {
 			assertSQLState(SQLStateConstants.SHUTDOWN_DATABASE, sqle);

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/compressTable.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/compressTable.sql?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/compressTable.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/lang/compressTable.sql Fri Sep 22 10:23:05 2006
@@ -490,3 +490,31 @@
 drop table inventory.orderTable;
 drop schema inventory RESTRICT;
 --end derby-437 related test cases.
+
+-- test case for derby-1854 
+-- perform compress on a table that has same column 
+-- as a primary key and a foreign key.  
+
+create table users (
+ user_id int not null generated by default as identity,
+ user_login varchar(255) not null,
+ primary key (user_id));
+
+create table admins (
+ user_id int not null,
+ primary key (user_id),
+ constraint admin_uid_fk foreign key (user_id) references users (user_id));
+ 
+insert into users (user_login) values('test1');
+insert into admins values (values identity_val_local());
+call syscs_util.syscs_compress_table('APP', 'ADMINS', 0);
+-- do consistency check on the tables.
+values SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'USERS');
+values SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'ADMINS');
+select * from admins; 
+select * from users;
+insert into users (user_login) values('test2');
+insert into admins values (values identity_val_local());
+drop table admins;
+drop table users;
+-- end derby-1854 test case. 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/functionTests/tests/tools/importExportThruIJ.sql Fri Sep 22 10:23:05 2006
@@ -258,6 +258,35 @@
 select * from imp_temp ;
 drop table imp_temp;
 
+-- test case for derby-1854/derby-1641
+-- perform import into a table that has same column 
+-- as a primary key and a foreign key (ADMINS table).  
+
+create table users (
+ user_id int not null generated by default as identity,
+ user_login varchar(255) not null,
+ primary key (user_id));
+
+create table admins (
+ user_id int not null,
+ primary key (user_id),
+ constraint admin_uid_fk foreign key (user_id) references users (user_id));
+ 
+insert into users (user_login) values('test1');
+insert into users (user_login) values('test2');
+
+call SYSCS_UTIL.SYSCS_EXPORT_QUERY('select user_id from users' , 
+                    'extinout/users_id.dat', null , null , null ) ;
+call syscs_util.syscs_import_table( null, 'ADMINS', 
+                    'extinout/users_id.dat', null, null, null,1); 
+select * from admins; 
+select * from users;
+-- do consistency check on the table.
+values SYSCS_UTIL.SYSCS_CHECK_TABLE('APP', 'ADMINS');
+drop table admins;
+drop table users;
+-- end derby-1854/derby-1641 test case. 
+
 
 
 

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/BaseJDBCTestCase.java Fri Sep 22 10:23:05 2006
@@ -89,6 +89,8 @@
      * <LI> getConnection()
      * <LI> openDefaultConnection()
      * <LI> openConnection(database)
+     * <LI> getDefaultConnection(String connAttrs)
+     * <LI> getConnection(String databaseName, String connAttrs)
      * </UL>
      * when getConnection() opens a new connection. Default
      * action is to not modify the connection's state from
@@ -198,6 +200,40 @@
         initializeConnection(conn);
         return conn;        
     }
+    
+    /**
+     * Get a connection to the default database using the  specified connection
+     * attributes.
+     *  
+     * @param connAttrs connection attributes
+     * @return connection to default database.
+     * @throws SQLException
+     */
+    public Connection getDefaultConnection(String connAttrs)
+    	throws SQLException {
+    	Connection conn =  getTestConfiguration().
+								getDefaultConnection(connAttrs);
+    	initializeConnection(conn);
+    	return conn;
+    }
+
+    /**
+     * Get a connection to a database using the specified connection 
+     * attributes.
+     *  
+     * @param databaseName database to connect to
+     * @param connAttrs connection attributes
+     * @return connection to database
+     * @throws SQLException
+     */
+    public Connection getConnection(String databaseName, String connAttrs) 
+    	throws SQLException
+	{
+    	Connection conn = getTestConfiguration().getConnection(databaseName, 
+    															connAttrs);
+    	initializeConnection(conn);
+    	return conn;       
+	}    
     
     /**
      * Run a SQL script through ij discarding the output

Modified: db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/branches/10.2/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Fri Sep 22 10:23:05 2006
@@ -408,7 +408,7 @@
      */
     public Connection openDefaultConnection()
         throws SQLException {
-        return openConnection(getDatabaseName());
+        return getDefaultConnection("create=true");
     }
     
     /**
@@ -421,26 +421,53 @@
      * @return connection to database.
      */
     public Connection openConnection (String databaseName) throws SQLException {
+        return getConnection(databaseName, "create=true");
+    }
+    
+    /**
+     * Get a connection to the default database using the  specified connection
+     * attributes.
+     * 
+     * @param connAttrs connection attributes
+     * @return connection to database.
+     * @throws SQLException
+     */
+    public Connection getDefaultConnection(String connAttrs)
+        throws SQLException {
+        return getConnection(getDatabaseName(), connAttrs);
+    }
+    
+    /**
+     * Get a connection to a database using the specified connection 
+     * attributes.
+     * 
+     * @param databaseName database to connect to
+     * @param connAttrs connection attributes
+     * @return connection to database.
+     * @throws SQLException
+     */
+    public Connection getConnection (String databaseName, String connAttrs) 
+    	throws SQLException {
         Connection con = null;
         JDBCClient client =getJDBCClient();
         if (JDBC.vmSupportsJDBC2()) {            
             loadJDBCDriver(client.getJDBCDriverName());
             if (!isSingleLegXA()) {
                 con = DriverManager.getConnection(
-                        getJDBCUrl(databaseName) + ";create=true",
+                        getJDBCUrl(databaseName) + ";" + connAttrs,
                         getUserName(),
                         getUserPassword());
             }
             else {
                 Properties attrs = 
-                        getDataSourcePropertiesForDatabase(databaseName);
+                	getDataSourcePropertiesForDatabase(databaseName, connAttrs);
                 con = TestDataSourceFactory.getXADataSource(attrs).
                         getXAConnection (getUserName(), 
                         getUserPassword()).getConnection();
             }
         } else {
             //Use DataSource for JSR169
-            Properties attrs = getDataSourcePropertiesForDatabase(databaseName);
+            Properties attrs = getDataSourcePropertiesForDatabase(databaseName, connAttrs);
             con = TestDataSourceFactory.getDataSource(attrs).getConnection();
         }
         return con;
@@ -564,7 +591,7 @@
     /**
      * Generate properties which can be set on a
      * <code>DataSource</code> in order to connect to the default
-     * database.
+     * database. If the database does not exist, it will be created.
      *
      * @return a <code>Properties</code> object containing server
      * name, port number, database name and other attributes needed to
@@ -572,22 +599,20 @@
      */
     public static Properties getDefaultDataSourceProperties() {
         return getDataSourcePropertiesForDatabase(
-                getCurrent().getDatabaseName());
+                getCurrent().getDatabaseName(), "create=true");
     }
     
     /**
-     * Generate properties which can be set on a
-     * <code>DataSource</code> in order to connect to a given
-     * database.
-     *
+     * Generate properties which can be set on a <code>DataSource</code> 
+     * in order to connect to a database using the specified connection 
+     * attributes.
+     * 
      * @param databaseName database to connect to
-     *
-     * @return a <code>Properties</code> object containing server
-     * name, port number, database name and other attributes needed to
-     * connect to the database
+     * @param connAttrs connection attributes
+     * @return
      */
     public static Properties getDataSourcePropertiesForDatabase
-            (String databaseName) 
+    	(String databaseName, String connAttrs) 
     {
         Properties attrs = new Properties();
         if (!(getCurrent().getJDBCClient() == JDBCClient.EMBEDDED)) {
@@ -595,7 +620,7 @@
             attrs.setProperty("portNumber", Integer.toString(getCurrent().getPort()));
         }
         attrs.setProperty("databaseName", databaseName);
-        attrs.setProperty("connectionAttributes", "create=true");
+        attrs.setProperty("connectionAttributes", connAttrs);
         return attrs;
     }
 

Modified: db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4?view=diff&rev=449013&r1=449012&r2=449013
==============================================================================
--- db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4 (original)
+++ db/derby/code/branches/10.2/tools/jdbc4/update-with-jdbc4 Fri Sep 22 10:23:05 2006
@@ -85,7 +85,7 @@
 echo "Compiling the client classes for JDBC 4.0"
 for i in `cat client.list`
 do
-  FILE=`echo $i | tr '\\' '/'` 
+  FILE=`echo $i | tr '\\\\' '/'` 
   if [ ! \( "$cygwin" = "true" \) -o \( "$mks" = "true" \) ]; then
     FILE=`echo $FILE | sed 's/.$//g'`
   fi
@@ -123,7 +123,7 @@
 unset CLASSES
 for i in `cat engine.list`
 do
-  FILE=`echo $i | tr '\\' '/'` 
+  FILE=`echo $i | tr '\\\\' '/'` 
   if [ ! "$cygwin" = "true" ]; then
     FILE=`echo $FILE | sed 's/.$//g'`
   fi
@@ -143,9 +143,9 @@
 # patch up modules.properties do the driver will load
 cd "$DERBY_HOME/jdbc4classes/engine"
 "$JAVA_HOME/bin/jar" xf "$DERBY_HOME_NML/lib/derby.jar" org/apache/derby/modules.properties
-if $cygwin; then
+if [ \( "$cygwin" = "true" \) -o \( "$mks" = "true" \) ]; then
   cat "$THISDIR/modules.patch" >> "$DERBY_HOME/jdbc4classes/engine/org/apache/derby/modules.properties"
-elif [ ! "$cygwin" = "true" ]; then
+else 
   cat "$THISDIR/modules.patch" | sed 's/.$//g' >> "$DERBY_HOME/jdbc4classes/engine/org/apache/derby/modules.properties"
 fi