List:Commits« Previous MessageNext Message »
From:mmatthews Date:July 30 2008 2:53pm
Subject:Connector/J commit: r6800 - in trunk: . src/com/mysql/jdbc src/com/mysql/jdbc/exceptions src/com/mysql/jdbc/exceptions/jdbc4 src/com/mysql/jdbc/jdbc2/...
View as plain text  
Added:
   trunk/src/com/mysql/jdbc/exceptions/DeadlockTimeoutRollbackMarker.java
   trunk/src/testsuite/simple/TestLifecycleInterceptor.java
Modified:
   trunk/
   trunk/CHANGES
   trunk/build.xml
   trunk/src/com/mysql/jdbc/Connection.java
   trunk/src/com/mysql/jdbc/ConnectionImpl.java
   trunk/src/com/mysql/jdbc/ConnectionLifecycleInterceptor.java
   trunk/src/com/mysql/jdbc/ConnectionProperties.java
   trunk/src/com/mysql/jdbc/ConnectionPropertiesImpl.java
   trunk/src/com/mysql/jdbc/DatabaseMetaData.java
   trunk/src/com/mysql/jdbc/ExportControlled.java
   trunk/src/com/mysql/jdbc/JDBC4Connection.java
   trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
   trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties
   trunk/src/com/mysql/jdbc/MysqlIO.java
   trunk/src/com/mysql/jdbc/MysqlIOprotocol.java
   trunk/src/com/mysql/jdbc/PreparedStatement.java
   trunk/src/com/mysql/jdbc/ReplicationConnection.java
   trunk/src/com/mysql/jdbc/ResultSetImpl.java
   trunk/src/com/mysql/jdbc/ResultSetRow.java
   trunk/src/com/mysql/jdbc/RowDataDynamic.java
   trunk/src/com/mysql/jdbc/ServerPreparedStatement.java
   trunk/src/com/mysql/jdbc/StatementImpl.java
   trunk/src/com/mysql/jdbc/TimeUtil.java
   trunk/src/com/mysql/jdbc/UpdatableResultSet.java
   trunk/src/com/mysql/jdbc/exceptions/MySQLTransactionRollbackException.java
   trunk/src/com/mysql/jdbc/exceptions/jdbc4/MySQLTransactionRollbackException.java
   trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java
   trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4ConnectionWrapper.java
   trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java
   trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java
   trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java
   trunk/src/testsuite/regression/CallableStatementRegressionTest.java
   trunk/src/testsuite/regression/ConnectionRegressionTest.java
   trunk/src/testsuite/regression/DataSourceRegressionTest.java
   trunk/src/testsuite/regression/MetaDataRegressionTest.java
   trunk/src/testsuite/regression/PooledConnectionRegressionTest.java
   trunk/src/testsuite/regression/ResultSetRegressionTest.java
   trunk/src/testsuite/regression/StatementRegressionTest.java
   trunk/src/testsuite/simple/ConnectionTest.java
Log:
Merged revisions 6750-6754,6756-6758,6760,6762-6772,6774-6778,6787-6788,6793-6799 via svnmerge from 
svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_1

.......
  r6750 | mmatthews | 2008-02-27 22:05:18 -0600 (Wed, 27 Feb 2008) | 8 lines
  
  The ConnectionLifecycleInterceptor interface now has callback methods for
        transaction initiation (transactionBegun()), and completion 
        (transactionCompleted()), as reported by the *server* (i.e. 
        calling Connection.setAutoCommit(false) will not trigger 
        transactionBegun() being called, however the first statement
        which causes a transaction to start on the server will cause
        transactionBegun() to be called *after* the statement has been processed
        on the server).
.......
  r6751 | mmatthews | 2008-02-27 23:34:19 -0600 (Wed, 27 Feb 2008) | 3 lines
  
  Fixed Bug#34913 - ResultSet.getTimestamp() returns incorrect
        values for month/day of TIMESTAMPs when using server-side
        prepared statements (not enabled by default).
.......
  r6752 | mmatthews | 2008-02-28 12:26:22 -0600 (Thu, 28 Feb 2008) | 1 line
  
  I18N updates/fixes.
.......
  r6753 | mmatthews | 2008-02-28 21:39:49 -0600 (Thu, 28 Feb 2008) | 7 lines
  
  Fixed BUG#34937 - MysqlConnectionPoolDataSource does not support 
        ReplicationConnection. Notice that we implemented com.mysql.jdbc.Connection
        for ReplicationConnection, however, only accessors from ConnectionProperties
        are implemented (not the mutators), and they return values from the currently
        active connection. All other methods from com.mysql.jdbc.Connection are
        implemented, and operate on the currently active connection, with the exception of
        resetServerState() and changeUser().
.......
  r6754 | mmatthews | 2008-02-29 00:53:22 -0600 (Fri, 29 Feb 2008) | 7 lines
  
   Fixed BUG#34937 - MysqlConnectionPoolDataSource does not support 
        ReplicationConnection. Notice that we implemented com.mysql.jdbc.Connection
        for ReplicationConnection, however, only accessors from ConnectionProperties
        are implemented (not the mutators), and they return values from the currently
        active connection. All other methods from com.mysql.jdbc.Connection are
        implemented, and operate on the currently active connection, with the exception of
        resetServerState() and changeUser().
.......
  r6756 | mmatthews | 2008-03-03 15:27:51 -0600 (Mon, 03 Mar 2008) | 1 line
  
  Complete the fix for BUG#34937 (next time have someone review the testcase, to make sure you don't do something dumb and not create the right *type* of connection in the first place).
.......
  r6757 | mmatthews | 2008-03-05 08:45:05 -0600 (Wed, 05 Mar 2008) | 7 lines
  
  Connections created with jdbc:mysql:replication:// URLs now force
        roundRobinLoadBalance=true on the slaves, and round-robin loadbalancing
        now uses a "random" choice to more evenly distribute load across slave
        servers, especially in connection pools. Connections that are configured
        with "roundRobinLoadBalance=true" no longer set the failover state,
        as it's assumed that we're not attempting to fall-back to a master
        server. This fixes BUG#34963.
.......
  r6758 | mmatthews | 2008-03-05 09:00:59 -0600 (Wed, 05 Mar 2008) | 1 line
  
  Stack overflow w/ NotImplemented when not running JDBC4.
.......
  r6760 | mmatthews | 2008-03-06 12:21:53 -0600 (Thu, 06 Mar 2008) | 1 line
  
  Release date added, version incremented.
.......
  r6762 | mmatthews | 2008-03-13 13:46:04 -0500 (Thu, 13 Mar 2008) | 2 lines
  
  Fixed BUG#35170- ResultSet.isAfterLast() doesn't work with for
  	  streaming result sets.
.......
  r6763 | mmatthews | 2008-03-19 10:44:36 -0500 (Wed, 19 Mar 2008) | 1 line
  
  Fixed BUG#35199 - Parse error for metadata in stored function.
.......
  r6764 | mmatthews | 2008-03-25 05:49:44 -0500 (Tue, 25 Mar 2008) | 4 lines
  
  Fixed BUG#35415 - When result set is from views without access to underlying
  	  columns and is opened with CONCUR_UPDATABLE, don't throw SQLExceptions when
  	  checking updatability due to access permissions, instead return
  	  CONCUR_READONLY from getConcurrency.
.......
  r6765 | mmatthews | 2008-03-31 09:45:34 -0500 (Mon, 31 Mar 2008) | 1 line
  
  Committing non-working testcase.
.......
  r6766 | mmatthews | 2008-03-31 09:56:21 -0500 (Mon, 31 Mar 2008) | 2 lines
  
  Fixed BUG#35666 - NullPointerException when using "logSlowQueries=true" with
  	  server-side prepared statements enabled.
.......
  r6767 | mmatthews | 2008-03-31 10:27:25 -0500 (Mon, 31 Mar 2008) | 9 lines
  
  Fixed BUG#35660 - Calling equals() on connections created with "jdbc:mysql:loadbalance:"
  	  URLs did not have the same behavior as "plain" connections. The behavior we use
  	  is the implementation in java.lang.Object, load-balanced connections just happened
  	  to be using a java.lang.reflect.Proxy which required some custom behavior in 
  	  equals() to make it work the same as "plain" connections.
  	  
  	  Note that there is no *specified* equals contract for JDBC connections in the
  	  JDBC specification itself, but the test makes sure that our implementation is
  	  at least consistent.
.......
  r6768 | mmatthews | 2008-04-03 13:03:10 -0500 (Thu, 03 Apr 2008) | 1 line
  
  Not enough field elements for a stored function call.
.......
  r6769 | mmatthews | 2008-04-03 15:28:35 -0500 (Thu, 03 Apr 2008) | 3 lines
  
  Fixed BUG#35810 - Properties set in URLs and then passed to DataSources via setUrl() 
  	  did not take effect in certain circumstances. This also fixes related bugs BUG#13261 and
  	  BUG#35753.
.......
  r6770 | mmatthews | 2008-04-14 19:23:33 -0500 (Mon, 14 Apr 2008) | 2 lines
  
  Fixed BUG#36051 - ResultSet.getTime() won't accept value of '24' for hours component of
  	  a java.sql.Time.
.......
  r6771 | eherman | 2008-04-18 20:13:36 -0500 (Fri, 18 Apr 2008) | 1 line
  
  should build verbose messege if NOT paranoid()
.......
  r6772 | mmatthews | 2008-05-20 16:10:40 -0500 (Tue, 20 May 2008) | 2 lines
  
  Fixed BUG#36830 - DBMD.getColumns() doesn't return correct COLUMN_SIZE for SET columns. The
  	  logic wasn't accounting for the ","s in the column size.
.......
  r6774 | mmatthews | 2008-05-27 09:28:41 -0500 (Tue, 27 May 2008) | 1 line
  
  Fix for BUG 36948, needs testcase.
.......
  r6775 | mmatthews | 2008-05-28 09:53:25 -0500 (Wed, 28 May 2008) | 12 lines
  
  Fixed BUG#35610, BUG#35150- ResultSet.findColumn() and ResultSet.get...(String) doesn't allow
        column names to be used, and isn't congruent with ResultSetMetadata.getColumnName().
        
        By default, we follow the JDBC Specification here, in that the 4.0 behavior
  	  is correct. Calling programs should use ResultSetMetaData.getColumnLabel() to dynamically determine
  	  the correct "name" to pass to ResultSet.findColumn() or ResultSet.get...(String) whether or not the
  	  query specifies an alias via "AS" for the column. ResultSetMetaData.getColumnName() will return the
  	  actual name of the column, if it exists, and this name can *not* be used as input to ResultSet.findColumn()
  	  or ResultSet.get...(String).
  	  
  	  The JDBC-3.0 (and earlier) specification has a bug, but you can get the buggy behavior
  	  (allowing column names *and* labels to be used for ResultSet.findColumn() and get...(String)) by setting   "useColumnNamesInFindColumn" to "true".
.......
  r6776 | mmatthews | 2008-05-28 10:24:59 -0500 (Wed, 28 May 2008) | 1 line
  
  Lifecycle of StatementInterceptors should be scoped by connections, not physical i/o to the server.
.......
  r6777 | mmatthews | 2008-05-28 10:25:56 -0500 (Wed, 28 May 2008) | 1 line
  
  Make asSql() work with stored functions.
.......
  r6778 | mmatthews | 2008-05-28 10:33:28 -0500 (Wed, 28 May 2008) | 1 line
  
  Missed test case for 35170.
.......
  r6787 | mmatthews | 2008-06-03 10:44:40 -0500 (Tue, 03 Jun 2008) | 1 line
  
  Entire dev team is on Mac now, use default paths for Java6 compilation appropriate to that environment.
.......
  r6788 | mmatthews | 2008-06-22 08:08:48 -0500 (Sun, 22 Jun 2008) | 1 line
  
  Last packet received/sent is reported by the driver in millis, not seconds.
.......
  r6793 | mmatthews | 2008-07-16 09:59:08 -0500 (Wed, 16 Jul 2008) | 1 line
  
  Fixed BUG#35489 - Prepared statements from pooled connections cause NPE when closed() under JDBC-4.0.
.......
  r6794 | mmatthews | 2008-07-16 10:09:38 -0500 (Wed, 16 Jul 2008) | 3 lines
  
  Added useLocalTransactionState connection property - Should the driver use the in-transaction state provided by the MySQL protocol to determine if a commit() or rollback() should actually be sent to the database?
  
  Fixups for statement interceptors being "owned" by their connection.
.......
  r6795 | mmatthews | 2008-07-16 10:11:10 -0500 (Wed, 16 Jul 2008) | 1 line
  
  Don't continue a batch inside a transaction if it has been rolled back due to deadlock (because a new transaction will start).
.......
  r6796 | mmatthews | 2008-07-16 10:14:13 -0500 (Wed, 16 Jul 2008) | 1 line
  
  Documenting change of "useLocalTransactionState"
.......
  r6797 | mmatthews | 2008-07-17 16:00:18 -0500 (Thu, 17 Jul 2008) | 1 line
  
  Handle object identifier case sensitivity for mysql on HFS+ (backported from trunk).
.......
  r6798 | mmatthews | 2008-07-22 14:01:05 -0500 (Tue, 22 Jul 2008) | 1 line
  
  Use socket timeouts for JDBC-4.0's Connection.isValid(int timeout) instead of timer tasks, for scalability. As a side effect internally, any communications with the database can use a timeout different than the configured timeout, but this isn't currently used.
.......
  r6799 | mmatthews | 2008-07-23 17:02:34 -0500 (Wed, 23 Jul 2008) | 1 line
  
  The number and position of columns for "SHOW INNODB STATUS" changed in MySQL-5.1, which caused the  "includeInnodbStatusInDeadlockExceptions" feature to not show data about the deadlock.
.......



Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6747
   + /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6799

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/CHANGES	2008-07-30 14:53:03 UTC (rev 6800)
@@ -13,7 +13,72 @@
       parameter metadata for CallableStatements.
       
 nn-nn-08 - Version 5.1.6
+=======
 
+nn-nn-08 - Version 5.1.7
+
+	- Fixed BUG#35170- ResultSet.isAfterLast() doesn't work with for
+	  streaming result sets.
+	  
+	- Fixed BUG#35199 - Parse error for metadata in stored function.
+	
+	- Fixed BUG#35415 - When result set is from views without access to underlying
+	  columns and is opened with CONCUR_UPDATABLE, don't throw SQLExceptions when
+	  checking updatability due to access permissions, instead return
+	  CONCUR_READONLY from getConcurrency.
+	  
+	- Fixed BUG#35666 - NullPointerException when using "logSlowQueries=true" with
+	  server-side prepared statements enabled.
+	  
+	- Fixed BUG#35660 - Calling equals() on connections created with "jdbc:mysql:loadbalance:"
+	  URLs did not have the same behavior as "plain" connections. The behavior we use
+	  is the implementation in java.lang.Object, load-balanced connections just happened
+	  to be using a java.lang.reflect.Proxy which required some custom behavior in 
+	  equals() to make it work the same as "plain" connections.
+	  
+	  Note that there is no *specified* equals contract for JDBC connections in the
+	  JDBC specification itself, but the test makes sure that our implementation is
+	  at least consistent.
+	    
+	- Fixed BUG#35810 - Properties set in URLs and then passed to DataSources via setUrl() 
+	  did not take effect in certain circumstances. This also fixes related bugs BUG#13261 and
+	  BUG#35753.
+	  
+	- Fixed BUG#36051 - ResultSet.getTime() won't accept value of '24' for hours component of
+	  a java.sql.Time.
+	  
+	- Fixed BUG#36830 - DBMD.getColumns() doesn't return correct COLUMN_SIZE for SET columns. The
+	  logic wasn't accounting for the ","s in the column size.
+	  
+    - Fixed BUG#35610, BUG#35150- ResultSet.findColumn() and ResultSet.get...(String) doesn't allow
+      column names to be used, and isn't congruent with ResultSetMetadata.getColumnName().
+      
+      By default, we follow the JDBC Specification here, in that the 4.0 behavior
+	  is correct. Calling programs should use ResultSetMetaData.getColumnLabel() to dynamically determine
+	  the correct "name" to pass to ResultSet.findColumn() or ResultSet.get...(String) whether or not the
+	  query specifies an alias via "AS" for the column. ResultSetMetaData.getColumnName() will return the
+	  actual name of the column, if it exists, and this name can *not* be used as input to ResultSet.findColumn()
+	  or ResultSet.get...(String).
+	  
+	  The JDBC-3.0 (and earlier) specification has a bug, but you can get the buggy behavior
+	  (allowing column names *and* labels to be used for ResultSet.findColumn() and get...(String)) by setting 
+	  "useColumnNamesInFindColumn" to "true".
+	
+	- Fixed BUG#35489 - Prepared statements from pooled connections cause NPE when closed() under JDBC-4.0.
+	
+	- Added connection property "useLocalTransactionState" which configures if the driver use the in-transaction 
+	  state provided by the MySQL protocol to determine if a commit() or rollback() should actually be sent to the database.
+	  (disabled by default).
+	  
+	- Use socket timeouts for JDBC-4.0's Connection.isValid(int timeout) instead of timer tasks, for scalability. As a side effect
+	  internally, any communications with the database can use a timeout different than the configured timeout, but this isn't currently
+	  used.
+	  
+	- The number and position of columns for "SHOW INNODB STATUS" changed in MySQL-5.1, which caused the 
+	  "includeInnodbStatusInDeadlockExceptions" feature to not show data about the deadlock.
+	  
+03-06-08 - Version 5.1.6
+
     - JDBC-4.0-ized XAConnections and datasources.
     
     - Fixed BUG#31790 MysqlValidConnectionChecker 
@@ -160,8 +225,37 @@
       
     - Fixed BUG#33162 - NullPointerException instead of SQLException 
       thrown for ResultSet.getTimestamp() when not positioned on a
-      row. 
+      row.
+
+    - The ConnectionLifecycleInterceptor interface now has callback methods for
+      transaction initiation (transactionBegun()), and completion 
+      (transactionCompleted()), as reported by the *server* (i.e. 
+      calling Connection.setAutoCommit(false) will not trigger 
+      transactionBegun() being called, however the first statement
+      which causes a transaction to start on the server will cause
+      transactionBegun() to be called *after* the statement has been processed
+      on the server).
+
+    - Fixed Bug#34913 - ResultSet.getTimestamp() returns incorrect
+      values for month/day of TIMESTAMPs when using server-side
+      prepared statements (not enabled by default).
       
+    - Fixed BUG#34937 - MysqlConnectionPoolDataSource does not support 
+      ReplicationConnection. Notice that we implemented com.mysql.jdbc.Connection
+      for ReplicationConnection, however, only accessors from ConnectionProperties
+      are implemented (not the mutators), and they return values from the currently
+      active connection. All other methods from com.mysql.jdbc.Connection are
+      implemented, and operate on the currently active connection, with the exception of
+      resetServerState() and changeUser().
+      
+    - Connections created with jdbc:mysql:replication:// URLs now force
+      roundRobinLoadBalance=true on the slaves, and round-robin loadbalancing
+      now uses a "random" choice to more evenly distribute load across slave
+      servers, especially in connection pools. Connections that are configured
+      with "roundRobinLoadBalance=true" no longer set the failover state,
+      as it's assumed that we're not attempting to fall-back to a master
+      server. This fixes BUG#34963.
+    
 10-09-07 - Version 5.1.5
 
     - Released instead of 5.1.4 to pickup patch for BUG#31053

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/build.xml	2008-07-30 14:53:03 UTC (rev 6800)
@@ -62,8 +62,8 @@
 			to ant via -D switches
 	-->
 		
-	<property name="com.mysql.jdbc.java6.javac" value="C:\jvms\jdk1.6.0\bin\javac.exe" />
-	<property name="com.mysql.jdbc.java6.rtjar" value="C:\jvms\jdk1.6.0\jre\lib\rt.jar" />
+	<property name="com.mysql.jdbc.java6.javac" value="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/javac" />
+	<property name="com.mysql.jdbc.java6.rtjar" value="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/classes.jar" />
 				
 	<!-- 
 	     The following property is needed for building the docs. It's

Modified: trunk/src/com/mysql/jdbc/Connection.java
===================================================================
--- trunk/src/com/mysql/jdbc/Connection.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/Connection.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -185,6 +185,12 @@
 	 * Is this connection currently a participant in an XA transaction?
 	 */
 	public abstract boolean isInGlobalTx();
+	
+	/**
+	 * Set the state of being in a global (XA) transaction.
+	 * @param flag
+	 */
+	public void setInGlobalTx(boolean flag);
 
 	/**
 	 * Is this connection connected to the first host in the list if
@@ -204,6 +210,15 @@
 	public abstract boolean isNoBackslashEscapesSet();
 
 	/**
+	 * Does this connection have the same resource name as the given
+	 * connection (for XA)?
+	 * 
+	 * @param c
+	 * @return
+	 */
+	public abstract boolean isSameResource(Connection c);
+	
+	/**
 	 * Is the server configured to use lower-case table names only?
 	 * 
 	 * @return true if lower_case_table_names is 'on'

Modified: trunk/src/com/mysql/jdbc/ConnectionImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionImpl.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ConnectionImpl.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -49,8 +49,6 @@
 import java.util.Timer;
 import java.util.TreeMap;
 
-import javax.sql.ConnectionPoolDataSource;
-
 import com.mysql.jdbc.log.Log;
 import com.mysql.jdbc.log.LogFactory;
 import com.mysql.jdbc.log.NullLogger;
@@ -312,26 +310,14 @@
 
 	private static synchronized int getNextRoundRobinHostIndex(String url,
 			List hostList) {
-		if (roundRobinStatsMap == null) {
-			roundRobinStatsMap = new HashMap();
-		}
-
-		int[] index = (int[]) roundRobinStatsMap.get(url);
-
-		if (index == null) {
-			index = new int[1];
-			index[0] = -1;
-
-			roundRobinStatsMap.put(url, index);
-		}
-
-		index[0]++;
-
-		if (index[0] >= hostList.size()) {
-			index[0] = 0;
-		}
-
-		return index[0];
+		// we really do "random" here, because you don't get even
+		// distribution when this is coupled with connection pools
+		
+		int indexRange = hostList.size() - 1;
+		
+		int index = (int)(Math.random() * indexRange);
+		
+		return index;
 	}
 
 	private static boolean nullSafeCompare(String s1, String s2) {
@@ -614,6 +600,7 @@
 
 	private boolean storesLowerCaseTableName;
 
+	private List statementInterceptors;
 	/**'
 	 * For the delegate only
 	 */
@@ -731,10 +718,13 @@
 
 		this.props = info;
 		initializeDriverProperties(info);
-
+		
+		
 		try {
 			this.dbmd = getMetaData(false, false);
 			createNewIO(false);
+			initializeStatementInterceptors();
+			this.io.setStatementInterceptors(this.statementInterceptors);
 		} catch (SQLException ex) {
 			cleanup(ex);
 
@@ -745,7 +735,7 @@
 
 			StringBuffer mesg = new StringBuffer(128);
 
-			if (getParanoid()) {
+			if (!getParanoid()) {
 				mesg.append("Cannot connect to MySQL server on ");
 				mesg.append(this.host);
 				mesg.append(":");
@@ -775,6 +765,16 @@
 		}
 	}
 
+    protected void initializeStatementInterceptors() throws SQLException {
+		this.statementInterceptors = Util.loadExtensions(this, this.props, 
+				getStatementInterceptors(),
+				"MysqlIo.BadStatementInterceptor");
+	}
+    
+    protected List getStatementInterceptorsInstances() {
+    	return this.statementInterceptors;
+    }
+    
 	private void addToHistogram(int[] histogramCounts,
 			long[] histogramBreakpoints, long value, int numberOfTimes,
 			long currentLowerBound, long currentUpperBound) {
@@ -1553,7 +1553,7 @@
 				if (this.autoCommit && !getRelaxAutoCommit()) {
 					throw SQLError.createSQLException("Can't call commit when autocommit=true");
 				} else if (this.transactionsSupported) {
-					if (getUseLocalSessionState() && versionMeetsMinimum(5, 0, 0)) {
+					if (getUseLocalTransactionState() && versionMeetsMinimum(5, 0, 0)) {
 						if (!this.io.inTransactionOnServer()) {
 							return; // effectively a no-op
 						}
@@ -2194,7 +2194,7 @@
 										mergedProps);
 								this.io.doHandshake(this.user, this.password,
 										this.database);
-								pingInternal(false);
+								pingInternal(false, 0);
 								this.connectionId = this.io.getThreadId();
 								this.isClosed = false;
 	
@@ -2320,10 +2320,7 @@
 			} finally {
 				this.queriesIssuedFailedOver = queriesIssuedFailedOverCopy;
 				
-				if (this.io != null && getStatementInterceptors() != null) {
-					this.io.initializeStatementInterceptors(
-							getStatementInterceptors(), mergedProps);
-				}
+				initializeStatementInterceptors();
 			}
 		}
 	}
@@ -2531,7 +2528,7 @@
 					&& (this.autoCommit || getAutoReconnectForPools())
 					&& this.needsPing && !isBatch) {
 				try {
-					pingInternal(false);
+					pingInternal(false, 0);
 
 					this.needsPing = false;
 				} catch (Exception Ex) {
@@ -3374,7 +3371,7 @@
 
 			this.storesLowerCaseTableName = "1".equalsIgnoreCase(lowerCaseTables) ||
 				"on".equalsIgnoreCase(lowerCaseTables);
-			
+
 			configureTimezone();
 
 			if (this.serverVariables.containsKey("max_allowed_packet")) {
@@ -3915,10 +3912,10 @@
 	 *             if the ping fails
 	 */
 	public void ping() throws SQLException {
-		pingInternal(true);
+		pingInternal(true, 0);
 	}
 
-	protected void pingInternal(boolean checkForClosedConnection)
+	protected void pingInternal(boolean checkForClosedConnection, int timeoutMillis)
 			throws SQLException {
 		if (checkForClosedConnection) {
 			checkClosed();
@@ -3938,7 +3935,7 @@
 					SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE);
 		}
 		// Need MySQL-3.22.1, but who uses anything older!?
-		this.io.sendCommand(MysqlDefs.PING, null, null, false, null);
+		this.io.sendCommand(MysqlDefs.PING, null, null, false, null, timeoutMillis);
 	}
 
 	/**
@@ -4284,9 +4281,16 @@
 			} else {
 				this.io.forceClose();
 			}
+			
+	    	if (this.statementInterceptors != null) {
+	    		for (int i = 0; i < this.statementInterceptors.size(); i++) {
+	    			((StatementInterceptor)this.statementInterceptors.get(i)).destroy();
+	    		}
+	    	}
 		} finally {
 			this.openStatements = null;
 			this.io = null;
+			this.statementInterceptors = null;
 			ProfilerEventHandlerFactory.removeInstance(this);
 			this.isClosed = true;
 		}
@@ -4714,7 +4718,7 @@
 	}
 
 	private void rollbackNoChecks() throws SQLException {
-		if (getUseLocalSessionState() && versionMeetsMinimum(5, 0, 0)) {
+		if (getUseLocalTransactionState() && versionMeetsMinimum(5, 0, 0)) {
 			if (!this.io.inTransactionOnServer()) {
 				return; // effectively a no-op
 			}
@@ -4990,6 +4994,10 @@
 	 *            The failedOver to set.
 	 */
 	public synchronized void setFailedOver(boolean flag) {
+		if (flag && getRoundRobinLoadBalance()) {
+			return; // we don't failover for round-robin load-balanced connections
+		}
+		
 		this.failedOver = flag;
 	}
 
@@ -5000,6 +5008,10 @@
 	 *             DOCUMENT ME!
 	 */
 	private void setFailedOverState() throws SQLException {
+		if (getRoundRobinLoadBalance()) {
+			return; // we don't failover for round-robin load-balanced connections
+		}
+		
 		if (getFailOverReadOnly()) {
 			setReadOnlyInternal(true);
 		}
@@ -5285,7 +5297,7 @@
 	 */
 	public void shutdownServer() throws SQLException {
 		try {
-			this.io.sendCommand(MysqlDefs.SHUTDOWN, null, null, false, null);
+			this.io.sendCommand(MysqlDefs.SHUTDOWN, null, null, false, null, 0);
 		} catch (Exception ex) {
 			SQLException sqlEx = SQLError.createSQLException(
 					Messages.getString("Connection.UnhandledExceptionDuringShutdown"),
@@ -5530,6 +5542,33 @@
         return (MysqlIO) Util.getInstance(getMysqlIOFactory(), argTypes, args);
     }
 
+	
+	protected void transactionBegun() throws SQLException {
+		if (this.connectionLifecycleInterceptors != null) {
+			IterateBlock iter = new IterateBlock(this.connectionLifecycleInterceptors.iterator()) {
+
+				void forEach(Object each) throws SQLException {
+					((ConnectionLifecycleInterceptor)each).transactionBegun();
+				}
+			};
+			
+			iter.doForAll();
+		}
+	}
+	
+	protected void transactionCompleted() throws SQLException {
+		if (this.connectionLifecycleInterceptors != null) {
+			IterateBlock iter = new IterateBlock(this.connectionLifecycleInterceptors.iterator()) {
+
+				void forEach(Object each) throws SQLException {
+					((ConnectionLifecycleInterceptor)each).transactionCompleted();
+				}
+			};
+			
+			iter.doForAll();
+		}
+	}
+	
 	public boolean storesLowerCaseTableName() {
 		return storesLowerCaseTableName;
 	}

Modified: trunk/src/com/mysql/jdbc/ConnectionLifecycleInterceptor.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionLifecycleInterceptor.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ConnectionLifecycleInterceptor.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -112,4 +112,16 @@
 	 * @throws SQLException if an error occurs
 	 */
 	public abstract boolean setCatalog(String catalog) throws SQLException;
+	
+	/**
+	 * Called when the driver has been told by the server that a transaction
+	 * is now in progress (when one has not been currently in progress).
+	 */
+	public abstract boolean transactionBegun() throws SQLException;
+	
+	/**
+	 * Called when the driver has been told by the server that a transaction
+	 * has completed, and no transaction is currently in progress.
+	 */
+	public abstract boolean transactionCompleted() throws SQLException;
 }

Modified: trunk/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionProperties.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ConnectionProperties.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -1581,20 +1581,28 @@
 	
 	public boolean getVerifyServerCertificate();
 
-	public void setVerifyServerCertificate(boolean flag);
+	public abstract void setVerifyServerCertificate(boolean flag);
 	
 	public abstract boolean getUseLegacyDatetimeCode();
 
 	public abstract void setUseLegacyDatetimeCode(boolean flag);
 	
-	public int getSelfDestructOnPingSecondsLifetime();
+	public abstract int getSelfDestructOnPingSecondsLifetime();
 
-	public void setSelfDestructOnPingSecondsLifetime(int seconds);
+	public abstract void setSelfDestructOnPingSecondsLifetime(int seconds);
 
-	public int getSelfDestructOnPingMaxOperations();
+	public abstract int getSelfDestructOnPingMaxOperations();
 
-	public void setSelfDestructOnPingMaxOperations(int maxOperations);
+	public abstract void setSelfDestructOnPingMaxOperations(int maxOperations);
+	
+	public abstract boolean getUseColumnNamesInFindColumn();
 
+	public abstract void setUseColumnNamesInFindColumn(boolean flag);
+	
+	public abstract boolean getUseLocalTransactionState();
+
+	public abstract void setUseLocalTransactionState(boolean flag);
+
     public String getMysqlIOFactory();
 
     public void setMysqlIOFactory(String mysqlIOFactoryClassName);

Modified: trunk/src/com/mysql/jdbc/ConnectionPropertiesImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionPropertiesImpl.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ConnectionPropertiesImpl.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -300,7 +300,7 @@
 					errorMessageBuf.append(", "); //$NON-NLS-1$
 					errorMessageBuf.append("'"); //$NON-NLS-1$
 					errorMessageBuf.append(validateAgainst[i]);
-					errorMessageBuf.append(Messages.getString("'")); //$NON-NLS-1$
+					errorMessageBuf.append("'"); //$NON-NLS-1$
 				}
 
 				errorMessageBuf.append(" or '"); //$NON-NLS-1$
@@ -1446,6 +1446,12 @@
 			Messages.getString("ConnectionProperties.useCompression"), //$NON-NLS-1$
 			"3.0.17", CONNECTION_AND_AUTH_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
 
+	private BooleanConnectionProperty useColumnNamesInFindColumn = new BooleanConnectionProperty(
+			"useColumnNamesInFindColumn",
+			false, 
+			Messages.getString("ConnectionProperties.useColumnNamesInFindColumn"), //$NON-NLS-1$
+			"5.1.7", MISC_CATEGORY, Integer.MAX_VALUE); //$NON-NLS-1$
+	
 	private StringConnectionProperty useConfigs = new StringConnectionProperty(
 			"useConfigs", //$NON-NLS-1$
 			null,
@@ -1503,8 +1509,14 @@
 			"useLocalSessionState", //$NON-NLS-1$
 			false,
 			Messages.getString("ConnectionProperties.useLocalSessionState"), //$NON-NLS-1$
-			"3.1.7", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
+			"3.1.7", PERFORMANCE_CATEGORY, 5); //$NON-NLS-1$
 	
+	private BooleanConnectionProperty useLocalTransactionState = new BooleanConnectionProperty(
+			"useLocalTransactionState", //$NON-NLS-1$
+			false,
+			Messages.getString("ConnectionProperties.useLocalTransactionState"),
+			"5.1.7", PERFORMANCE_CATEGORY, 6);
+	
 	private BooleanConnectionProperty useLegacyDatetimeCode = new BooleanConnectionProperty(
 			"useLegacyDatetimeCode",
 			true,
@@ -2713,8 +2725,9 @@
 				String testString = "abc"; //$NON-NLS-1$
 				testString.getBytes(testEncoding);
 			} catch (UnsupportedEncodingException UE) {
-				throw SQLError.createSQLException(Messages.getString("ConnectionProperties.unsupportedCharacterEncoding") + Messages.getString("ConnectionProperties.unsupportedCharacterEncoding.1") //$NON-NLS-1$ //$NON-NLS-2$
-						+ testEncoding + Messages.getString("ConnectionProperties.unsupportedCharacterEncoding.2"), "0S100"); //$NON-NLS-1$ //$NON-NLS-2$
+				throw SQLError.createSQLException(Messages.getString(
+						"ConnectionProperties.unsupportedCharacterEncoding", 
+						new Object[] {testEncoding}), "0S100"); //$NON-NLS-1$ //$NON-NLS-2$
 			}
 		}
 
@@ -4378,4 +4391,20 @@
     public void setMysqlIOFactory(String mysqlIOFactoryClassName) {
         this.mysqlIOFactory.setValue(mysqlIOFactoryClassName);
     }
+
+	public boolean getUseColumnNamesInFindColumn() {
+		return this.useColumnNamesInFindColumn.getValueAsBoolean();
+	}
+
+	public void setUseColumnNamesInFindColumn(boolean flag) {
+		this.useColumnNamesInFindColumn.setValue(flag);
+	}
+
+	public boolean getUseLocalTransactionState() {
+		return this.useLocalTransactionState.getValueAsBoolean();
+	}
+
+	public void setUseLocalTransactionState(boolean flag) {
+		this.useLocalTransactionState.setValue(flag);
+	}
 }

Modified: trunk/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- trunk/src/com/mysql/jdbc/DatabaseMetaData.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/DatabaseMetaData.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -223,12 +223,18 @@
 				this.columnSize = Constants.integerValueOf(maxLength);
 				this.decimalDigits = null;
 			} else if (StringUtils.startsWithIgnoreCase(typeInfo, "set")) {
-				String temp = typeInfo.substring(typeInfo.indexOf("("),
+				String temp = typeInfo.substring(typeInfo.indexOf("(") + 1,
 						typeInfo.lastIndexOf(")"));
 				java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(
 						temp, ",");
 				int maxLength = 0;
 
+				int numElements = tokenizer.countTokens();
+				
+				if (numElements > 0) {
+					maxLength += (numElements - 1);
+				}
+				
 				while (tokenizer.hasMoreTokens()) {
 					String setMember = tokenizer.nextToken().trim();
 
@@ -1892,18 +1898,26 @@
 
 		int startLookingAt = positionOfReturnKeyword + "RETURNS".length() + 1;
 
+		int endOfReturn = -1;
+		
 		for (int i = 0; i < tokens.length; i++) {
-			int endOfReturn = StringUtils.indexOfIgnoreCaseRespectQuotes(
+			int nextEndOfReturn = StringUtils.indexOfIgnoreCaseRespectQuotes(
 					startLookingAt, procedureDefn, tokens[i], quoteChar
 							.charAt(0), !this.conn.isNoBackslashEscapesSet());
 
-			if (endOfReturn != -1) {
-				return endOfReturn;
+			if (nextEndOfReturn != -1) {
+				if (endOfReturn == -1 || (nextEndOfReturn < endOfReturn)) {
+					endOfReturn = nextEndOfReturn;
+				}
 			}
 		}
+		
+		if (endOfReturn != -1) {
+			return endOfReturn;
+		}
 
 		// Label?
-		int endOfReturn = StringUtils.indexOfIgnoreCaseRespectQuotes(
+		endOfReturn = StringUtils.indexOfIgnoreCaseRespectQuotes(
 				startLookingAt, procedureDefn, ":", quoteChar.charAt(0),
 				!this.conn.isNoBackslashEscapesSet());
 
@@ -7129,7 +7143,6 @@
 	public boolean storesMixedCaseIdentifiers() throws SQLException {
 		return !this.conn.storesLowerCaseTableName();
 	}
-
 	/**
 	 * Does the database store mixed case quoted SQL identifiers in mixed case?
 	 * A JDBC compliant driver will always return false.

Modified: trunk/src/com/mysql/jdbc/ExportControlled.java
===================================================================
--- trunk/src/com/mysql/jdbc/ExportControlled.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ExportControlled.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -148,7 +148,7 @@
 							SQL_STATE_BAD_SSL_PARAMS, 0, false);
 		}
 
-		if (StringUtils.isNullOrEmpty(clientCertificateKeyStoreUrl)) {
+		if (!StringUtils.isNullOrEmpty(clientCertificateKeyStoreUrl)) {
 			try {
 				if (!StringUtils.isNullOrEmpty(clientCertificateKeyStoreType)) {
 					KeyStore clientKeyStore = KeyStore
@@ -190,7 +190,7 @@
 			}
 		}
 
-		if (StringUtils.isNullOrEmpty(trustCertificateKeyStoreUrl)) {
+		if (!StringUtils.isNullOrEmpty(trustCertificateKeyStoreUrl)) {
 
 			try {
 				if (!StringUtils.isNullOrEmpty(trustCertificateKeyStoreType)) {

Modified: trunk/src/com/mysql/jdbc/JDBC4Connection.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4Connection.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/JDBC4Connection.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -93,36 +93,10 @@
 			return false;
 		}
 		
-		TimerTask timeoutTask = null;
-		
-		if (timeout != 0) {
-			timeoutTask = new TimerTask() { 
-				public void run() {
-					new Thread() {
-						public void run() {
-							try {
-								abortInternal();
-							} catch (Throwable t) {
-								throw new RuntimeException(t);
-							}
-						}
-					}.start();	
-				}
-			};
-			
-			getCancelTimer().schedule(timeoutTask, timeout * 1000);
-		}
-		
 		try {
 			synchronized (getMutex()) {
 				try {
-					pingInternal(false);
-					
-					if (timeoutTask != null) {
-						timeoutTask.cancel();
-					}
-					
-					timeoutTask = null;
+					pingInternal(false, timeout * 1000);
 				} catch (Throwable t) {
 					try {
 						abortInternal();
@@ -131,10 +105,6 @@
 					}
 					
 					return false;
-				} finally {
-					if (timeoutTask != null) {
-						timeoutTask.cancel();
-					}
 				}
 			}
 		} catch (Throwable t) {

Modified: trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
===================================================================
--- trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -275,6 +275,14 @@
 
 		String methodName = method.getName();
 
+		if ("equals".equals(methodName) && args.length == 1) {
+			if (args[0] instanceof Proxy) {
+				return Boolean.valueOf((((Proxy)args[0]).equals(this)));
+			}
+			
+			return Boolean.valueOf(equals(args[0]));
+		}
+		
 		if ("close".equals(methodName)) {
 			synchronized (this.liveConnections) {
 				// close all underlying connections

Modified: trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties
===================================================================
--- trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties	2008-07-30 14:53:03 UTC (rev 6800)
@@ -163,9 +163,9 @@
 CommunicationsException.7='wait_timeout' or 'interactive_timeout' configuration values from 
 CommunicationsException.8=the server.
 CommunicationsException.9_1=The last packet successfully received from the server was
-CommunicationsException.9_2=\ seconds ago.
+CommunicationsException.9_2=\ milliseconds ago.
 CommunicationsException.9=The last packet sent successfully to the server was 
-CommunicationsException.10=\ seconds ago, which 
+CommunicationsException.10=\ milliseconds ago, which 
 CommunicationsException.11=. You should consider either expiring and/or testing connection validity 
 CommunicationsException.12=before use in your application, increasing the server configured values for client timeouts, 
 CommunicationsException.13=or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
@@ -225,9 +225,13 @@
 ChannelBuffer.1='
 Field.12=Unsupported character encoding '
 Field.13='
+
 Blob.0=indexToWriteAt must be >= 1
 Blob.1=IO Error while writing bytes to blob
 Blob.2=Position 'pos' can not be < 1
+Blob.invalidStreamLength=Requested stream length of {2} is out of range, given blob length of {0} and starting position of {1}.
+Blob.invalidStreamPos=Position 'pos' can not be < 1 or > blob length.
+
 StringUtils.0=Unsupported character encoding '
 StringUtils.1='.
 StringUtils.5=Unsupported character encoding '
@@ -422,7 +426,8 @@
 JDBC4Connection.ClientInfoNotImplemented=Configured clientInfoProvider class '{0}' does not implement com.mysql.jdbc.JDBC4ClientInfoProvider.
 
 InvalidLoadBalanceStrategy=Invalid load balancing strategy '{0}'.
-Connection.Connection.BadValueInServerVariables=Invalid value '{1}' for server variable named '{0}', falling back to sane default of '{2}'.
+Connection.BadValueInServerVariables=Invalid value '{1}' for server variable named '{0}', falling back to sane default of '{2}'.
+LoadBalancingConnectionProxy.badValueForRetriesAllDown=Bad value '{0}' for property "retriesAllDown".
 
 Connection.UnableToConnect=Could not create connection to database server.
 Connection.UnableToConnectWithRetries=Could not create connection to database server. \
@@ -576,6 +581,7 @@
 ConnectionProperties.useInformationSchema=When connected to MySQL-5.0.7 or newer, should the driver use the INFORMATION_SCHEMA to derive information used by DatabaseMetaData?
 ConnectionProperties.useJDBCCompliantTimezoneShift=Should the driver use JDBC-compliant rules when converting TIME/TIMESTAMP/DATETIME values' timezone information for those JDBC arguments which take a java.util.Calendar argument? (Notice that this option is exclusive of the "useTimezone=true" configuration option.)
 ConnectionProperties.useLocalSessionState=Should the driver refer to the internal values of autocommit and transaction isolation that are set by Connection.setAutoCommit() and Connection.setTransactionIsolation() and transaction state as maintained by the protocol, rather than querying the database or blindly sending commands to the database for commit() or rollback() method calls?
+ConnectionProperties.useLocalTransactionState=Should the driver use the in-transaction state provided by the MySQL protocol to determine if a commit() or rollback() should actually be sent to the database?
 ConnectionProperties.useNanosForElapsedTime=For profiling/debugging functionality that measures elapsed time, should the driver try to use nanoseconds resolution if available (JDK >= 1.5)?
 ConnectionProperties.useOldAliasMetadataBehavior=Should the driver use the legacy behavior for "AS" clauses on columns and tables, and only return aliases (if any) for ResultSetMetaData.getColumnName() or ResultSetMetaData.getTableName() rather than the original column/table name? In 5.0.x, the default value was true.
 ConnectionProperties.useOldUtf8Behavior=Use the UTF-8 behavior the driver did when communicating with 4.0 and older servers
@@ -608,13 +614,13 @@
 ConnectionProperties.utf8OutsideBmpExcludedColumnNamePattern=When "useBlobToStoreUTF8OutsideBMP" is set to "true", column names matching the given regex will still be treated as BLOBs unless they match the regex specified for "utf8OutsideBmpIncludedColumnNamePattern". The regex must follow the patterns used for the java.util.regex package.
 ConnectionProperties.utf8OutsideBmpIncludedColumnNamePattern=Used to specify exclusion rules to "utf8OutsideBmpExcludedColumnNamePattern". The regex must follow the patterns used for the java.util.regex package.
 ConnectionProperties.useLegacyDatetimeCode=Use code for DATE/TIME/DATETIME/TIMESTAMP handling in result sets and statements that consistently handles timezone conversions from client to server and back again, or use the legacy code for these datatypes that has been in the driver for backwards-compatibility?
-
+ConnectionProperties.useColumnNamesInFindColumn=Prior to JDBC-4.0, the JDBC specification had a bug related to what could be given as a "column name" to ResultSet methods like findColumn(), or getters that took a String property. JDBC-4.0 clarified "column name" to mean the label, as given in an "AS" clause and returned by ResultSetMetaData.getColumnLabel(), and if no AS clause, the column name. Setting this property to "true" will give behavior that is congruent to JDBC-3.0 and earlier versions of the JDBC specification, but which because of the specification bug could give unexpected results. This property is preferred over "useOldAliasMetadataBehavior" unless you need the specific behavior that it provides with respect to ResultSetMetadata.
 # 
 # Error Messages for Connection Properties
 #
 
 ConnectionProperties.unableToInitDriverProperties=Unable to initialize driver properties due to 
-ConnectionProperties.unsupportedCharacterEncoding=Unsupported character encoding '${0}'.
+ConnectionProperties.unsupportedCharacterEncoding=Unsupported character encoding ''{0}''.
 ConnectionProperties.errorNotExpected=Huh?
 ConnectionProperties.InternalPropertiesFailure=Internal properties failure
 
@@ -622,4 +628,6 @@
 configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a \
 more specifc timezone value if you want to utilize timezone support. The timezones that ''{0}'' maps to are: {1}.
 
-Connection.exceededConnectionLifetime=Ping or validation failed because configured connection lifetime exceeded.
\ No newline at end of file
+Connection.exceededConnectionLifetime=Ping or validation failed because configured connection lifetime exceeded.
+Connection.badLifecycleInterceptor=Unable to load connection lifecycle interceptor ''{0}''.
+MysqlIo.BadStatementInterceptor=Unable to load statement interceptor ''{0}''.
\ No newline at end of file

Modified: trunk/src/com/mysql/jdbc/MysqlIO.java
===================================================================
--- trunk/src/com/mysql/jdbc/MysqlIO.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/MysqlIO.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -41,9 +41,6 @@
 
     long getLastPacketSentTimeMs();
 
-    void initializeStatementInterceptors(String interceptorClasses,
-        Properties props) throws SQLException;
-
     ResultSetInternalMethods sqlQueryDirect(StatementImpl callingStatement,
         String query, String characterEncoding, Buffer queryPacket,
         int maxRows, int resultSetType, int resultSetConcurrency,
@@ -71,7 +68,7 @@
     boolean isSetNeededForAutoCommitMode(boolean autoCommitFlag);
 
     Buffer sendCommand(int command, String extraData, Buffer queryPacket,
-        boolean skipCheck, String extraDataCharEncoding) throws SQLException;
+        boolean skipCheck, String extraDataCharEncoding, int timeoutMillis) throws SQLException;
 
     int getCommandCount();
 
@@ -96,4 +93,6 @@
 
 	public long getLastPacketReceivedTimeMs();
 
+	public void setStatementInterceptors(List statementInterceptors);
+
 }

Modified: trunk/src/com/mysql/jdbc/MysqlIOprotocol.java
===================================================================
--- trunk/src/com/mysql/jdbc/MysqlIOprotocol.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/MysqlIOprotocol.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -37,6 +37,7 @@
 import java.net.ConnectException;
 import java.net.MalformedURLException;
 import java.net.Socket;
+import java.net.SocketException;
 import java.net.URL;
 import java.security.NoSuchAlgorithmException;
 import java.sql.ResultSet;
@@ -216,6 +217,7 @@
     protected int serverCapabilities;
     private int serverMajorVersion = 0;
     private int serverMinorVersion = 0;
+    private int oldServerStatus = 0;
     private int serverStatus = 0;
     private int serverSubMinorVersion = 0;
     private int warningCount = 0;
@@ -232,10 +234,10 @@
 	private boolean useNanosForElapsedTime;
 	private long slowQueryThreshold;
 	private String queryTimingUnits;
-	private List statementInterceptors;
 	private boolean useDirectRowUnpack = true;
 	private int useBufferRowSizeThreshold;
 	private int commandCount = 0;
+	List statementInterceptors;
 
     /**
      * Constructor:  Connect to the MySQL server and setup a stream connection.
@@ -344,13 +346,6 @@
         }
     }
 
-    public void initializeStatementInterceptors(String interceptorClasses,
-			Properties props) throws SQLException {
-		this.statementInterceptors = Util.loadExtensions(this.connection, props, 
-				interceptorClasses,
-				"MysqlIo.BadStatementInterceptor");
-	}
-
     /**
 	 * Does the server send back extra column info?
 	 * 
@@ -1182,6 +1177,7 @@
             /* New protocol with 16 bytes to describe server characteristics */
             this.serverCharsetIndex = buf.readByte() & 0xff;
             this.serverStatus = buf.readInt();
+            checkTransactionState(0);
             buf.setPosition(position + 16);
 
             String seedPart2 = buf.readString("ASCII");
@@ -1367,13 +1363,13 @@
 		}
 
 		try {
-		    sendCommand(MysqlDefs.INIT_DB, database, null, false, null);
+		    sendCommand(MysqlDefs.INIT_DB, database, null, false, null, 0);
 		} catch (Exception ex) {
 			if (this.connection.getCreateDatabaseIfNotExist()) {
 				sendCommand(MysqlDefs.QUERY, "CREATE DATABASE IF NOT EXISTS " +
 					database,
-					null, false, null);
-				sendCommand(MysqlDefs.INIT_DB, database, null, false, null);
+					null, false, null, 0);
+				sendCommand(MysqlDefs.INIT_DB, database, null, false, null, 0);
 			} else {
 				throw SQLError.createCommunicationsException(this.connection,
 						this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ex);
@@ -1566,8 +1562,12 @@
 															// sendCommand()
 							}
 
+							this.oldServerStatus = this.serverStatus;
+							
 							this.serverStatus = (this.mysqlInput.read() & 0xff)
 									| ((this.mysqlInput.read() & 0xff) << 8);
+							checkTransactionState(oldServerStatus);
+							
 							remaining -= 2;
 
 							if (remaining > 0) {
@@ -1837,7 +1837,7 @@
      */
 
     public final Buffer sendCommand(int command, String extraData, Buffer queryPacket,
-        boolean skipCheck, String extraDataCharEncoding)
+        boolean skipCheck, String extraDataCharEncoding, int timeoutMillis)
         throws SQLException {
     	this.commandCount++;
     	
@@ -1850,6 +1850,18 @@
         this.traceProtocol = this.connection.getTraceProtocol();
         this.readPacketSequence = 0;
 
+        int oldTimeout = 0;
+        
+        if (timeoutMillis != 0) {
+        	try {
+        		oldTimeout = this.mysqlConnection.getSoTimeout();
+				this.mysqlConnection.setSoTimeout(timeoutMillis);
+			} catch (SocketException e) {
+				throw SQLError.createCommunicationsException(this.connection, lastPacketSentTimeMs, 
+						lastPacketReceivedTimeMs, e);
+			}
+        }
+        
         try {
 
             checkForOutstandingStreamingData();
@@ -1857,6 +1869,7 @@
             // Clear serverStatus...this value is guarded by an
             // external mutex, as you can only ever be processing
             // one command at a time
+            this.oldServerStatus = this.serverStatus;
             this.serverStatus = 0;
             this.hadWarnings = false;
             this.warningCount = 0;
@@ -1948,6 +1961,15 @@
         } catch (IOException ioEx) {
             throw SQLError.createCommunicationsException(this.connection,
                 this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
+        } finally {
+        	if (timeoutMillis != 0) {
+        		try {
+        			this.mysqlConnection.setSoTimeout(oldTimeout);
+        		} catch (SocketException e) {
+    				throw SQLError.createCommunicationsException(this.connection, lastPacketSentTimeMs, 
+    						lastPacketReceivedTimeMs, e);
+    			}
+        	}
         }
     }
 
@@ -2066,7 +2088,7 @@
 
 	    	// Send query command and sql query string
 	    	Buffer resultPacket = sendCommand(MysqlDefs.QUERY, null, queryPacket,
-	    			false, null);
+	    			false, null, 0);
 
 	    	long fetchBeginTime = 0;
 	    	long fetchEndTime = 0;
@@ -2580,8 +2602,11 @@
             }
 
             if (this.use41Extensions) {
+            	// oldStatus set in sendCommand()
                 this.serverStatus = resultPacket.readInt();
 
+                checkTransactionState(oldServerStatus);
+                
                 this.warningCount = resultPacket.readInt();
 
                 if (this.warningCount > 0) {
@@ -2699,7 +2724,9 @@
                 this.hadWarnings = true; // this is a 'latch', it's reset by sendCommand()
             }
 
+            this.oldServerStatus = this.serverStatus;
             this.serverStatus = rowPacket.readInt();
+            checkTransactionState(oldServerStatus);
 
             if (this.profileSql) {
                 this.queryNoIndexUsed = (this.serverStatus &
@@ -3167,7 +3194,7 @@
     	buf.clear();
     	buf.writeByte((byte)MysqlDefs.COM_SET_OPTION);
     	buf.writeInt(0);
-    	sendCommand(MysqlDefs.COM_SET_OPTION, null, buf, false, null);
+    	sendCommand(MysqlDefs.COM_SET_OPTION, null, buf, false, null, 0);
     }
 
     public void disableMultiQueries() throws SQLException {
@@ -3176,7 +3203,7 @@
     	buf.clear();
     	buf.writeByte((byte)MysqlDefs.COM_SET_OPTION);
     	buf.writeInt(1);
-    	sendCommand(MysqlDefs.COM_SET_OPTION, null, buf, false, null);
+    	sendCommand(MysqlDefs.COM_SET_OPTION, null, buf, false, null, 0);
     }
 
     private final void send(Buffer packet, int packetLen)
@@ -3544,12 +3571,14 @@
 
 				if (rs.next()) {
 					errorBuf.append("\n\n");
-					errorBuf.append(rs.getString(1));
+					errorBuf.append(rs.getString("Status"));
 				} else {
+					errorBuf.append("\n\n");
 					errorBuf.append(Messages
 							.getString("MysqlIO.NoInnoDBStatusFound"));
 				}
 			} catch (Exception ex) {
+				errorBuf.append("\n\n");
 				errorBuf.append(Messages
 						.getString("MysqlIO.InnoDBStatusFailed"));
 				errorBuf.append("\n\n");
@@ -4538,7 +4567,7 @@
 		this.sharedSendPacket.writeLong(fetchSize);
 
 		sendCommand(MysqlDefs.COM_FETCH, null, this.sharedSendPacket, true,
-				null);
+				null, 0);
 
 		ResultSetRow row = null;
 
@@ -4577,4 +4606,19 @@
 	public void setServerCharsetIndex(int serverCharsetIndex) {
 	    this.serverCharsetIndex = serverCharsetIndex;
     }
-}
+    
+	private void checkTransactionState(int oldStatus) throws SQLException {
+		boolean previouslyInTrans = ((oldStatus & SERVER_STATUS_IN_TRANS) != 0);
+		boolean currentlyInTrans = ((this.serverStatus & SERVER_STATUS_IN_TRANS) != 0);
+
+		if (previouslyInTrans && !currentlyInTrans) {
+			this.connection.transactionCompleted();
+		} else if (!previouslyInTrans && currentlyInTrans) {
+			this.connection.transactionBegun();
+		}
+	}
+
+	public void setStatementInterceptors(List statementInterceptors) {
+		this.statementInterceptors = statementInterceptors;
+	}
+}
\ No newline at end of file

Modified: trunk/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/PreparedStatement.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/PreparedStatement.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -54,8 +54,10 @@
 import java.util.Locale;
 import java.util.TimeZone;
 
+import com.mysql.jdbc.exceptions.DeadlockTimeoutRollbackMarker;
 import com.mysql.jdbc.exceptions.MySQLStatementCancelledException;
 import com.mysql.jdbc.exceptions.MySQLTimeoutException;
+import com.mysql.jdbc.exceptions.MySQLTransactionRollbackException;
 import com.mysql.jdbc.profiler.ProfilerEvent;
 
 /**
@@ -701,7 +703,9 @@
 		StringBuffer buf = new StringBuffer();
 
 		try {
-			for (int i = 0; i < this.parameterCount; ++i) {
+			int realParameterCount = this.parameterCount + getParameterIndexOffset();
+			
+			for (int i = 0; i < realParameterCount; ++i) {
 				if (this.charEncoding != null) {
 					buf.append(new String(this.staticSqlStrings[i],
 							this.charEncoding));
@@ -747,12 +751,12 @@
 
 			if (this.charEncoding != null) {
 				buf.append(new String(
-						this.staticSqlStrings[this.parameterCount],
+						this.staticSqlStrings[this.parameterCount + getParameterIndexOffset()],
 						this.charEncoding));
 			} else {
 				buf
 						.append(StringUtils
-								.toAsciiString(this.staticSqlStrings[this.parameterCount]));
+								.toAsciiString(this.staticSqlStrings[this.parameterCount + getParameterIndexOffset()]));
 			}
 		} catch (UnsupportedEncodingException uue) {
 			throw new RuntimeException(Messages
@@ -1647,7 +1651,8 @@
 	
 							if (this.continueBatchOnError && 
 									!(ex instanceof MySQLTimeoutException) && 
-									!(ex instanceof MySQLStatementCancelledException)) {
+									!(ex instanceof MySQLStatementCancelledException) &&
+									!hasDeadlockOrTimeoutRolledBackTx(ex)) {
 								sqlEx = ex;
 							} else {
 								int[] newUpdateCounts = new int[commandIndex];

Modified: trunk/src/com/mysql/jdbc/ReplicationConnection.java
===================================================================
--- trunk/src/com/mysql/jdbc/ReplicationConnection.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ReplicationConnection.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -30,7 +30,10 @@
 import java.sql.Statement;
 import java.util.Map;
 import java.util.Properties;
+import java.util.TimeZone;
 
+import com.mysql.jdbc.log.Log;
+
 /**
  * Connection that opens two connections, one two a replication master, and
  * another to one or more slaves, and decides to use master when the connection
@@ -39,7 +42,7 @@
  * @version $Id: ReplicationConnection.java,v 1.1.2.1 2005/05/13 18:58:38
  *          mmatthews Exp $
  */
-public class ReplicationConnection implements java.sql.Connection, PingTarget {
+public class ReplicationConnection implements Connection, PingTarget {
 	protected Connection currentConnection;
 
 	protected Connection masterConnection;
@@ -87,10 +90,13 @@
         	slaveUrl.append(slaveDb);
         }
         
+        slaveProperties.setProperty("roundRobinLoadBalance", "true");
+        
         this.masterConnection = (com.mysql.jdbc.Connection) driver.connect(
                 masterUrl.toString(), masterProperties);
         this.slavesConnection = (com.mysql.jdbc.Connection) driver.connect(
                 slaveUrl.toString(), slaveProperties);
+        this.slavesConnection.setReadOnly(true);
         
 		this.currentConnection = this.masterConnection;
 	}
@@ -559,4 +565,1793 @@
 			this.slavesConnection.ping();
 		}
 	}
+
+	public synchronized void changeUser(String userName, String newPassword)
+			throws SQLException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void clearHasTriedMaster() {
+		this.masterConnection.clearHasTriedMaster();
+		this.slavesConnection.clearHasTriedMaster();
+		
+	}
+
+	public synchronized PreparedStatement clientPrepareStatement(String sql)
+			throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.clientPrepareStatement(sql);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement clientPrepareStatement(String sql,
+			int autoGenKeyIndex) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.clientPrepareStatement(sql, autoGenKeyIndex);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement clientPrepareStatement(String sql,
+			int resultSetType, int resultSetConcurrency) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.clientPrepareStatement(sql, resultSetType, resultSetConcurrency);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement clientPrepareStatement(String sql,
+			int[] autoGenKeyIndexes) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.clientPrepareStatement(sql, autoGenKeyIndexes);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement clientPrepareStatement(String sql,
+			int resultSetType, int resultSetConcurrency,
+			int resultSetHoldability) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.clientPrepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement clientPrepareStatement(String sql,
+			String[] autoGenKeyColNames) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.clientPrepareStatement(sql, autoGenKeyColNames);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized int getActiveStatementCount() {
+		return this.currentConnection.getActiveStatementCount();
+	}
+
+	public synchronized long getIdleFor() {
+		return this.currentConnection.getIdleFor();
+	}
+
+	public synchronized Log getLog() throws SQLException {
+		return this.currentConnection.getLog();
+	}
+
+	public synchronized String getServerCharacterEncoding() {
+		return this.currentConnection.getServerCharacterEncoding();
+	}
+
+	public synchronized TimeZone getServerTimezoneTZ() {
+		return this.currentConnection.getServerTimezoneTZ();
+	}
+
+	public synchronized String getStatementComment() {
+		return this.currentConnection.getStatementComment();
+	}
+
+	public synchronized boolean hasTriedMaster() {
+		return this.currentConnection.hasTriedMaster();
+	}
+
+	public synchronized void initializeExtension(Extension ex) throws SQLException {
+		this.currentConnection.initializeExtension(ex);
+	}
+
+	public synchronized boolean isAbonormallyLongQuery(long millisOrNanos) {
+		return this.currentConnection.isAbonormallyLongQuery(millisOrNanos);
+	}
+
+	public synchronized boolean isInGlobalTx() {
+		return this.currentConnection.isInGlobalTx();
+	}
+
+	public synchronized boolean isMasterConnection() {
+		return this.currentConnection.isMasterConnection();
+	}
+
+	public synchronized boolean isNoBackslashEscapesSet() {
+		return this.currentConnection.isNoBackslashEscapesSet();
+	}
+
+	public synchronized boolean lowerCaseTableNames() {
+		return this.currentConnection.lowerCaseTableNames();
+	}
+
+	public synchronized boolean parserKnowsUnicode() {
+		return this.currentConnection.parserKnowsUnicode();
+	}
+
+	public synchronized void ping() throws SQLException {
+		this.masterConnection.ping();
+		this.slavesConnection.ping();
+	}
+
+	public synchronized void reportQueryTime(long millisOrNanos) {
+		this.currentConnection.reportQueryTime(millisOrNanos);
+	}
+
+	public synchronized void resetServerState() throws SQLException {
+		this.currentConnection.resetServerState();
+	}
+
+	public synchronized PreparedStatement serverPrepareStatement(String sql)
+			throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.serverPrepareStatement(sql);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement serverPrepareStatement(String sql,
+			int autoGenKeyIndex) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.serverPrepareStatement(sql, autoGenKeyIndex);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement serverPrepareStatement(String sql,
+			int resultSetType, int resultSetConcurrency) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.serverPrepareStatement(sql, resultSetType, resultSetConcurrency);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement serverPrepareStatement(String sql,
+			int resultSetType, int resultSetConcurrency,
+			int resultSetHoldability) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.serverPrepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement serverPrepareStatement(String sql,
+			int[] autoGenKeyIndexes) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.serverPrepareStatement(sql, autoGenKeyIndexes);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized PreparedStatement serverPrepareStatement(String sql,
+			String[] autoGenKeyColNames) throws SQLException {
+		PreparedStatement pstmt = this.currentConnection.serverPrepareStatement(sql, autoGenKeyColNames);
+		((com.mysql.jdbc.Statement) pstmt).setPingTarget(this);
+		
+		return pstmt;
+	}
+
+	public synchronized void setFailedOver(boolean flag) {
+		this.currentConnection.setFailedOver(flag);
+	}
+
+	public synchronized void setPreferSlaveDuringFailover(boolean flag) {
+		this.currentConnection.setPreferSlaveDuringFailover(flag);
+	}
+
+	public synchronized void setStatementComment(String comment) {
+		this.masterConnection.setStatementComment(comment);
+		this.slavesConnection.setStatementComment(comment);
+	}
+
+	public synchronized void shutdownServer() throws SQLException {
+		this.currentConnection.shutdownServer();
+	}
+
+	public synchronized boolean supportsIsolationLevel() {
+		return this.currentConnection.supportsIsolationLevel();
+	}
+
+	public synchronized boolean supportsQuotedIdentifiers() {
+		return this.currentConnection.supportsQuotedIdentifiers();
+	}
+
+	public synchronized boolean supportsTransactions() {
+		return this.currentConnection.supportsTransactions();
+	}
+
+	public synchronized boolean versionMeetsMinimum(int major, int minor, int subminor)
+			throws SQLException {
+		return this.currentConnection.versionMeetsMinimum(major, minor, subminor);
+	}
+
+	public synchronized String exposeAsXml() throws SQLException {
+		return this.currentConnection.exposeAsXml();
+	}
+
+	public synchronized boolean getAllowLoadLocalInfile() {
+		return this.currentConnection.getAllowLoadLocalInfile();
+	}
+
+	public synchronized boolean getAllowMultiQueries() {
+		return this.currentConnection.getAllowMultiQueries();
+	}
+
+	public synchronized boolean getAllowNanAndInf() {
+		return this.currentConnection.getAllowNanAndInf();
+	}
+
+	public synchronized boolean getAllowUrlInLocalInfile() {
+		return this.currentConnection.getAllowUrlInLocalInfile();
+	}
+
+	public synchronized boolean getAlwaysSendSetIsolation() {
+		return this.currentConnection.getAlwaysSendSetIsolation();
+	}
+
+	public synchronized boolean getAutoClosePStmtStreams() {
+		return this.currentConnection.getAutoClosePStmtStreams();
+	}
+
+	public synchronized boolean getAutoDeserialize() {
+		return this.currentConnection.getAutoDeserialize();
+	}
+
+	public synchronized boolean getAutoGenerateTestcaseScript() {
+		return this.currentConnection.getAutoGenerateTestcaseScript();
+	}
+
+	public synchronized boolean getAutoReconnectForPools() {
+		return this.currentConnection.getAutoReconnectForPools();
+	}
+
+	public synchronized boolean getAutoSlowLog() {
+		return this.currentConnection.getAutoSlowLog();
+	}
+
+	public synchronized int getBlobSendChunkSize() {
+		return this.currentConnection.getBlobSendChunkSize();
+	}
+
+	public synchronized boolean getBlobsAreStrings() {
+		return this.currentConnection.getBlobsAreStrings();
+	}
+
+	public synchronized boolean getCacheCallableStatements() {
+		return this.currentConnection.getCacheCallableStatements();
+	}
+
+	public synchronized boolean getCacheCallableStmts() {
+		return this.currentConnection.getCacheCallableStmts();
+	}
+
+	public synchronized boolean getCachePrepStmts() {
+		return this.currentConnection.getCachePrepStmts();
+	}
+
+	public synchronized boolean getCachePreparedStatements() {
+		return this.currentConnection.getCachePreparedStatements();
+	}
+
+	public synchronized boolean getCacheResultSetMetadata() {
+		return this.currentConnection.getCacheResultSetMetadata();
+	}
+
+	public synchronized boolean getCacheServerConfiguration() {
+		return this.currentConnection.getCacheServerConfiguration();
+	}
+
+	public synchronized int getCallableStatementCacheSize() {
+		return this.currentConnection.getCallableStatementCacheSize();
+	}
+
+	public synchronized int getCallableStmtCacheSize() {
+		return this.currentConnection.getCallableStmtCacheSize();
+	}
+
+	public synchronized boolean getCapitalizeTypeNames() {
+		return this.currentConnection.getCapitalizeTypeNames();
+	}
+
+	public synchronized String getCharacterSetResults() {
+		return this.currentConnection.getCharacterSetResults();
+	}
+
+	public synchronized String getClientCertificateKeyStorePassword() {
+		return this.currentConnection.getClientCertificateKeyStorePassword();
+	}
+
+	public synchronized String getClientCertificateKeyStoreType() {
+		return this.currentConnection.getClientCertificateKeyStoreType();
+	}
+
+	public synchronized String getClientCertificateKeyStoreUrl() {
+		return this.currentConnection.getClientCertificateKeyStoreUrl();
+	}
+
+	public synchronized String getClientInfoProvider() {
+		return this.currentConnection.getClientInfoProvider();
+	}
+
+	public synchronized String getClobCharacterEncoding() {
+		return this.currentConnection.getClobCharacterEncoding();
+	}
+
+	public synchronized boolean getClobberStreamingResults() {
+		return this.currentConnection.getClobberStreamingResults();
+	}
+
+	public synchronized int getConnectTimeout() {
+		return this.currentConnection.getConnectTimeout();
+	}
+
+	public synchronized String getConnectionCollation() {
+		return this.currentConnection.getConnectionCollation();
+	}
+
+	public synchronized String getConnectionLifecycleInterceptors() {
+		return this.currentConnection.getConnectionLifecycleInterceptors();
+	}
+
+	public synchronized boolean getContinueBatchOnError() {
+		return this.currentConnection.getContinueBatchOnError();
+	}
+
+	public synchronized boolean getCreateDatabaseIfNotExist() {
+		return this.currentConnection.getCreateDatabaseIfNotExist();
+	}
+
+	public synchronized int getDefaultFetchSize() {
+		return this.currentConnection.getDefaultFetchSize();
+	}
+
+	public synchronized boolean getDontTrackOpenResources() {
+		return this.currentConnection.getDontTrackOpenResources();
+	}
+
+	public synchronized boolean getDumpMetadataOnColumnNotFound() {
+		return this.currentConnection.getDumpMetadataOnColumnNotFound();
+	}
+
+	public synchronized boolean getDumpQueriesOnException() {
+		return this.currentConnection.getDumpQueriesOnException();
+	}
+
+	public synchronized boolean getDynamicCalendars() {
+		return this.currentConnection.getDynamicCalendars();
+	}
+
+	public synchronized boolean getElideSetAutoCommits() {
+		return this.currentConnection.getElideSetAutoCommits();
+	}
+
+	public synchronized boolean getEmptyStringsConvertToZero() {
+		return this.currentConnection.getEmptyStringsConvertToZero();
+	}
+
+	public synchronized boolean getEmulateLocators() {
+		return this.currentConnection.getEmulateLocators();
+	}
+
+	public synchronized boolean getEmulateUnsupportedPstmts() {
+		return this.currentConnection.getEmulateUnsupportedPstmts();
+	}
+
+	public synchronized boolean getEnablePacketDebug() {
+		return this.currentConnection.getEnablePacketDebug();
+	}
+
+	public synchronized boolean getEnableQueryTimeouts() {
+		return this.currentConnection.getEnableQueryTimeouts();
+	}
+
+	public synchronized String getEncoding() {
+		return this.currentConnection.getEncoding();
+	}
+
+	public synchronized boolean getExplainSlowQueries() {
+		return this.currentConnection.getExplainSlowQueries();
+	}
+
+	public synchronized boolean getFailOverReadOnly() {
+		return this.currentConnection.getFailOverReadOnly();
+	}
+
+	public synchronized boolean getFunctionsNeverReturnBlobs() {
+		return this.currentConnection.getFunctionsNeverReturnBlobs();
+	}
+
+	public synchronized boolean getGatherPerfMetrics() {
+		return this.currentConnection.getGatherPerfMetrics();
+	}
+
+	public synchronized boolean getGatherPerformanceMetrics() {
+		return this.currentConnection.getGatherPerformanceMetrics();
+	}
+
+	public synchronized boolean getGenerateSimpleParameterMetadata() {
+		return this.currentConnection.getGenerateSimpleParameterMetadata();
+	}
+
+	public synchronized boolean getHoldResultsOpenOverStatementClose() {
+		return this.currentConnection.getHoldResultsOpenOverStatementClose();
+	}
+
+	public synchronized boolean getIgnoreNonTxTables() {
+		return this.currentConnection.getIgnoreNonTxTables();
+	}
+
+	public synchronized boolean getIncludeInnodbStatusInDeadlockExceptions() {
+		return this.currentConnection.getIncludeInnodbStatusInDeadlockExceptions();
+	}
+
+	public synchronized int getInitialTimeout() {
+		return this.currentConnection.getInitialTimeout();
+	}
+
+	public synchronized boolean getInteractiveClient() {
+		return this.currentConnection.getInteractiveClient();
+	}
+
+	public synchronized boolean getIsInteractiveClient() {
+		return this.currentConnection.getIsInteractiveClient();
+	}
+
+	public synchronized boolean getJdbcCompliantTruncation() {
+		return this.currentConnection.getJdbcCompliantTruncation();
+	}
+
+	public synchronized boolean getJdbcCompliantTruncationForReads() {
+		return this.currentConnection.getJdbcCompliantTruncationForReads();
+	}
+
+	public synchronized String getLargeRowSizeThreshold() {
+		return this.currentConnection.getLargeRowSizeThreshold();
+	}
+
+	public synchronized String getLoadBalanceStrategy() {
+		return this.currentConnection.getLoadBalanceStrategy();
+	}
+
+	public synchronized String getLocalSocketAddress() {
+		return this.currentConnection.getLocalSocketAddress();
+	}
+
+	public synchronized int getLocatorFetchBufferSize() {
+		return this.currentConnection.getLocatorFetchBufferSize();
+	}
+
+	public synchronized boolean getLogSlowQueries() {
+		return this.currentConnection.getLogSlowQueries();
+	}
+
+	public synchronized boolean getLogXaCommands() {
+		return this.currentConnection.getLogXaCommands();
+	}
+
+	public synchronized String getLogger() {
+		return this.currentConnection.getLogger();
+	}
+
+	public synchronized String getLoggerClassName() {
+		return this.currentConnection.getLoggerClassName();
+	}
+
+	public synchronized boolean getMaintainTimeStats() {
+		return this.currentConnection.getMaintainTimeStats();
+	}
+
+	public synchronized int getMaxQuerySizeToLog() {
+		return this.currentConnection.getMaxQuerySizeToLog();
+	}
+
+	public synchronized int getMaxReconnects() {
+		return this.currentConnection.getMaxReconnects();
+	}
+
+	public synchronized int getMaxRows() {
+		return this.currentConnection.getMaxRows();
+	}
+
+	public synchronized int getMetadataCacheSize() {
+		return this.currentConnection.getMetadataCacheSize();
+	}
+
+	public synchronized int getNetTimeoutForStreamingResults() {
+		return this.currentConnection.getNetTimeoutForStreamingResults();
+	}
+
+	public synchronized boolean getNoAccessToProcedureBodies() {
+		return this.currentConnection.getNoAccessToProcedureBodies();
+	}
+
+	public synchronized boolean getNoDatetimeStringSync() {
+		return this.currentConnection.getNoDatetimeStringSync();
+	}
+
+	public synchronized boolean getNoTimezoneConversionForTimeType() {
+		return this.currentConnection.getNoTimezoneConversionForTimeType();
+	}
+
+	public synchronized boolean getNullCatalogMeansCurrent() {
+		return this.currentConnection.getNullCatalogMeansCurrent();
+	}
+
+	public synchronized boolean getNullNamePatternMatchesAll() {
+		return this.currentConnection.getNullNamePatternMatchesAll();
+	}
+
+	public synchronized boolean getOverrideSupportsIntegrityEnhancementFacility() {
+		return this.currentConnection.getOverrideSupportsIntegrityEnhancementFacility();
+	}
+
+	public synchronized int getPacketDebugBufferSize() {
+		return this.currentConnection.getPacketDebugBufferSize();
+	}
+
+	public synchronized boolean getPadCharsWithSpace() {
+		return this.currentConnection.getPadCharsWithSpace();
+	}
+
+	public synchronized boolean getParanoid() {
+		return this.currentConnection.getParanoid();
+	}
+
+	public synchronized boolean getPedantic() {
+		return this.currentConnection.getPedantic();
+	}
+
+	public synchronized boolean getPinGlobalTxToPhysicalConnection() {
+		return this.currentConnection.getPinGlobalTxToPhysicalConnection();
+	}
+
+	public synchronized boolean getPopulateInsertRowWithDefaultValues() {
+		return this.currentConnection.getPopulateInsertRowWithDefaultValues();
+	}
+
+	public synchronized int getPrepStmtCacheSize() {
+		return this.currentConnection.getPrepStmtCacheSize();
+	}
+
+	public synchronized int getPrepStmtCacheSqlLimit() {
+		return this.currentConnection.getPrepStmtCacheSqlLimit();
+	}
+
+	public synchronized int getPreparedStatementCacheSize() {
+		return this.currentConnection.getPreparedStatementCacheSize();
+	}
+
+	public synchronized int getPreparedStatementCacheSqlLimit() {
+		return this.currentConnection.getPreparedStatementCacheSqlLimit();
+	}
+
+	public synchronized boolean getProcessEscapeCodesForPrepStmts() {
+		return this.currentConnection.getProcessEscapeCodesForPrepStmts();
+	}
+
+	public synchronized boolean getProfileSQL() {
+		return this.currentConnection.getProfileSQL();
+	}
+
+	public synchronized boolean getProfileSql() {
+		return this.currentConnection.getProfileSql();
+	}
+
+	public synchronized String getProfilerEventHandler() {
+		return this.currentConnection.getProfilerEventHandler();
+	}
+
+	public synchronized String getPropertiesTransform() {
+		return this.currentConnection.getPropertiesTransform();
+	}
+
+	public synchronized int getQueriesBeforeRetryMaster() {
+		return this.currentConnection.getQueriesBeforeRetryMaster();
+	}
+
+	public synchronized boolean getReconnectAtTxEnd() {
+		return this.currentConnection.getReconnectAtTxEnd();
+	}
+
+	public synchronized boolean getRelaxAutoCommit() {
+		return this.currentConnection.getRelaxAutoCommit();
+	}
+
+	public synchronized int getReportMetricsIntervalMillis() {
+		return this.currentConnection.getReportMetricsIntervalMillis();
+	}
+
+	public synchronized boolean getRequireSSL() {
+		return this.currentConnection.getRequireSSL();
+	}
+
+	public synchronized String getResourceId() {
+		return this.currentConnection.getResourceId();
+	}
+
+	public synchronized int getResultSetSizeThreshold() {
+		return this.currentConnection.getResultSetSizeThreshold();
+	}
+
+	public synchronized boolean getRewriteBatchedStatements() {
+		return this.currentConnection.getRewriteBatchedStatements();
+	}
+
+	public synchronized boolean getRollbackOnPooledClose() {
+		return this.currentConnection.getRollbackOnPooledClose();
+	}
+
+	public synchronized boolean getRoundRobinLoadBalance() {
+		return this.currentConnection.getRoundRobinLoadBalance();
+	}
+
+	public synchronized boolean getRunningCTS13() {
+		return this.currentConnection.getRunningCTS13();
+	}
+
+	public synchronized int getSecondsBeforeRetryMaster() {
+		return this.currentConnection.getSecondsBeforeRetryMaster();
+	}
+
+	public synchronized int getSelfDestructOnPingMaxOperations() {
+		return this.currentConnection.getSelfDestructOnPingMaxOperations();
+	}
+
+	public synchronized int getSelfDestructOnPingSecondsLifetime() {
+		return this.currentConnection.getSelfDestructOnPingSecondsLifetime();
+	}
+
+	public synchronized String getServerTimezone() {
+		return this.currentConnection.getServerTimezone();
+	}
+
+	public synchronized String getSessionVariables() {
+		return this.currentConnection.getSessionVariables();
+	}
+
+	public synchronized int getSlowQueryThresholdMillis() {
+		return this.currentConnection.getSlowQueryThresholdMillis();
+	}
+
+	public synchronized long getSlowQueryThresholdNanos() {
+		return this.currentConnection.getSlowQueryThresholdNanos();
+	}
+
+	public synchronized String getSocketFactory() {
+		return this.currentConnection.getSocketFactory();
+	}
+
+	public synchronized String getSocketFactoryClassName() {
+		return this.currentConnection.getSocketFactoryClassName();
+	}
+
+	public synchronized int getSocketTimeout() {
+		return this.currentConnection.getSocketTimeout();
+	}
+
+	public synchronized String getStatementInterceptors() {
+		return this.currentConnection.getStatementInterceptors();
+	}
+
+	public synchronized boolean getStrictFloatingPoint() {
+		return this.currentConnection.getStrictFloatingPoint();
+	}
+
+	public synchronized boolean getStrictUpdates() {
+		return this.currentConnection.getStrictUpdates();
+	}
+
+	public synchronized boolean getTcpKeepAlive() {
+		return this.currentConnection.getTcpKeepAlive();
+	}
+
+	public synchronized boolean getTcpNoDelay() {
+		return this.currentConnection.getTcpNoDelay();
+	}
+
+	public synchronized int getTcpRcvBuf() {
+		return this.currentConnection.getTcpRcvBuf();
+	}
+
+	public synchronized int getTcpSndBuf() {
+		return this.currentConnection.getTcpSndBuf();
+	}
+
+	public synchronized int getTcpTrafficClass() {
+		return this.currentConnection.getTcpTrafficClass();
+	}
+
+	public synchronized boolean getTinyInt1isBit() {
+		return this.currentConnection.getTinyInt1isBit();
+	}
+
+	public synchronized boolean getTraceProtocol() {
+		return this.currentConnection.getTraceProtocol();
+	}
+
+	public synchronized boolean getTransformedBitIsBoolean() {
+		return this.currentConnection.getTransformedBitIsBoolean();
+	}
+
+	public synchronized boolean getTreatUtilDateAsTimestamp() {
+		return this.currentConnection.getTreatUtilDateAsTimestamp();
+	}
+
+	public synchronized String getTrustCertificateKeyStorePassword() {
+		return this.currentConnection.getTrustCertificateKeyStorePassword();
+	}
+
+	public synchronized String getTrustCertificateKeyStoreType() {
+		return this.currentConnection.getTrustCertificateKeyStoreType();
+	}
+
+	public synchronized String getTrustCertificateKeyStoreUrl() {
+		return this.currentConnection.getTrustCertificateKeyStoreUrl();
+	}
+
+	public synchronized boolean getUltraDevHack() {
+		return this.currentConnection.getUltraDevHack();
+	}
+
+	public synchronized boolean getUseBlobToStoreUTF8OutsideBMP() {
+		return this.currentConnection.getUseBlobToStoreUTF8OutsideBMP();
+	}
+
+	public synchronized boolean getUseCompression() {
+		return this.currentConnection.getUseCompression();
+	}
+
+	public synchronized String getUseConfigs() {
+		return this.currentConnection.getUseConfigs();
+	}
+
+	public synchronized boolean getUseCursorFetch() {
+		return this.currentConnection.getUseCursorFetch();
+	}
+
+	public synchronized boolean getUseDirectRowUnpack() {
+		return this.currentConnection.getUseDirectRowUnpack();
+	}
+
+	public synchronized boolean getUseDynamicCharsetInfo() {
+		return this.currentConnection.getUseDynamicCharsetInfo();
+	}
+
+	public synchronized boolean getUseFastDateParsing() {
+		return this.currentConnection.getUseFastDateParsing();
+	}
+
+	public synchronized boolean getUseFastIntParsing() {
+		return this.currentConnection.getUseFastIntParsing();
+	}
+
+	public synchronized boolean getUseGmtMillisForDatetimes() {
+		return this.currentConnection.getUseGmtMillisForDatetimes();
+	}
+
+	public synchronized boolean getUseHostsInPrivileges() {
+		return this.currentConnection.getUseHostsInPrivileges();
+	}
+
+	public synchronized boolean getUseInformationSchema() {
+		return this.currentConnection.getUseInformationSchema();
+	}
+
+	public synchronized boolean getUseJDBCCompliantTimezoneShift() {
+		return this.currentConnection.getUseJDBCCompliantTimezoneShift();
+	}
+
+	public synchronized boolean getUseJvmCharsetConverters() {
+		return this.currentConnection.getUseJvmCharsetConverters();
+	}
+
+	public synchronized boolean getUseLegacyDatetimeCode() {
+		return this.currentConnection.getUseLegacyDatetimeCode();
+	}
+
+	public synchronized boolean getUseLocalSessionState() {
+		return this.currentConnection.getUseLocalSessionState();
+	}
+
+	public synchronized boolean getUseNanosForElapsedTime() {
+		return this.currentConnection.getUseNanosForElapsedTime();
+	}
+
+	public synchronized boolean getUseOldAliasMetadataBehavior() {
+		return this.currentConnection.getUseOldAliasMetadataBehavior();
+	}
+
+	public synchronized boolean getUseOldUTF8Behavior() {
+		return this.currentConnection.getUseOldUTF8Behavior();
+	}
+
+	public synchronized boolean getUseOnlyServerErrorMessages() {
+		return this.currentConnection.getUseOnlyServerErrorMessages();
+	}
+
+	public synchronized boolean getUseReadAheadInput() {
+		return this.currentConnection.getUseReadAheadInput();
+	}
+
+	public synchronized boolean getUseSSL() {
+		return this.currentConnection.getUseSSL();
+	}
+
+	public synchronized boolean getUseSSPSCompatibleTimezoneShift() {
+		return this.currentConnection.getUseSSPSCompatibleTimezoneShift();
+	}
+
+	public synchronized boolean getUseServerPrepStmts() {
+		return this.currentConnection.getUseServerPrepStmts();
+	}
+
+	public synchronized boolean getUseServerPreparedStmts() {
+		return this.currentConnection.getUseServerPreparedStmts();
+	}
+
+	public synchronized boolean getUseSqlStateCodes() {
+		return this.currentConnection.getUseSqlStateCodes();
+	}
+
+	public synchronized boolean getUseStreamLengthsInPrepStmts() {
+		return this.currentConnection.getUseStreamLengthsInPrepStmts();
+	}
+
+	public synchronized boolean getUseTimezone() {
+		return this.currentConnection.getUseTimezone();
+	}
+
+	public synchronized boolean getUseUltraDevWorkAround() {
+		return this.currentConnection.getUseUltraDevWorkAround();
+	}
+
+	public synchronized boolean getUseUnbufferedInput() {
+		return this.currentConnection.getUseUnbufferedInput();
+	}
+
+	public synchronized boolean getUseUnicode() {
+		return this.currentConnection.getUseUnicode();
+	}
+
+	public synchronized boolean getUseUsageAdvisor() {
+		return this.currentConnection.getUseUsageAdvisor();
+	}
+
+	public synchronized String getUtf8OutsideBmpExcludedColumnNamePattern() {
+		return this.currentConnection.getUtf8OutsideBmpExcludedColumnNamePattern();
+	}
+
+	public synchronized String getUtf8OutsideBmpIncludedColumnNamePattern() {
+		return this.currentConnection.getUtf8OutsideBmpIncludedColumnNamePattern();
+	}
+
+	public synchronized boolean getVerifyServerCertificate() {
+		return this.currentConnection.getVerifyServerCertificate();
+	}
+
+	public synchronized boolean getYearIsDateType() {
+		return this.currentConnection.getYearIsDateType();
+	}
+
+	public synchronized String getZeroDateTimeBehavior() {
+		return this.currentConnection.getZeroDateTimeBehavior();
+	}
+
+	public synchronized void setAllowLoadLocalInfile(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAllowMultiQueries(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAllowNanAndInf(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAllowUrlInLocalInfile(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAlwaysSendSetIsolation(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoClosePStmtStreams(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoDeserialize(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoGenerateTestcaseScript(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoReconnect(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoReconnectForConnectionPools(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoReconnectForPools(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setAutoSlowLog(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setBlobSendChunkSize(String value) throws SQLException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setBlobsAreStrings(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCacheCallableStatements(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCacheCallableStmts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCachePrepStmts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCachePreparedStatements(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCacheResultSetMetadata(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCacheServerConfiguration(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCallableStatementCacheSize(int size) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCallableStmtCacheSize(int cacheSize) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCapitalizeDBMDTypes(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCapitalizeTypeNames(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCharacterEncoding(String encoding) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCharacterSetResults(String characterSet) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setClientCertificateKeyStorePassword(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setClientCertificateKeyStoreType(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setClientCertificateKeyStoreUrl(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setClientInfoProvider(String classname) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setClobCharacterEncoding(String encoding) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setClobberStreamingResults(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setConnectTimeout(int timeoutMs) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setConnectionCollation(String collation) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setConnectionLifecycleInterceptors(String interceptors) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setContinueBatchOnError(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setCreateDatabaseIfNotExist(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setDefaultFetchSize(int n) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setDetectServerPreparedStmts(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setDontTrackOpenResources(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setDumpMetadataOnColumnNotFound(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setDumpQueriesOnException(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setDynamicCalendars(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setElideSetAutoCommits(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setEmptyStringsConvertToZero(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setEmulateLocators(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setEmulateUnsupportedPstmts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setEnablePacketDebug(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setEnableQueryTimeouts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setEncoding(String property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setExplainSlowQueries(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setFailOverReadOnly(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setFunctionsNeverReturnBlobs(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setGatherPerfMetrics(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setGatherPerformanceMetrics(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setGenerateSimpleParameterMetadata(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setHoldResultsOpenOverStatementClose(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setIgnoreNonTxTables(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setIncludeInnodbStatusInDeadlockExceptions(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setInitialTimeout(int property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setInteractiveClient(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setIsInteractiveClient(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setJdbcCompliantTruncation(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setJdbcCompliantTruncationForReads(
+			boolean jdbcCompliantTruncationForReads) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLargeRowSizeThreshold(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLoadBalanceStrategy(String strategy) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLocalSocketAddress(String address) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLocatorFetchBufferSize(String value) throws SQLException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLogSlowQueries(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLogXaCommands(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLogger(String property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setLoggerClassName(String className) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setMaintainTimeStats(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setMaxQuerySizeToLog(int sizeInBytes) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setMaxReconnects(int property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setMaxRows(int property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setMetadataCacheSize(int value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setNetTimeoutForStreamingResults(int value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setNoAccessToProcedureBodies(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setNoDatetimeStringSync(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setNoTimezoneConversionForTimeType(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setNullCatalogMeansCurrent(boolean value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setNullNamePatternMatchesAll(boolean value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setOverrideSupportsIntegrityEnhancementFacility(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPacketDebugBufferSize(int size) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPadCharsWithSpace(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setParanoid(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPedantic(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPinGlobalTxToPhysicalConnection(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPopulateInsertRowWithDefaultValues(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPrepStmtCacheSize(int cacheSize) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPrepStmtCacheSqlLimit(int sqlLimit) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPreparedStatementCacheSize(int cacheSize) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPreparedStatementCacheSqlLimit(int cacheSqlLimit) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setProcessEscapeCodesForPrepStmts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setProfileSQL(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setProfileSql(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setProfilerEventHandler(String handler) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setPropertiesTransform(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setQueriesBeforeRetryMaster(int property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setReconnectAtTxEnd(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRelaxAutoCommit(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setReportMetricsIntervalMillis(int millis) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRequireSSL(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setResourceId(String resourceId) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setResultSetSizeThreshold(int threshold) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRetainStatementAfterResultSetClose(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRewriteBatchedStatements(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRollbackOnPooledClose(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRoundRobinLoadBalance(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setRunningCTS13(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSecondsBeforeRetryMaster(int property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSelfDestructOnPingMaxOperations(int maxOperations) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSelfDestructOnPingSecondsLifetime(int seconds) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setServerTimezone(String property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSessionVariables(String variables) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSlowQueryThresholdMillis(int millis) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSlowQueryThresholdNanos(long nanos) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSocketFactory(String name) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSocketFactoryClassName(String property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setSocketTimeout(int property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setStatementInterceptors(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setStrictFloatingPoint(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setStrictUpdates(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTcpKeepAlive(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTcpNoDelay(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTcpRcvBuf(int bufSize) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTcpSndBuf(int bufSize) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTcpTrafficClass(int classFlags) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTinyInt1isBit(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTraceProtocol(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTransformedBitIsBoolean(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTreatUtilDateAsTimestamp(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTrustCertificateKeyStorePassword(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTrustCertificateKeyStoreType(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setTrustCertificateKeyStoreUrl(String value) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUltraDevHack(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseBlobToStoreUTF8OutsideBMP(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseCompression(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseConfigs(String configs) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseCursorFetch(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseDirectRowUnpack(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseDynamicCharsetInfo(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseFastDateParsing(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseFastIntParsing(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseGmtMillisForDatetimes(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseHostsInPrivileges(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseInformationSchema(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseJDBCCompliantTimezoneShift(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseJvmCharsetConverters(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseLegacyDatetimeCode(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseLocalSessionState(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseNanosForElapsedTime(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseOldAliasMetadataBehavior(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseOldUTF8Behavior(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseOnlyServerErrorMessages(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseReadAheadInput(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseSSL(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseSSPSCompatibleTimezoneShift(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseServerPrepStmts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseServerPreparedStmts(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseSqlStateCodes(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseStreamLengthsInPrepStmts(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseTimezone(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseUltraDevWorkAround(boolean property) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseUnbufferedInput(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseUnicode(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUseUsageAdvisor(boolean useUsageAdvisorFlag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUtf8OutsideBmpExcludedColumnNamePattern(String regexPattern) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setUtf8OutsideBmpIncludedColumnNamePattern(String regexPattern) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setVerifyServerCertificate(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setYearIsDateType(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized void setZeroDateTimeBehavior(String behavior) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public synchronized boolean useUnbufferedInput() {
+		return this.currentConnection.useUnbufferedInput();
+	}
+
+	public synchronized boolean isSameResource(Connection c) {
+		return this.currentConnection.isSameResource(c);
+	}
+
+	public void setInGlobalTx(boolean flag) {
+		this.currentConnection.setInGlobalTx(flag);
+	}
+
+	public boolean getUseColumnNamesInFindColumn() {
+		return this.currentConnection.getUseColumnNamesInFindColumn();
+	}
+
+	public void setUseColumnNamesInFindColumn(boolean flag) {
+		// TODO Auto-generated method stub
+	}
+
+	public boolean getUseLocalTransactionState() {
+		return this.currentConnection.getUseLocalTransactionState();
+	}
+
+	public void setUseLocalTransactionState(boolean flag) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public String getMysqlIOFactory() {
+		return this.currentConnection.getMysqlIOFactory();
+	}
+
+	public void setMysqlIOFactory(String mysqlIOFactoryClassName) {
+		// TODO Auto-generated method stub
+		
+	}
 }

Modified: trunk/src/com/mysql/jdbc/ResultSetImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetImpl.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ResultSetImpl.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -191,7 +191,7 @@
 	protected String catalog = null;
 
 	/** Map column names (and all of their permutations) to column indices */
-	protected Map columnNameToIndex = null;
+	protected Map columnLabelToIndex = null;
 
 	/** Keep track of columns accessed */
 	protected boolean[] columnUsed = null;
@@ -233,6 +233,8 @@
 	/** Map of fully-specified column names to column indices */
 	protected Map fullColumnNameToIndex = null;
 
+	protected Map columnNameToIndex = null;
+	
 	protected boolean hasBuiltIndexMapping = false;
 
 	/**
@@ -326,6 +328,7 @@
 	private boolean jdbcCompliantTruncationForReads;
 	
 	private boolean useFastIntParsing = true;
+	private boolean useColumnNamesInFindColumn;
 	
 	protected final static char[] EMPTY_SPACE = new char[255];
 	
@@ -431,7 +434,7 @@
 	public ResultSetImpl(String catalog, Field[] fields, RowData tuples,
 			ConnectionImpl conn, StatementImpl creatorStmt) throws SQLException {
 		this.connection = conn;
-
+		
 		this.retainOwningStatement = false;
 		
 		if (this.connection != null) {
@@ -481,6 +484,10 @@
 			initializeWithMetadata();
 		} // else called by Connection.initializeResultsMetadataFromCache() when cached
 		useLegacyDatetimeCode = this.connection.getUseLegacyDatetimeCode();
+		
+		this.useColumnNamesInFindColumn = this.connection.getUseColumnNamesInFindColumn();
+		
+		setRowPositionValidity();
 	}
 
 	public void initializeWithMetadata() throws SQLException {
@@ -707,8 +714,9 @@
 	 */
 	public void buildIndexMapping() throws SQLException {
 		int numFields = this.fields.length;
+		this.columnLabelToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
+		this.fullColumnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
 		this.columnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
-		this.fullColumnNameToIndex = new TreeMap(String.CASE_INSENSITIVE_ORDER);
 		
 		
 		// We do this in reverse order, so that the 'first' column
@@ -725,16 +733,21 @@
 		//
 		for (int i = numFields - 1; i >= 0; i--) {
 			Integer index = Constants.integerValueOf(i);
-			String columnName = this.fields[i].getName();
+			String columnName = this.fields[i].getOriginalName();
+			String columnLabel = this.fields[i].getName();
 			String fullColumnName = this.fields[i].getFullName();
 
-			if (columnName != null) {			
-				this.columnNameToIndex.put(columnName, index);
+			if (columnLabel != null) {			
+				this.columnLabelToIndex.put(columnLabel, index);
 			}
 
 			if (fullColumnName != null) {
 				this.fullColumnNameToIndex.put(fullColumnName, index);
 			}
+			
+			if (columnName != null) {
+				this.columnNameToIndex.put(columnName, index);
+			}
 		}
 
 		// set the flag to prevent rebuilding...
@@ -926,14 +939,14 @@
 	public void populateCachedMetaData(CachedResultSetMetaData cachedMetaData)
 		throws SQLException {
 		cachedMetaData.fields = this.fields;
-		cachedMetaData.columnNameToIndex = this.columnNameToIndex;
+		cachedMetaData.columnNameToIndex = this.columnLabelToIndex;
 		cachedMetaData.fullColumnNameToIndex = this.fullColumnNameToIndex;
 		cachedMetaData.metadata = getMetaData();
 	}
 	
 	public void initializeFromCachedMetaData(CachedResultSetMetaData cachedMetaData) {
 		this.fields = cachedMetaData.fields;
-		this.columnNameToIndex = cachedMetaData.columnNameToIndex;
+		this.columnLabelToIndex = cachedMetaData.columnNameToIndex;
 		this.fullColumnNameToIndex = cachedMetaData.fullColumnNameToIndex;
 		this.hasBuiltIndexMapping = true;
 	}
@@ -1051,7 +1064,8 @@
 	// ---------------------------------------------------------------------
 
 
-	/**
+	/*
+	 * [For JDBC-3.0 and older - http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#findColumn(java.lang.String)]
 	 * Map a ResultSet column name to a ResultSet column index
 	 * 
 	 * @param columnName
@@ -1061,6 +1075,16 @@
 	 * 
 	 * @exception SQLException
 	 *                if a database access error occurs
+	 *                
+	 * [For JDBC-4.0 and newer - http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html#findColumn(java.lang.String)]
+	 * 
+	 * Maps the given ResultSet column label to its ResultSet column index.
+	 * 
+	 * @param columnLabel
+	 *            the label for the column specified with the SQL AS clause. If the 
+	 *            SQL AS clause was not specified, then the label is the name of the column
+	 *            
+	 * @return the column index of the given column name
 	 */
 	public synchronized int findColumn(String columnName) throws SQLException {
 		Integer index;
@@ -1069,12 +1093,16 @@
 			buildIndexMapping();
 		}
 
-		index = (Integer) this.columnNameToIndex.get(columnName);
+		index = (Integer) this.columnLabelToIndex.get(columnName);
 
+		if (index == null && this.useColumnNamesInFindColumn) {
+			index = (Integer) this.columnNameToIndex.get(columnName);
+		}
+		
 		if (index == null) {
 			index = (Integer) this.fullColumnNameToIndex.get(columnName);
 		}
-
+		
 		if (index != null) {
 			return index.intValue() + 1;
 		}
@@ -1303,14 +1331,8 @@
 						} catch (ArithmeticException arEx) {
 							throw SQLError.createSQLException(
 									Messages
-											.getString("ResultSet.Bad_format_for_BigDecimal____124") //$NON-NLS-1$
-											+ stringVal
-											+ Messages
-													.getString("ResultSet.___in_column__125")
-											+ columnIndex
-											+ "(" //$NON-NLS-1$
-											+ this.fields[columnIndex - 1]
-											+ ").",
+											.getString("ResultSet.Bad_format_for_BigDecimal", //$NON-NLS-1$
+											 new Object[] {stringVal, new Integer(columnIndex)}),
 									SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
 						}
 					}
@@ -4816,13 +4838,9 @@
 				} catch (NumberFormatException ex) {
 					throw SQLError.createSQLException(
 							Messages
-									.getString("ResultSet.Bad_format_for_BigDecimal____86") //$NON-NLS-1$
-									+ stringVal
-									+ Messages
-											.getString("ResultSet.___in_column__87")
-									+ columnIndex + "(" //$NON-NLS-1$
-									+ this.fields[columnIndex - 1] + ").",
-							SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+							.getString("ResultSet.Bad_format_for_BigDecimal", //$NON-NLS-1$
+							 new Object[] {stringVal, new Integer(columnIndex)}),
+					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
 				}
 
 				return val;
@@ -5048,13 +5066,9 @@
 				} catch (NumberFormatException ex) {
 					throw SQLError.createSQLException(
 							Messages
-									.getString("ResultSet.Bad_format_for_BigDecimal____86") //$NON-NLS-1$
-									+ stringVal
-									+ Messages
-											.getString("ResultSet.___in_column__87")
-									+ columnIndex + "(" //$NON-NLS-1$
-									+ this.fields[columnIndex - 1] + ").",
-							SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+							.getString("ResultSet.Bad_format_for_BigDecimal", //$NON-NLS-1$
+							 new Object[] {stringVal, new Integer(columnIndex)}),
+					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
 				}
 
 				return val;
@@ -5914,6 +5928,8 @@
 	private Time getTimeInternal(int columnIndex, Calendar targetCalendar,
 			TimeZone tz,
 			boolean rollForward) throws java.sql.SQLException {
+		checkRowPos();
+		
 		if (this.isBinaryEncoded) {
 			return getNativeTime(columnIndex, targetCalendar, tz, rollForward);
 		}
@@ -7505,7 +7521,7 @@
 			this.rowData = null;
 			this.defaultTimeZone = null;
 			this.fields = null;
-			this.columnNameToIndex = null;
+			this.columnLabelToIndex = null;
 			this.fullColumnNameToIndex = null;
 			this.eventSink = null;
 			this.warningChain = null;

Modified: trunk/src/com/mysql/jdbc/ResultSetRow.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetRow.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ResultSetRow.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -667,8 +667,8 @@
 
 		if (length != 0) {
 			year = (bits[offset + 0] & 0xff) | ((bits[offset + 1] & 0xff) << 8);
-			month = bits[2];
-			day = bits[3];
+			month = bits[offset + 2];
+			day = bits[offset + 3];
 
 			if (length > 4) {
 				hour = bits[offset + 4];

Modified: trunk/src/com/mysql/jdbc/RowDataDynamic.java
===================================================================
--- trunk/src/com/mysql/jdbc/RowDataDynamic.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/RowDataDynamic.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -56,7 +56,7 @@
 
 	private boolean isAfterEnd = false;
 
-	private boolean isAtEnd = false;
+	private boolean noMoreRows = false;
 
 	private boolean isBinaryEncoded = false;
 
@@ -409,14 +409,15 @@
 	private void nextRecord() throws SQLException {
 
 		try {
-			if (!this.isAtEnd) {				
+			if (!this.noMoreRows) {				
 				this.nextRow = this.io.nextRow(this.metadata, this.columnCount,
 						this.isBinaryEncoded,
 						java.sql.ResultSet.CONCUR_READ_ONLY, true, 
 						this.useBufferRowExplicit, true, null);
 
 				if (this.nextRow == null) {
-					this.isAtEnd = true;
+					this.noMoreRows = true;
+					this.isAfterEnd = true;
 					this.moreResultsExisted = this.io.tackOnMoreStreamingResults(this.owner);
 
 					if (this.index == -1) {

Modified: trunk/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/ServerPreparedStatement.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/ServerPreparedStatement.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -783,7 +783,8 @@
 									
 									if (this.continueBatchOnError && 
 											!(ex instanceof MySQLTimeoutException) && 
-											!(ex instanceof MySQLStatementCancelledException)) {
+											!(ex instanceof MySQLStatementCancelledException)
+											&& !hasDeadlockOrTimeoutRolledBackTx(ex)) {
 										sqlEx = ex;
 									} else {
 										int[] newUpdateCounts = new int[commandIndex];
@@ -1063,7 +1064,7 @@
 						packet.writeLong(this.serverStatementId);
 
 						mysql.sendCommand(MysqlDefs.COM_CLOSE_STATEMENT, null,
-								packet, true, null);
+								packet, true, null, 0);
 					} catch (SQLException sqlEx) {
 						exceptionDuringClose = sqlEx;
 					}
@@ -1328,7 +1329,7 @@
 				}
 				
 				Buffer resultPacket = mysql.sendCommand(MysqlDefs.COM_EXECUTE,
-					null, packet, false, null);
+					null, packet, false, null, 0);
 				
 				long queryEndTime = 0L;
 				
@@ -1518,7 +1519,7 @@
 				packet.writeBytesNoNull((byte[]) longData.value);
 
 				mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet, true,
-						null);
+						null, 0);
 			} else if (value instanceof InputStream) {
 				storeStream(mysql, parameterIndex, packet, (InputStream) value);
 			} else if (value instanceof java.sql.Blob) {
@@ -1566,7 +1567,7 @@
 
 				Buffer prepareResultPacket = mysql.sendCommand(
 						MysqlDefs.COM_PREPARE, sql, null, false,
-						characterEncoding);
+						characterEncoding, 0);
 
 				if (this.connection.versionMeetsMinimum(4, 1, 1)) {
 					// 4.1.1 and newer use the first byte
@@ -1652,7 +1653,7 @@
 				// Leave the I/O channel in a known state...there might be
 				// packets out there
 				// that we're not interested in
-				((MysqlIOprotocol) this.connection.getIO()).clearInputStream();
+				((MysqlIO) this.connection.getIO()).clearInputStream();
 			}
 		}
 	}
@@ -1687,7 +1688,7 @@
 
 			try {
 				mysql.sendCommand(MysqlDefs.COM_RESET_STMT, null, packet,
-						!this.connection.versionMeetsMinimum(4, 1, 2), null);
+						!this.connection.versionMeetsMinimum(4, 1, 2), null, 0);
 			} catch (SQLException sqlEx) {
 				throw sqlEx;
 			} catch (Exception ex) {
@@ -2581,7 +2582,7 @@
 					bytesReadAtLastSend = totalBytesRead;
 
 					mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet,
-							true, null);
+							true, null, 0);
 
 					bytesInPacket = 0;
 					packet.clear();
@@ -2593,12 +2594,12 @@
 
 			if (totalBytesRead != bytesReadAtLastSend) {
 				mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet, true,
-						null);
+						null, 0);
 			}
 			
 			if (!readAny) {
 				mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet, true,
-						null);
+						null, 0);
 			}
 		} catch (IOException ioEx) {
 			SQLException sqlEx = SQLError.createSQLException(Messages
@@ -2651,7 +2652,7 @@
 					bytesReadAtLastSend = totalBytesRead;
 
 					mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet,
-							true, null);
+							true, null, 0);
 
 					bytesInPacket = 0;
 					packet.clear();
@@ -2663,12 +2664,12 @@
 
 			if (totalBytesRead != bytesReadAtLastSend) {
 				mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet, true,
-						null);
+						null, 0);
 			}
 			
 			if (!readAny) {
 				mysql.sendCommand(MysqlDefs.COM_LONG_DATA, null, packet, true,
-						null);
+						null, 0);
 			}
 		} catch (IOException ioEx) {
 			SQLException sqlEx = SQLError.createSQLException(Messages

Modified: trunk/src/com/mysql/jdbc/StatementImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/StatementImpl.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/StatementImpl.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -37,6 +37,7 @@
 import java.util.List;
 import java.util.TimerTask;
 
+import com.mysql.jdbc.exceptions.DeadlockTimeoutRollbackMarker;
 import com.mysql.jdbc.exceptions.MySQLStatementCancelledException;
 import com.mysql.jdbc.exceptions.MySQLTimeoutException;
 import com.mysql.jdbc.profiler.ProfilerEvent;
@@ -297,7 +298,7 @@
 		}
 
 		boolean profiling = this.connection.getProfileSql()
-				|| this.connection.getUseUsageAdvisor();
+				|| this.connection.getUseUsageAdvisor() || this.connection.getLogSlowQueries();
 
 		if (this.connection.getAutoGenerateTestcaseScript() || profiling) {
 			this.statementId = statementCounter++;
@@ -989,12 +990,20 @@
 
 							if (this.continueBatchOnError && 
 									!(ex instanceof MySQLTimeoutException) && 
-									!(ex instanceof MySQLStatementCancelledException)) {
+									!(ex instanceof MySQLStatementCancelledException) &&
+                                    !hasDeadlockOrTimeoutRolledBackTx(ex)) {
 								sqlEx = ex;
 							} else {
 								int[] newUpdateCounts = new int[commandIndex];
-								System.arraycopy(updateCounts, 0,
+								
+								if (hasDeadlockOrTimeoutRolledBackTx(ex)) {
+									for (int i = 0; i < newUpdateCounts.length; i++) {
+										newUpdateCounts[i] = Statement.EXECUTE_FAILED;
+									}
+								} else {
+									System.arraycopy(updateCounts, 0,
 										newUpdateCounts, 0, commandIndex);
+								}
 
 								throw new java.sql.BatchUpdateException(ex
 										.getMessage(), ex.getSQLState(), ex
@@ -1036,6 +1045,25 @@
 		}
 	}
 
+	protected final boolean hasDeadlockOrTimeoutRolledBackTx(SQLException ex) {
+		int vendorCode = ex.getErrorCode();
+		
+		switch (vendorCode) {
+		case MysqlErrorNumbers.ER_LOCK_DEADLOCK:
+		case MysqlErrorNumbers.ER_LOCK_TABLE_FULL:
+			return true;
+		case MysqlErrorNumbers.ER_LOCK_WAIT_TIMEOUT:
+			try {
+				return !this.connection.versionMeetsMinimum(5, 0, 13);
+			} catch (SQLException sqlEx) {
+				// won't actually be thrown in this case
+				return false;
+			}
+		default:
+			return false;
+		}
+	}
+
 	/**
 	 * Rewrites batch into a single query to send to the server. This method
 	 * will constrain each batch to be shorter than max_allowed_packet on the
@@ -1219,7 +1247,8 @@
 
 		if (this.continueBatchOnError && 
 				!(ex instanceof MySQLTimeoutException) && 
-				!(ex instanceof MySQLStatementCancelledException)) {
+				!(ex instanceof MySQLStatementCancelledException) &&
+				!hasDeadlockOrTimeoutRolledBackTx(ex)) {
 			sqlEx = ex;
 		} else {
 			int[] newUpdateCounts = new int[endOfBatchIndex];

Modified: trunk/src/com/mysql/jdbc/TimeUtil.java
===================================================================
--- trunk/src/com/mysql/jdbc/TimeUtil.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/TimeUtil.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -1019,7 +1019,7 @@
 
 	final static Time fastTimeCreate(Calendar cal, int hour, int minute,
 			int second) throws SQLException {
-		if (hour < 0 || hour > 23) {
+		if (hour < 0 || hour > 24) {
 			throw SQLError.createSQLException("Illegal hour value '" + hour + "' for java.sql.Time type in value '"
 					+ timeFormattedString(hour, minute, second) + ".", 
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);

Modified: trunk/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- trunk/src/com/mysql/jdbc/UpdatableResultSet.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/UpdatableResultSet.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -234,199 +234,204 @@
 	 *             DOCUMENT ME!
 	 */
 	protected void checkUpdatability() throws SQLException {
-		if (this.fields == null) {
-			// we've been created to be populated with cached
-			// metadata, and we don't have the metadata yet,
-			// we'll be called again by
-			// Connection.initializeResultsMetadataFromCache()
-			// when the metadata has been made available
-
-			return;
-		}
-
-		String singleTableName = null;
-		String catalogName = null;
-
-		int primaryKeyCount = 0;
-
-		// We can only do this if we know that there is a currently
-		// selected database, or if we're talking to a > 4.1 version
-		// of MySQL server (as it returns database names in field
-		// info)
-		//
-		if ((this.catalog == null) || (this.catalog.length() == 0)) {
-			this.catalog = this.fields[0].getDatabaseName();
-
-			if ((this.catalog == null) || (this.catalog.length() == 0)) {
-				throw SQLError.createSQLException(Messages
-						.getString("UpdatableResultSet.43") //$NON-NLS-1$
-						, SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
-			}
-		}
-
-		if (this.fields.length > 0) {
-			singleTableName = this.fields[0].getOriginalTableName();
-			catalogName = this.fields[0].getDatabaseName();
-
-			if (singleTableName == null) {
-				singleTableName = this.fields[0].getTableName();
-				catalogName = this.catalog;
-			}
-
-			if (singleTableName != null && singleTableName.length() == 0) {
-				this.isUpdatable = false;
-				this.notUpdatableReason = Messages.getString("NotUpdatableReason.3");
-
+		try {
+			if (this.fields == null) {
+				// we've been created to be populated with cached
+				// metadata, and we don't have the metadata yet,
+				// we'll be called again by
+				// Connection.initializeResultsMetadataFromCache()
+				// when the metadata has been made available
+	
 				return;
 			}
-
-			if (this.fields[0].isPrimaryKey()) {
-				primaryKeyCount++;
-			}
-
+	
+			String singleTableName = null;
+			String catalogName = null;
+	
+			int primaryKeyCount = 0;
+	
+			// We can only do this if we know that there is a currently
+			// selected database, or if we're talking to a > 4.1 version
+			// of MySQL server (as it returns database names in field
+			// info)
 			//
-			// References only one table?
-			//
-			for (int i = 1; i < this.fields.length; i++) {
-				String otherTableName = this.fields[i].getOriginalTableName();
-				String otherCatalogName = this.fields[i].getDatabaseName();
-
-				if (otherTableName == null) {
-					otherTableName = this.fields[i].getTableName();
-					otherCatalogName = this.catalog;
+			if ((this.catalog == null) || (this.catalog.length() == 0)) {
+				this.catalog = this.fields[0].getDatabaseName();
+	
+				if ((this.catalog == null) || (this.catalog.length() == 0)) {
+					throw SQLError.createSQLException(Messages
+							.getString("UpdatableResultSet.43") //$NON-NLS-1$
+							, SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
 				}
-
-				if (otherTableName != null && otherTableName.length() == 0) {
+			}
+	
+			if (this.fields.length > 0) {
+				singleTableName = this.fields[0].getOriginalTableName();
+				catalogName = this.fields[0].getDatabaseName();
+	
+				if (singleTableName == null) {
+					singleTableName = this.fields[0].getTableName();
+					catalogName = this.catalog;
+				}
+	
+				if (singleTableName != null && singleTableName.length() == 0) {
 					this.isUpdatable = false;
 					this.notUpdatableReason = Messages.getString("NotUpdatableReason.3");
-
+	
 					return;
 				}
-
-				if ((singleTableName == null)
-						|| !otherTableName.equals(singleTableName)) {
-					this.isUpdatable = false;
-					this.notUpdatableReason = Messages.getString("NotUpdatableReason.0");
-
-					return;
+	
+				if (this.fields[0].isPrimaryKey()) {
+					primaryKeyCount++;
 				}
-
-				// Can't reference more than one database
-				if ((catalogName == null)
-						|| !otherCatalogName.equals(catalogName)) {
+	
+				//
+				// References only one table?
+				//
+				for (int i = 1; i < this.fields.length; i++) {
+					String otherTableName = this.fields[i].getOriginalTableName();
+					String otherCatalogName = this.fields[i].getDatabaseName();
+	
+					if (otherTableName == null) {
+						otherTableName = this.fields[i].getTableName();
+						otherCatalogName = this.catalog;
+					}
+	
+					if (otherTableName != null && otherTableName.length() == 0) {
+						this.isUpdatable = false;
+						this.notUpdatableReason = Messages.getString("NotUpdatableReason.3");
+	
+						return;
+					}
+	
+					if ((singleTableName == null)
+							|| !otherTableName.equals(singleTableName)) {
+						this.isUpdatable = false;
+						this.notUpdatableReason = Messages.getString("NotUpdatableReason.0");
+	
+						return;
+					}
+	
+					// Can't reference more than one database
+					if ((catalogName == null)
+							|| !otherCatalogName.equals(catalogName)) {
+						this.isUpdatable = false;
+						this.notUpdatableReason = Messages.getString("NotUpdatableReason.1");
+	
+						return;
+					}
+	
+					if (this.fields[i].isPrimaryKey()) {
+						primaryKeyCount++;
+					}
+				}
+	
+				if ((singleTableName == null) || (singleTableName.length() == 0)) {
 					this.isUpdatable = false;
-					this.notUpdatableReason = Messages.getString("NotUpdatableReason.1");
-
+					this.notUpdatableReason = Messages.getString("NotUpdatableReason.2");
+	
 					return;
 				}
-
-				if (this.fields[i].isPrimaryKey()) {
-					primaryKeyCount++;
-				}
-			}
-
-			if ((singleTableName == null) || (singleTableName.length() == 0)) {
+			} else {
 				this.isUpdatable = false;
-				this.notUpdatableReason = Messages.getString("NotUpdatableReason.2");
-
+				this.notUpdatableReason = Messages.getString("NotUpdatableReason.3");
+	
 				return;
 			}
-		} else {
-			this.isUpdatable = false;
-			this.notUpdatableReason = Messages.getString("NotUpdatableReason.3");
-
-			return;
-		}
-
-		if (this.connection.getStrictUpdates()) {
-			java.sql.DatabaseMetaData dbmd = this.connection.getMetaData();
-
-			java.sql.ResultSet rs = null;
-			HashMap primaryKeyNames = new HashMap();
-
-			try {
-				rs = dbmd.getPrimaryKeys(catalogName, null, singleTableName);
-
-				while (rs.next()) {
-					String keyName = rs.getString(4);
-					keyName = keyName.toUpperCase();
-					primaryKeyNames.put(keyName, keyName);
-				}
-			} finally {
-				if (rs != null) {
-					try {
-						rs.close();
-					} catch (Exception ex) {
-						AssertionFailedException.shouldNotHappen(ex);
+	
+			if (this.connection.getStrictUpdates()) {
+				java.sql.DatabaseMetaData dbmd = this.connection.getMetaData();
+	
+				java.sql.ResultSet rs = null;
+				HashMap primaryKeyNames = new HashMap();
+	
+				try {
+					rs = dbmd.getPrimaryKeys(catalogName, null, singleTableName);
+	
+					while (rs.next()) {
+						String keyName = rs.getString(4);
+						keyName = keyName.toUpperCase();
+						primaryKeyNames.put(keyName, keyName);
 					}
-
-					rs = null;
+				} finally {
+					if (rs != null) {
+						try {
+							rs.close();
+						} catch (Exception ex) {
+							AssertionFailedException.shouldNotHappen(ex);
+						}
+	
+						rs = null;
+					}
 				}
-			}
-
-			int existingPrimaryKeysCount = primaryKeyNames.size();
-
-			if (existingPrimaryKeysCount == 0) {
-				this.isUpdatable = false;
-				this.notUpdatableReason = Messages.getString("NotUpdatableReason.5");
-
-				return; // we can't update tables w/o keys
-			}
-
-			//
-			// Contains all primary keys?
-			//
-			for (int i = 0; i < this.fields.length; i++) {
-				if (this.fields[i].isPrimaryKey()) {
-					String columnNameUC = this.fields[i].getName()
-							.toUpperCase();
-
-					if (primaryKeyNames.remove(columnNameUC) == null) {
-						// try original name
-						String originalName = this.fields[i].getOriginalName();
-
-						if (originalName != null) {
-							if (primaryKeyNames.remove(originalName
-									.toUpperCase()) == null) {
-								// we don't know about this key, so give up :(
-								this.isUpdatable = false;
-								this.notUpdatableReason = Messages.getString("NotUpdatableReason.6",
-										new Object[] {originalName});
-
-								return;
+	
+				int existingPrimaryKeysCount = primaryKeyNames.size();
+	
+				if (existingPrimaryKeysCount == 0) {
+					this.isUpdatable = false;
+					this.notUpdatableReason = Messages.getString("NotUpdatableReason.5");
+	
+					return; // we can't update tables w/o keys
+				}
+	
+				//
+				// Contains all primary keys?
+				//
+				for (int i = 0; i < this.fields.length; i++) {
+					if (this.fields[i].isPrimaryKey()) {
+						String columnNameUC = this.fields[i].getName()
+								.toUpperCase();
+	
+						if (primaryKeyNames.remove(columnNameUC) == null) {
+							// try original name
+							String originalName = this.fields[i].getOriginalName();
+	
+							if (originalName != null) {
+								if (primaryKeyNames.remove(originalName
+										.toUpperCase()) == null) {
+									// we don't know about this key, so give up :(
+									this.isUpdatable = false;
+									this.notUpdatableReason = Messages.getString("NotUpdatableReason.6",
+											new Object[] {originalName});
+	
+									return;
+								}
 							}
 						}
 					}
 				}
+	
+				this.isUpdatable = primaryKeyNames.isEmpty();
+	
+				if (!this.isUpdatable) {
+					if (existingPrimaryKeysCount > 1) {
+						this.notUpdatableReason = Messages.getString("NotUpdatableReason.7");
+					} else {
+						this.notUpdatableReason = Messages.getString("NotUpdatableReason.4");
+					}
+	
+					return;
+				}
 			}
-
-			this.isUpdatable = primaryKeyNames.isEmpty();
-
-			if (!this.isUpdatable) {
-				if (existingPrimaryKeysCount > 1) {
-					this.notUpdatableReason = Messages.getString("NotUpdatableReason.7");
-				} else {
-					this.notUpdatableReason = Messages.getString("NotUpdatableReason.4");
-				}
-
+	
+			//
+			// Must have at least one primary key
+			//
+			if (primaryKeyCount == 0) {
+				this.isUpdatable = false;
+				this.notUpdatableReason = Messages.getString("NotUpdatableReason.4");
+	
 				return;
 			}
-		}
-
-		//
-		// Must have at least one primary key
-		//
-		if (primaryKeyCount == 0) {
+	
+			this.isUpdatable = true;
+			this.notUpdatableReason = null;
+	
+			return;
+		} catch (SQLException sqlEx) {
 			this.isUpdatable = false;
-			this.notUpdatableReason = Messages.getString("NotUpdatableReason.4");
-
-			return;
+			this.notUpdatableReason = sqlEx.getMessage();
 		}
-
-		this.isUpdatable = true;
-		this.notUpdatableReason = null;
-
-		return;
 	}
 
 	/**

Copied: trunk/src/com/mysql/jdbc/exceptions/DeadlockTimeoutRollbackMarker.java (from rev 6799, branches/branch_5_1/src/com/mysql/jdbc/exceptions/DeadlockTimeoutRollbackMarker.java)
===================================================================
--- trunk/src/com/mysql/jdbc/exceptions/DeadlockTimeoutRollbackMarker.java	                        (rev 0)
+++ trunk/src/com/mysql/jdbc/exceptions/DeadlockTimeoutRollbackMarker.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -0,0 +1,31 @@
+/*
+ Copyright (C) 2008 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as 
+ published by the Free Software Foundation.
+
+ There are special exceptions to the terms and conditions of the GPL 
+ as it is applied to this software. View the full text of the 
+ exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
+ software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+package com.mysql.jdbc.exceptions;
+
+/**
+ * Marker interface for exceptions that are caused by deadlock/wait timeout
+ */
+public interface DeadlockTimeoutRollbackMarker {
+
+}

Modified: trunk/src/com/mysql/jdbc/exceptions/MySQLTransactionRollbackException.java
===================================================================
--- trunk/src/com/mysql/jdbc/exceptions/MySQLTransactionRollbackException.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/exceptions/MySQLTransactionRollbackException.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -23,7 +23,7 @@
 
 package com.mysql.jdbc.exceptions;
 
-public class MySQLTransactionRollbackException extends MySQLTransientException {
+public class MySQLTransactionRollbackException extends MySQLTransientException implements DeadlockTimeoutRollbackMarker {
 
 	public MySQLTransactionRollbackException(String reason, String SQLState,
 			int vendorCode) {

Modified: trunk/src/com/mysql/jdbc/exceptions/jdbc4/MySQLTransactionRollbackException.java
===================================================================
--- trunk/src/com/mysql/jdbc/exceptions/jdbc4/MySQLTransactionRollbackException.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/exceptions/jdbc4/MySQLTransactionRollbackException.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -25,8 +25,10 @@
 
 import java.sql.SQLTransactionRollbackException;
 
-public class MySQLTransactionRollbackException extends SQLTransactionRollbackException {
+import com.mysql.jdbc.exceptions.DeadlockTimeoutRollbackMarker;
 
+public class MySQLTransactionRollbackException extends SQLTransactionRollbackException implements DeadlockTimeoutRollbackMarker {
+
 	public MySQLTransactionRollbackException(String reason, String SQLState,
 			int vendorCode) {
 		super(reason, SQLState, vendorCode);

Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -25,13 +25,13 @@
 package com.mysql.jdbc.jdbc2.optional;
 
 import java.lang.reflect.Constructor;
-import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Savepoint;
 import java.sql.Statement;
+import java.util.Map;
 import java.util.TimeZone;
 
-import com.mysql.jdbc.ConnectionImpl;
+import com.mysql.jdbc.Connection;
 import com.mysql.jdbc.Extension;
 import com.mysql.jdbc.MysqlErrorNumbers;
 import com.mysql.jdbc.SQLError;
@@ -60,9 +60,8 @@
  * @see org.gjt.mm.mysql.jdbc2.Connection
  * @see org.gjt.mm.mysql.jdbc2.optional.MysqlPooledConnection
  */
-public class ConnectionWrapper extends WrapperBase implements Connection,
-		com.mysql.jdbc.Connection {
-	protected com.mysql.jdbc.ConnectionImpl mc = null;
+public class ConnectionWrapper extends WrapperBase implements Connection {
+	protected Connection mc = null;
 
 	private MysqlPooledConnection mpc = null;
 
@@ -81,7 +80,7 @@
 						"com.mysql.jdbc.jdbc2.optional.JDBC4ConnectionWrapper")
 						.getConstructor(
 								new Class[] { MysqlPooledConnection.class,
-										ConnectionImpl.class, Boolean.TYPE });
+										Connection.class, Boolean.TYPE });
 			} catch (SecurityException e) {
 				throw new RuntimeException(e);
 			} catch (NoSuchMethodException e) {
@@ -96,7 +95,7 @@
 
 	protected static ConnectionWrapper getInstance(
 			MysqlPooledConnection mysqlPooledConnection,
-			ConnectionImpl mysqlConnection, boolean forXa) throws SQLException {
+			Connection mysqlConnection, boolean forXa) throws SQLException {
 		if (!Util.isJdbc4()) {
 			return new ConnectionWrapper(mysqlPooledConnection,
 					mysqlConnection, forXa);
@@ -120,7 +119,7 @@
 	 *             if an error occurs.
 	 */
 	public ConnectionWrapper(MysqlPooledConnection mysqlPooledConnection,
-			ConnectionImpl mysqlConnection, boolean forXa) throws SQLException {
+			Connection mysqlConnection, boolean forXa) throws SQLException {
 		this.mpc = mysqlPooledConnection;
 		this.mc = mysqlConnection;
 		this.closed = false;
@@ -876,7 +875,7 @@
 		return this.mc.isInGlobalTx();
 	}
 
-	protected void setInGlobalTx(boolean flag) {
+	public void setInGlobalTx(boolean flag) {
 		this.mc.setInGlobalTx(flag);
 	}
 
@@ -2548,4 +2547,20 @@
     public void setMysqlIOFactory(String mysqlIOFactoryClassName) {
         this.mc.setMysqlIOFactory(mysqlIOFactoryClassName);
     }
+
+	public boolean getUseColumnNamesInFindColumn() {
+		return this.mc.getUseColumnNamesInFindColumn();
+	}
+
+	public void setUseColumnNamesInFindColumn(boolean flag) {
+		this.mc.setUseColumnNamesInFindColumn(flag);
+	}
+
+	public boolean getUseLocalTransactionState() {
+		return this.mc.getUseLocalTransactionState();
+	}
+
+	public void setUseLocalTransactionState(boolean flag) {
+		this.mc.setUseLocalTransactionState(flag);
+	}
 }

Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4ConnectionWrapper.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4ConnectionWrapper.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4ConnectionWrapper.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -64,7 +64,7 @@
 	 *             if an error occurs.
 	 */
 	public JDBC4ConnectionWrapper(MysqlPooledConnection mysqlPooledConnection,
-			ConnectionImpl mysqlConnection, boolean forXa)
+			com.mysql.jdbc.Connection mysqlConnection, boolean forXa)
 			throws SQLException {
 		super(mysqlPooledConnection, mysqlConnection, forXa);
 	}

Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -62,13 +62,28 @@
 		super(c, conn, toWrap);
 	}
 	
-	public void close() throws SQLException {
+	public synchronized void close() throws SQLException {
+		if (this.pooledConnection == null) {
+			// no-op
+			return;
+		}
+		
+		MysqlPooledConnection con = this.pooledConnection; // we need this
+														   // later...
+
 		try {
 			super.close();
 		} finally {
 			try {
-				((JDBC4MysqlPooledConnection)this.pooledConnection).fireStatementEvent(
-						new StatementEvent(this.pooledConnection, this));
+				StatementEvent e = new StatementEvent(con, this);
+				// todo: pull this all up into base classes when we support *only* JDK6 or newer
+				if (con instanceof JDBC4MysqlPooledConnection) {
+					((JDBC4MysqlPooledConnection) con).fireStatementEvent(e);
+				} else if (con instanceof JDBC4MysqlXAConnection) {
+					((JDBC4MysqlXAConnection) con).fireStatementEvent(e);
+				} else if (con instanceof JDBC4SuspendableXAConnection) {
+					((JDBC4SuspendableXAConnection) con).fireStatementEvent(e);
+				}
 			} finally {
 				this.unwrappedInterfaces = null;
 			}

Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -27,6 +27,7 @@
 import java.io.PrintWriter;
 import java.io.Serializable;
 import java.sql.SQLException;
+import java.util.Iterator;
 import java.util.Properties;
 
 import javax.naming.NamingException;
@@ -419,6 +420,23 @@
 			jdbcUrlToUse = this.url;
 		}
 
+		//
+		// URL should take precedence over properties
+		//
+		
+		Properties urlProps = mysqlDriver.parseURL(jdbcUrlToUse, null);
+		urlProps.remove(NonRegisteringDriver.DBNAME_PROPERTY_KEY);
+		urlProps.remove(NonRegisteringDriver.HOST_PROPERTY_KEY);
+		urlProps.remove(NonRegisteringDriver.PORT_PROPERTY_KEY);
+		
+		Iterator keys = urlProps.keySet().iterator();
+		
+		while (keys.hasNext()) {
+			String key = (String)keys.next();
+			
+			props.setProperty(key, urlProps.getProperty(key));
+		}
+		
 		return mysqlDriver.connect(jdbcUrlToUse, props);
 	}
 //

Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -177,7 +177,7 @@
 			}
 
 			this.logicalHandle = ConnectionWrapper.getInstance(this, 
-					(ConnectionImpl)this.physicalConn, 
+					this.physicalConn, 
 					forXa);
 		} catch (SQLException sqlException) {
 			callConnectionEventListeners(CONNECTION_ERROR_EVENT, sqlException);

Modified: trunk/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/CallableStatementRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/CallableStatementRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -1577,4 +1577,29 @@
 			}
 		}
 	}
+	
+	public void testBug35199() throws Exception {
+		if (!versionMeetsMinimum(5, 0)) {
+			return;
+		}
+
+		createFunction("test_function", "(a varchar(40), " + "b bigint(20), "
+				+ "c varchar(80)) " + "RETURNS bigint(20) " + "LANGUAGE SQL "
+				+ "DETERMINISTIC " + "MODIFIES SQL DATA " + "COMMENT 'bbb' "
+				+ "BEGIN " + "RETURN 1; " + "END; ");
+
+		CallableStatement callable = null;
+		try {
+			callable = conn.prepareCall("{? = call test_function(?,101,?)}");
+			callable.registerOutParameter(1, Types.BIGINT);
+
+			callable.setString(2, "FOO");
+			callable.setString(3, "BAR");
+			callable.executeUpdate();
+		} finally {
+			if (callable != null) {
+				callable.close();
+			}
+		}
+	}
 }
\ No newline at end of file

Modified: trunk/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/ConnectionRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/ConnectionRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -35,6 +35,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
@@ -2356,4 +2357,56 @@
 		Thread.sleep(2000);
 		assertTrue(((Boolean)isValid.invoke(newConn, new Object[] {new Integer(0)})).booleanValue());
 	}
+	
+	public void testBug34937() throws Exception {
+		com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource ds = new
+		com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource();
+		StringBuffer urlBuf = new StringBuffer();
+		urlBuf.append(getMasterSlaveUrl());
+		urlBuf.append("?");
+		Properties props = getMasterSlaveProps();
+		String key = null;
+		
+		Enumeration keyEnum = props.keys();
+		
+		while (keyEnum.hasMoreElements()) {
+			key = (String)keyEnum.nextElement();
+			urlBuf.append(key);
+			urlBuf.append("=");
+			urlBuf.append(props.get(key));
+			urlBuf.append("&");
+		}
+		
+		String url = urlBuf.toString();
+		url = "jdbc:mysql:replication:" + url.substring(url.indexOf("jdbc:mysql:") + "jdbc:mysql:".length());
+		ds.setURL(url);
+		Connection replConn = ds.getPooledConnection().getConnection();
+		
+		boolean readOnly = false;
+		
+		for (int i = 0; i < 10; i++) {
+			this.rs = replConn.createStatement().executeQuery("SELECT 1");
+			assertTrue(this.rs.next());
+			this.rs = replConn.prepareStatement("SELECT 1").executeQuery();
+			assertTrue(this.rs.next());
+			readOnly = !readOnly;
+			replConn.setReadOnly(readOnly);
+		}	
+	}
+	
+	public void testBug35660() throws Exception {
+		
+		Connection lbConn = getLoadBalancedConnection(null);
+		Connection lbConn2 = getLoadBalancedConnection(null);
+		
+		try {
+			assertEquals(this.conn, this.conn);
+			assertEquals(lbConn, lbConn);
+			assertFalse(lbConn.equals(this.conn));
+			assertFalse(lbConn.equals(lbConn2));
+		} finally {
+			lbConn.close();
+			lbConn2.close();
+		}
+	}
 }
\ No newline at end of file

Modified: trunk/src/testsuite/regression/DataSourceRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/DataSourceRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/DataSourceRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -51,6 +51,7 @@
 import testsuite.BaseTestCase;
 import testsuite.simple.DataSourceTest;
 
+import com.mysql.jdbc.ConnectionProperties;
 import com.mysql.jdbc.NonRegisteringDriver;
 import com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker;
 import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
@@ -490,4 +491,25 @@
 		assertNotNull(pc.getConnection().prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY));
 		assertNotNull(pc.getConnection().prepareStatement("SELECT 1", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT));
 	}
+
+	public void testBug35810() throws Exception {
+		int defaultConnectTimeout = ((ConnectionProperties) this.conn).getConnectTimeout();
+		int nonDefaultConnectTimeout = defaultConnectTimeout + 1000 * 2;
+		MysqlConnectionPoolDataSource cpds = new MysqlConnectionPoolDataSource();
+		String dsUrl = BaseTestCase.dbUrl;
+		if (dsUrl.indexOf("?") == -1) {
+			dsUrl += "?";
+		} else {
+			dsUrl += "&";
+		}
+		
+		dsUrl += "connectTimeout=" + nonDefaultConnectTimeout;
+		cpds.setUrl(dsUrl);
+		
+		Connection dsConn = cpds.getPooledConnection().getConnection();
+		int configuredConnectTimeout = ((ConnectionProperties) dsConn).getConnectTimeout();
+		
+		assertEquals("Connect timeout spec'd by URL didn't take", nonDefaultConnectTimeout, configuredConnectTimeout);
+		assertFalse("Connect timeout spec'd by URL didn't take", defaultConnectTimeout == configuredConnectTimeout);
+	}
 }

Modified: trunk/src/testsuite/regression/MetaDataRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/MetaDataRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/MetaDataRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -1639,7 +1639,7 @@
 	 */
 	public void testBug22613() throws Exception {
 		
-		createTable("bug22613", "( s set('a','bc','def','ghij') default NULL, t enum('a', 'ab', 'cdef'))");
+		createTable("bug22613", "( s set('a','bc','def','ghij') default NULL, t enum('a', 'ab', 'cdef'), s2 SET('1','2','3','4','1585','ONE','TWO','Y','N','THREE'))");
 
 		try {
 			checkMetadataForBug22613(this.conn);
@@ -1667,14 +1667,20 @@
 	
 	private void checkMetadataForBug22613(Connection c) throws Exception {
 		String maxValue = "a,bc,def,ghij";
+		String maxValue2 = "1,2,3,4,1585,ONE,TWO,Y,N,THREE";
 		
 		try {
 			DatabaseMetaData meta = c.getMetaData();
 			this.rs = meta.getColumns(null, this.conn.getCatalog(), "bug22613", "s");
 			this.rs.first();
-
+			
 			assertEquals(maxValue.length(), rs.getInt("COLUMN_SIZE"));
 			
+			this.rs = meta.getColumns(null, this.conn.getCatalog(), "bug22613", "s2");
+			this.rs.first();
+			
+			assertEquals(maxValue2.length(), rs.getInt("COLUMN_SIZE"));
+			
 			this.rs = meta.getColumns(null, c.getCatalog(), "bug22613", "t");
 			this.rs.first();
 

Modified: trunk/src/testsuite/regression/PooledConnectionRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/PooledConnectionRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/PooledConnectionRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -42,6 +42,8 @@
 import com.mysql.jdbc.PacketTooBigException;
 import com.mysql.jdbc.jdbc2.optional.ConnectionWrapper;
 import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
+import com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection;
+import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource;
 
 /**
  * Tests a PooledConnection implementation provided by a JDBC driver. Test case
@@ -407,4 +409,35 @@
 			System.out.println("Connection error: " + event.getSQLException());
 		}
 	}
-}
+	
+	/**
+	 * Tests fix for BUG#35489 - Prepared statements from pooled connections cause NPE
+	 * when closed() under JDBC4
+	 * 
+	 * @throws Exception if the test fails
+	 */
+	public void testBug35489() throws Exception {
+		try {
+			MysqlConnectionPoolDataSource pds = new MysqlConnectionPoolDataSource();
+			pds.setUrl(dbUrl);
+			this.pstmt = pds.getPooledConnection().getConnection().prepareStatement("SELECT 1");
+			this.pstmt.execute();
+			this.pstmt.close();
+			
+			MysqlXADataSource xads = new MysqlXADataSource();
+			xads.setUrl(dbUrl);
+			this.pstmt = xads.getXAConnection().getConnection().prepareStatement("SELECT 1");
+			this.pstmt.execute();
+			this.pstmt.close();
+			
+			xads = new MysqlXADataSource();
+			xads.setUrl(dbUrl);
+			xads.setPinGlobalTxToPhysicalConnection(true);
+			this.pstmt = xads.getXAConnection().getConnection().prepareStatement("SELECT 1");
+			this.pstmt.execute();
+			this.pstmt.close();
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
+}
\ No newline at end of file

Modified: trunk/src/testsuite/regression/ResultSetRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/ResultSetRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/ResultSetRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -4676,5 +4676,108 @@
 		while (this.rs.relative(1)) {
 			this.rs.getTimestamp(1);
 		}
-	}	
+	}
+	
+	/**
+	 * @deprecated because we use deprecated methods
+	 */
+	public void testBug34913() throws Exception {
+		try {
+			Timestamp ts = new Timestamp(System.currentTimeMillis());
+			
+			this.pstmt = ((com.mysql.jdbc.Connection) this.conn).serverPrepareStatement("SELECT 'abcdefghij', ?");
+			this.pstmt.setTimestamp(1, ts);
+			this.rs = this.pstmt.executeQuery();
+			this.rs.next();
+			assertTrue(this.rs.getTimestamp(2).getMonth() != 5);
+			assertTrue(this.rs.getTimestamp(2).getDate() != 21);
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
+	
+	public void testBug36051() throws Exception {
+		try {
+			this.rs = this.stmt.executeQuery("SELECT '24:00:00'");
+			this.rs.next();
+			this.rs.getTime(1);
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
+	
+	/**
+	 * Tests fix for BUG#35610, BUG#35150. We follow the JDBC Spec here, in that the 4.0 behavior
+	 * is correct, the JDBC-3.0 (and earlier) spec has a bug, but you can get the buggy behavior
+	 * (allowing column names *and* labels to be used) by setting "useColumnNamesInFindColumn" to
+	 * "true".
+	 * 
+	 * @throws Exception
+	 */
+	public void testBug35610() throws Exception {
+		createTable("testBug35610", "(field1 int, field2 int, field3 int)");
+		this.stmt.executeUpdate("INSERT INTO testBug35610 VALUES (1, 2, 3)");
+		exercise35610(this.stmt, false);
+		exercise35610(getConnectionWithProps("useColumnNamesInFindColumn=true").createStatement(), true);
+	}
+	
+	private void exercise35610(Statement configuredStmt, boolean force30Behavior) throws Exception {
+		try {
+			this.rs = configuredStmt.executeQuery("SELECT field1 AS f1, field2 AS f2, field3 FROM testBug35610");
+			
+			ResultSetMetaData rsmd = this.rs.getMetaData();
+			
+			assertEquals("field1", rsmd.getColumnName(1));
+			assertEquals("field2", rsmd.getColumnName(2));
+			assertEquals("f1", rsmd.getColumnLabel(1));
+			assertEquals("f2", rsmd.getColumnLabel(2));
+			
+
+			
+			assertEquals("field3", rsmd.getColumnName(3));
+			assertEquals("field3", rsmd.getColumnLabel(3));
+			
+			this.rs.next();
+			
+			// From ResultSet.html#getInt(java.lang.String) in JDBC-4.0
+			//
+			// Retrieves the value of the designated column in the current row of this ResultSet
+			// object as an int in the Java programming language.
+			//
+			// Parameters:
+			// columnLabel - the label for the column specified with the SQL AS clause. If the 
+			//               SQL AS clause was not specified, then the label is the name of the column
+			//
+			
+			assertEquals(1, this.rs.getInt("f1"));
+			assertEquals(2, this.rs.getInt("f2"));
+			assertEquals(3, this.rs.getInt("field3"));
+			
+			// Pre-JDBC 4.0, some versions of the spec say "column name *or* label"
+			// for the column name argument...
+			
+			if (force30Behavior) {
+				assertEquals(1, this.rs.getInt("field1"));
+				assertEquals(2, this.rs.getInt("field2"));
+			}
+			
+			if (!force30Behavior) {
+				try {
+					this.rs.findColumn("field1");
+					fail("findColumn(\"field1\" should have failed with an exception");
+				} catch (SQLException sqlEx) {
+					// expected
+				}
+				
+				try {
+					this.rs.findColumn("field2");
+					fail("findColumn(\"field2\" should have failed with an exception");
+				} catch (SQLException sqlEx) {
+					// expected
+				}
+			}
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
 }

Modified: trunk/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/StatementRegressionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/regression/StatementRegressionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -5405,4 +5405,87 @@
 		this.rs.close();
 		assertEquals(((com.mysql.jdbc.Connection)fetchConn).getActiveStatementCount(), stmtCount);
 	}
-}
\ No newline at end of file
+	
+	public void testBug35170() throws Exception {
+		Statement stt = null;
+		
+		try {
+			stt = this.conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
+					ResultSet.CONCUR_READ_ONLY);
+			stt.setFetchSize(Integer.MIN_VALUE);
+			this.rs = stt.executeQuery("select 1");
+			this.rs.next();
+			while (!this.rs.isAfterLast()) {
+				this.rs.getString(1);
+				this.rs.next();
+			}
+		} finally {
+			closeMemberJDBCResources();
+			
+			if (stt != null) {
+				stt.close();
+			}
+		}
+				
+	}
+	
+	/*
+	public void testBug35307() throws Exception {
+		createTable("testBug35307", "(`id` int(11) unsigned NOT NULL auto_increment,"
+			+ "`field` varchar(20) NOT NULL,"
+			+ "`date` datetime NOT NULL,"
+			+ "PRIMARY KEY  (`id`)"
+			+ ") ENGINE=MyISAM DEFAULT CHARSET=latin1");
+		
+		this.stmt.executeUpdate("INSERT INTO testBug35307 (field) values ('works')");
+	}*/
+	
+	public void testBug35666() throws Exception {
+		Connection loggingConn = getConnectionWithProps("logSlowQueries=true");
+		this.pstmt = ((com.mysql.jdbc.Connection) loggingConn).serverPrepareStatement("SELECT SLEEP(4)");
+		this.pstmt.execute();
+	}
+	
+	public void testDeadlockBatchBehavior() throws Exception {
+		try {
+			createTable("t1", "(id INTEGER, x INTEGER) TYPE=INNODB");
+			createTable("t2", "(id INTEGER, x INTEGER) TYPE=INNODB");
+			this.stmt.executeUpdate("INSERT INTO t1 VALUES (0, 0)");
+			
+			this.conn.setAutoCommit(false);
+			this.conn.createStatement().executeQuery(
+					"SELECT * FROM t1 WHERE id=0 FOR UPDATE");
+			
+			Connection deadlockConn = getConnectionWithProps("includeInnodbStatusInDeadlockExceptions=true");
+			deadlockConn.setAutoCommit(false);
+			
+			final Statement deadlockStmt = deadlockConn.createStatement();
+			deadlockStmt.executeUpdate("INSERT INTO t2 VALUES (1, 0)");
+			deadlockStmt.executeQuery("SELECT * FROM t2 WHERE id=0 FOR UPDATE");
+			
+			new Thread() {
+				public void run() {
+					try {
+						deadlockStmt.addBatch("INSERT INTO t2 VALUES (1, 0)");
+						deadlockStmt.addBatch("INSERT INTO t2 VALUES (2, 0)");
+						deadlockStmt.addBatch("UPDATE t1 SET x=2 WHERE id=0");
+						deadlockStmt.executeBatch();
+					} catch (SQLException sqlEx) {
+						sqlEx.printStackTrace();
+					}
+				}
+			}.run();
+			
+			this.stmt.executeUpdate("INSERT INTO t1 VALUES (0, 0)");
+			
+		} catch (BatchUpdateException sqlEx) {
+			int[] updateCounts = sqlEx.getUpdateCounts();
+			for (int i = 0; i < updateCounts.length; i++) {
+				System.out.println(updateCounts[i]);
+			}
+		} finally {
+			this.conn.setAutoCommit(true);
+			closeMemberJDBCResources();
+		}
+	}
+ } 
\ No newline at end of file

Modified: trunk/src/testsuite/simple/ConnectionTest.java
===================================================================
--- trunk/src/testsuite/simple/ConnectionTest.java	2008-07-23 22:02:34 UTC (rev 6799)
+++ trunk/src/testsuite/simple/ConnectionTest.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -1651,4 +1651,30 @@
 		}
 		
 	}
+	
+	public void testLifecyleInterceptor() throws Exception {
+		createTable("testLifecycleInterceptor", "(field1 int) ENGINE=InnoDB");
+		Connection liConn = null;
+		
+		try {
+			liConn = getConnectionWithProps("connectionLifecycleInterceptors=testsuite.simple.TestLifecycleInterceptor");
+			liConn.setAutoCommit(false);
+		
+			liConn.createStatement().executeUpdate("INSERT INTO testLifecycleInterceptor VALUES (1)");
+			liConn.commit();
+			assertEquals(TestLifecycleInterceptor.transactionsBegun, 1);
+			assertEquals(TestLifecycleInterceptor.transactionsCompleted, 1);
+			liConn.createStatement().executeQuery("SELECT * FROM testLifecycleInterceptor");
+			assertEquals(TestLifecycleInterceptor.transactionsBegun, 2);
+			// implicit commit
+			liConn.createStatement().executeUpdate("CREATE TABLE testLifecycleFoo (field1 int)");
+			assertEquals(TestLifecycleInterceptor.transactionsCompleted, 2);
+		} finally {
+			if (liConn != null) {
+				liConn.createStatement().executeUpdate("DROP TABLE IF EXISTS testLifecycleFoo");
+				liConn.close();
+			}
+		}
+		
+	}
 }
\ No newline at end of file

Copied: trunk/src/testsuite/simple/TestLifecycleInterceptor.java (from rev 6799, branches/branch_5_1/src/testsuite/simple/TestLifecycleInterceptor.java)
===================================================================
--- trunk/src/testsuite/simple/TestLifecycleInterceptor.java	                        (rev 0)
+++ trunk/src/testsuite/simple/TestLifecycleInterceptor.java	2008-07-30 14:53:03 UTC (rev 6800)
@@ -0,0 +1,67 @@
+/**
+ * 
+ */
+package testsuite.simple;
+
+import java.sql.SQLException;
+import java.sql.Savepoint;
+import java.util.Properties;
+
+import com.mysql.jdbc.ConnectionLifecycleInterceptor;
+
+public class TestLifecycleInterceptor implements ConnectionLifecycleInterceptor {
+	static int transactionsBegun = 0;
+	static int transactionsCompleted = 0;
+	
+	public void close() throws SQLException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public boolean commit() throws SQLException {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean rollback() throws SQLException {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean rollback(Savepoint s) throws SQLException {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean setAutoCommit(boolean flag) throws SQLException {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean setCatalog(String catalog) throws SQLException {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean transactionBegun() throws SQLException {
+		transactionsBegun++;
+		return true;
+	}
+
+	public boolean transactionCompleted() throws SQLException {
+		transactionsCompleted++;
+		return true;
+	}
+
+	public void destroy() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void init(com.mysql.jdbc.Connection conn, Properties props)
+			throws SQLException {
+		// TODO Auto-generated method stub
+		
+	}
+	
+}
\ No newline at end of file

Thread
Connector/J commit: r6800 - in trunk: . src/com/mysql/jdbc src/com/mysql/jdbc/exceptions src/com/mysql/jdbc/exceptions/jdbc4 src/com/mysql/jdbc/jdbc2/...mmatthews30 Jul