List:Commits« Previous MessageNext Message »
From:mmatthews Date:February 7 2006 10:48pm
Subject:Connector/J commit: r4908 - in branches/branch_5_1/connector-j: . src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_5_1/connector-j/CHANGES
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/Field.java
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java
Log:
Merge of code cleanup from 5.0 branch.

Modified: branches/branch_5_1/connector-j/CHANGES
===================================================================
--- branches/branch_5_1/connector-j/CHANGES	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/CHANGES	2006-02-07 22:48:22 UTC (rev 4908)
@@ -87,6 +87,15 @@
       cancelled due to timeout expiration and have it throw the exception
       instead.
       
+    - Removed dead code in com.mysql.jdbc.Connection. 
+    
+    - Made construction of com.mysql.jdbc.Field (result set metadata)
+      instances more efficient for non-string types by not doing
+      character set initialization, or detection of type changes due to
+      temporary tables.
+      
+    - Removed redundant code in com.mysql.jdbc.MysqlIO.
+      
 xx-xx-06 - Version 3.1.13
 
     - Fixed BUG#15464 - INOUT parameter does not store IN value.

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/Connection.java	2006-02-07 22:48:22 UTC (rev 4908)
@@ -170,17 +170,9 @@
 	 */
 	private static Map mapTransIsolationNameToValue = null;
 
-	/** Table of multi-byte charsets. Initialized by loadCharacterSetMapping() */
-	private static Map multibyteCharsetsMap;
-
 	/** Null logger shared by all connections at startup */
 	private static final Log NULL_LOGGER = new NullLogger(LOGGER_INSTANCE_NAME);
 
-	// The command used to "ping" the database.
-	// Newer versions of MySQL server have a ping() command,
-	// but this works for everything.4
-	private static final String PING_COMMAND = "SELECT 1";
-
 	private static Map roundRobinStatsMap;
 
 	private static final Map serverCollationByUrl = new HashMap();
@@ -520,7 +512,6 @@
 	private String origHostToConnectTo;
 	private int origPortToConnectTo;
 	private String origDatabaseToConnectTo;
-	private String origUrl;
 	
 	
 	/**
@@ -542,7 +533,7 @@
 	 *                if a database access error occurs
 	 */
 	Connection(String hostToConnectTo, int portToConnectTo, Properties info,
-			String databaseToConnectTo, String url, NonRegisteringDriver d)
+			String databaseToConnectTo, String url)
 			throws SQLException {
 		this.connectionCreationTimeMillis = System.currentTimeMillis();
 		this.pointOfOrigin = new Throwable();
@@ -637,12 +628,12 @@
 			this.connectionId = this.io.getThreadId();
 			this.dbmd = new DatabaseMetaData(this, this.database);
 		} catch (SQLException ex) {
-			cleanup(new Throwable(), ex);
+			cleanup(ex);
 
 			// don't clobber SQL exceptions
 			throw ex;
 		} catch (Exception ex) {
-			cleanup(new Throwable(), ex);
+			cleanup(ex);
 
 			StringBuffer mesg = new StringBuffer();
 
@@ -685,7 +676,7 @@
 			long[] histogramBreakpoints, long value, int numberOfTimes,
 			long currentLowerBound, long currentUpperBound) {
 		if (histogramCounts == null) {
-			createInitialHistogram(histogramCounts, histogramBreakpoints,
+			createInitialHistogram(histogramBreakpoints,
 					currentLowerBound, currentUpperBound);
 		}
 
@@ -1121,7 +1112,7 @@
 	 * @param whyCleanedUp
 	 *            DOCUMENT ME!
 	 */
-	private void cleanup(Throwable fromWhere, Throwable whyCleanedUp) {
+	private void cleanup(Throwable whyCleanedUp) {
 		try {
 			if ((this.io != null) && !isClosed()) {
 				realClose(false, false, false, whyCleanedUp);
@@ -1230,8 +1221,8 @@
 					this.database);
 		}
 
-		pStmt.setResultSetType(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE);
-		pStmt.setResultSetConcurrency(java.sql.ResultSet.CONCUR_READ_ONLY);
+		pStmt.setResultSetType(resultSetType);
+		pStmt.setResultSetConcurrency(resultSetConcurrency);
 
 		return pStmt;
 	}
@@ -1312,8 +1303,8 @@
 			} else if (this.transactionsSupported) {
 				execSQL(null, "commit", -1, null,
 						java.sql.ResultSet.TYPE_FORWARD_ONLY,
-						java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-						this.database, true, Statement.USES_VARIABLES_FALSE,
+						java.sql.ResultSet.CONCUR_READ_ONLY, false,
+						this.database, true,
 						false);
 			}
 		} catch (SQLException sqlException) {
@@ -1371,6 +1362,8 @@
 		}
 	}
 
+	// --------------------------JDBC 2.0-----------------------------
+
 	/**
 	 * Sets up client character set for MySQL-4.1 and newer if the user This
 	 * must be done before any further communication with the server!
@@ -1438,8 +1431,7 @@
 								execSQL(null, "SET NAMES utf8", -1, null,
 										java.sql.ResultSet.TYPE_FORWARD_ONLY,
 										java.sql.ResultSet.CONCUR_READ_ONLY,
-										false, false, this.database, true,
-										Statement.USES_VARIABLES_FALSE, false);
+										false, this.database, true, false);
 							}
 
 							setEncoding(realJavaEncoding);
@@ -1464,8 +1456,7 @@
 										-1, null,
 										java.sql.ResultSet.TYPE_FORWARD_ONLY,
 										java.sql.ResultSet.CONCUR_READ_ONLY,
-										false, false, this.database, true,
-										Statement.USES_VARIABLES_FALSE, false);
+										false, this.database, true, false);
 							}
 
 							// Switch driver's encoding now, since the server
@@ -1484,8 +1475,7 @@
 						execSQL(null, "SET NAMES " + mysqlEncodingName, -1,
 								null, java.sql.ResultSet.TYPE_FORWARD_ONLY,
 								java.sql.ResultSet.CONCUR_READ_ONLY, false,
-								false, this.database, true,
-								Statement.USES_VARIABLES_FALSE, false);
+								this.database, true, false);
 
 						realJavaEncoding = getEncoding();
 					}
@@ -1501,8 +1491,8 @@
 				if (getCharacterSetResults() == null) {
 					execSQL(null, "SET character_set_results = NULL", -1, null,
 							java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-							this.database, true, Statement.USES_VARIABLES_FALSE,
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
+							this.database, true, 
 							false);
 				} else {
 					String charsetResults = getCharacterSetResults();
@@ -1525,9 +1515,8 @@
 
 					execSQL(null, setBuf.toString(), -1, null,
 							java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-							this.database, true, Statement.USES_VARIABLES_FALSE, 
-							false);
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
+							this.database, true, false);
 				}
 
 				if (getConnectionCollation() != null) {
@@ -1539,9 +1528,8 @@
 
 					execSQL(null, setBuf.toString(), -1, null,
 							java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-							this.database, true, Statement.USES_VARIABLES_FALSE,
-							false);
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
+							this.database, true, false);
 				}
 			} else {
 				// Use what the server has specified
@@ -1559,8 +1547,6 @@
 		return characterSetAlreadyConfigured;
 	}
 
-	// --------------------------JDBC 2.0-----------------------------
-
 	/**
 	 * Configures the client's timezone if required.
 	 * 
@@ -1636,7 +1622,7 @@
 		throw new ToBeImplementedException();
 	}
 
-	private void createInitialHistogram(int[] counts, long[] breakpoints,
+	private void createInitialHistogram(long[] breakpoints,
 			long lowerBound, long upperBound) {
 
 		double bucketSize = (((double) upperBound - (double) lowerBound) / HISTOGRAM_BUCKETS) * 1.25;
@@ -1736,7 +1722,7 @@
 						// Server properties might be different
 						// from previous connection, so initialize
 						// again...
-						initializePropsFromServer(this.props);
+						initializePropsFromServer();
 
 						if (isForReconnect) {
 							// Restore state from old connection
@@ -1863,7 +1849,7 @@
 							// Server properties might be different
 							// from previous connection, so initialize
 							// again...
-							initializePropsFromServer(this.props);
+							initializePropsFromServer();
 
 							if (isForReconnect) {
 								// Restore state from old connection
@@ -2081,8 +2067,7 @@
 				this.origPortToConnectTo,
 				this.props,
 				this.origDatabaseToConnectTo,
-				this.myURL,
-				null);
+				this.myURL);
 	}
 
 	/**
@@ -2130,17 +2115,17 @@
 	// }
 	synchronized ResultSet execSQL(Statement callingStatement, String sql, int maxRows,
 			Buffer packet, int resultSetType, int resultSetConcurrency,
-			boolean streamResults, boolean queryIsSelectOnly, String catalog,
+			boolean streamResults, String catalog,
 			boolean unpackFields) throws SQLException {
 		return execSQL(callingStatement, sql, maxRows, packet, resultSetType,
-				resultSetConcurrency, streamResults, queryIsSelectOnly,
-				catalog, unpackFields, Statement.USES_VARIABLES_FALSE, false);
+				resultSetConcurrency, streamResults,
+				catalog, unpackFields, false);
 	}
 
 	synchronized ResultSet execSQL(Statement callingStatement, String sql, int maxRows,
 			Buffer packet, int resultSetType, int resultSetConcurrency,
-			boolean streamResults, boolean queryIsSelectOnly, String catalog,
-			boolean unpackFields, byte queryUsesVariables,
+			boolean streamResults, String catalog,
+			boolean unpackFields,
 			boolean isBatch) throws SQLException {
 		//
 		// Fall-back if the master is back online if we've
@@ -2236,7 +2221,7 @@
 					if ((sqlState != null)
 							&& sqlState
 									.equals(SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE)) {
-						cleanup(new Throwable(), sqlE);
+						cleanup(sqlE);
 					}
 				}
 
@@ -2245,7 +2230,7 @@
 				if ((getHighAvailability() || this.failedOver)) {
 					this.needsPing = true;
 				} else if (ex instanceof IOException) {
-					cleanup(new Throwable(), ex);
+					cleanup(ex);
 				}
 
 				String exceptionType = ex.getClass().getName();
@@ -2329,7 +2314,7 @@
 	 *             DOCUMENT ME!
 	 */
 	protected void finalize() throws Throwable {
-		cleanup(new Throwable(), null);
+		cleanup(null);
 	}
 
 	protected StringBuffer generateConnectionCommentBlock(StringBuffer buf) {
@@ -2916,7 +2901,7 @@
 	 * @throws SQLException
 	 *             DOCUMENT ME!
 	 */
-	private void initializePropsFromServer(Properties info) throws SQLException {
+	private void initializePropsFromServer() throws SQLException {
 		setSessionVariables();
 
 		//
@@ -3785,7 +3770,7 @@
 			oldHistBreakpoints[i] = histBreakpoints[i];
 		}
 
-		createInitialHistogram(histCounts, histBreakpoints, currentLowerBound,
+		createInitialHistogram(histBreakpoints, currentLowerBound,
 				currentUpperBound);
 
 		for (int i = 0; i < HISTOGRAM_BUCKETS; i++) {
@@ -3830,7 +3815,7 @@
 					+ this.shortestQueryTimeMs + " ms");
 			logMessage
 					.append("\nAverage query execution time: "
-							+ ((double) this.totalQueryTimeMs / (double) this.numberOfQueriesIssued)
+							+ (this.totalQueryTimeMs / this.numberOfQueriesIssued)
 							+ " ms");
 			logMessage.append("\nNumber of statements executed: "
 					+ this.numberOfQueriesIssued);
@@ -4118,9 +4103,8 @@
 	private void rollbackNoChecks() throws SQLException {
 		execSQL(null, "rollback", -1, null,
 				java.sql.ResultSet.TYPE_FORWARD_ONLY,
-				java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-				this.database, true, Statement.USES_VARIABLES_FALSE, 
-				false);
+				java.sql.ResultSet.CONCUR_READ_ONLY, false,
+				this.database, true, false);
 	}
 
 	/**
@@ -4196,9 +4180,8 @@
 					execSQL(null, autoCommitFlag ? "SET autocommit=1"
 							: "SET autocommit=0", -1, null,
 							java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-							this.database, true, Statement.USES_VARIABLES_FALSE,
-							false);
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
+							this.database, true, false);
 				}
 
 			} else {
@@ -4265,9 +4248,8 @@
 
 		execSQL(null, query.toString(), -1, null,
 				java.sql.ResultSet.TYPE_FORWARD_ONLY,
-				java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-				this.database, true, Statement.USES_VARIABLES_FALSE,
-				false);
+				java.sql.ResultSet.CONCUR_READ_ONLY, false,
+				this.database, true, false);
 		this.database = catalog;
 	}
 
@@ -4277,6 +4259,7 @@
 
 	public void setClientInfo(String name, String value) throws SQLException {
 		throw new ToBeImplementedException();
+		
 	}
 
 	/**
@@ -4487,9 +4470,8 @@
 
 				execSQL(null, sql, -1, null,
 						java.sql.ResultSet.TYPE_FORWARD_ONLY,
-						java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-						this.database, true, Statement.USES_VARIABLES_FALSE, 
-						false);
+						java.sql.ResultSet.CONCUR_READ_ONLY,false,
+						this.database, true, false);
 
 				this.isolationLevel = level;
 			}
@@ -4552,7 +4534,7 @@
 	public boolean supportsIsolationLevel() {
 		return this.hasIsolationLevels;
 	}
-
+	
 	/**
 	 * DOCUMENT ME!
 	 * 
@@ -4561,7 +4543,7 @@
 	public boolean supportsQuotedIdentifiers() {
 		return this.hasQuotedIdentifiers;
 	}
-
+	
 	/**
 	 * DOCUMENT ME!
 	 * 
@@ -4602,9 +4584,8 @@
 						&& (this.statementsUsingMaxRows.size() == 0)) {
 					execSQL(null, "SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1,
 							null, java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
-							this.database, true, Statement.USES_VARIABLES_FALSE,
-							false);
+							java.sql.ResultSet.CONCUR_READ_ONLY, false, 
+							this.database, true, false);
 
 					this.maxRowsChanged = false;
 				}
@@ -4615,11 +4596,11 @@
 	public Object unwrap(Class arg0) throws SQLException {
 		throw new ToBeImplementedException();
 	}
-	
+
 	boolean useAnsiQuotedIdentifiers() {
 		return this.useAnsiQuotes;
 	}
-	
+
 	/**
 	 * Has maxRows() been set?
 	 * 

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/Field.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/Field.java	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/Field.java	2006-02-07 22:48:22 UTC (rev 4908)
@@ -154,8 +154,6 @@
 		// charset
 		this.charsetIndex = charsetIndex;
 
-		this.charsetName = this.connection
-				.getCharsetNameForIndex(this.charsetIndex);
 		
 		// Map MySqlTypes to java.sql Types
 		this.sqlType = MysqlDefs.mysqlToJavaType(this.mysqlType);
@@ -174,35 +172,6 @@
 			}
 		}
 
-		// Handle VARBINARY/BINARY (server doesn't have a different type
-		// for this
-
-		boolean isBinary = isBinary();
-
-		if (this.connection.versionMeetsMinimum(4, 1, 0) &&
-				this.mysqlType == MysqlDefs.FIELD_TYPE_VAR_STRING && 
-				isBinary &&
-				this.charsetIndex == 63) {
-			if (this.isOpaqueBinary()) {
-				this.sqlType = Types.VARBINARY;
-			}
-		} 
-		
-		if (this.connection.versionMeetsMinimum(4, 1, 0) &&
-				this.mysqlType == MysqlDefs.FIELD_TYPE_STRING && 
-				isBinary && this.charsetIndex == 63) {
-			//
-			// Okay, this is a hack, but there's currently no way
-			// to easily distinguish something like DATE_FORMAT( ..)
-			// from the "BINARY" column type, other than looking
-			// at the original column name.
-			//
-			
-			if (isOpaqueBinary()) {
-				this.sqlType = Types.BINARY;
-			}
-		}
-
 		if (this.sqlType == Types.TINYINT && this.length == 1
 				&& this.connection.getTinyInt1isBit()) {
 			// Adjust for pseudo-boolean
@@ -215,29 +184,68 @@
 			}
 
 		}
+		
+		if (!isNativeNumericType() && !isNativeDateTimeType()) {
+			this.charsetName = this.connection
+				.getCharsetNameForIndex(this.charsetIndex);
 
-		if (this.mysqlType == MysqlDefs.FIELD_TYPE_BIT) {
-			if (this.length == 0) {
-				this.sqlType = Types.BIT;
-			} else {
-				this.sqlType = Types.VARBINARY;
-				this.colFlag |= 128; // we need to pretend this is a full
-				this.colFlag |= 16; // binary blob
+			
+			// Handle VARBINARY/BINARY (server doesn't have a different type
+			// for this
+	
+			boolean isBinary = isBinary();
+	
+			if (this.connection.versionMeetsMinimum(4, 1, 0) &&
+					this.mysqlType == MysqlDefs.FIELD_TYPE_VAR_STRING && 
+					isBinary &&
+					this.charsetIndex == 63) {
+				if (this.isOpaqueBinary()) {
+					this.sqlType = Types.VARBINARY;
+				}
+			} 
+			
+			if (this.connection.versionMeetsMinimum(4, 1, 0) &&
+					this.mysqlType == MysqlDefs.FIELD_TYPE_STRING && 
+					isBinary && this.charsetIndex == 63) {
+				//
+				// Okay, this is a hack, but there's currently no way
+				// to easily distinguish something like DATE_FORMAT( ..)
+				// from the "BINARY" column type, other than looking
+				// at the original column name.
+				//
+				
+				if (isOpaqueBinary()) {
+					this.sqlType = Types.BINARY;
+				}
 			}
+	
+			
+	
+			if (this.mysqlType == MysqlDefs.FIELD_TYPE_BIT) {
+				if (this.length == 0) {
+					this.sqlType = Types.BIT;
+				} else {
+					this.sqlType = Types.VARBINARY;
+					this.colFlag |= 128; // we need to pretend this is a full
+					this.colFlag |= 16; // binary blob
+				}
+			}
+	
+			//
+			// Handle TEXT type (special case), Fix proposed by Peter McKeown
+			//
+			if ((this.sqlType == java.sql.Types.LONGVARBINARY) && !isBinary) {
+				this.sqlType = java.sql.Types.LONGVARCHAR;
+			} else if ((this.sqlType == java.sql.Types.VARBINARY) && !isBinary) {
+				this.sqlType = java.sql.Types.VARCHAR;
+			}
+			
+			checkForImplicitTemporaryTable();
+		} else {
+			this.charsetName = "US-ASCII";
 		}
 
-		
-
 		//
-		// Handle TEXT type (special case), Fix proposed by Peter McKeown
-		//
-		if ((this.sqlType == java.sql.Types.LONGVARBINARY) && !isBinary) {
-			this.sqlType = java.sql.Types.LONGVARCHAR;
-		} else if ((this.sqlType == java.sql.Types.VARBINARY) && !isBinary) {
-			this.sqlType = java.sql.Types.VARCHAR;
-		}
-
-		//
 		// Handle odd values for 'M' for floating point/decimal numbers
 		//
 		if (!isUnsigned()) {
@@ -262,8 +270,6 @@
 				break;
 			}
 		}
-
-		checkForImplicitTemporaryTable();
 	}
 
 	/**
@@ -306,7 +312,7 @@
 	 * 
 	 * @return the character set
 	 */
-	public String getCharacterSet() {
+	public String getCharacterSet() throws SQLException {
 		return this.charsetName;
 	}
 
@@ -801,6 +807,21 @@
 			this.mysqlType = MysqlDefs.FIELD_TYPE_LONG_BLOB;
 		}
 	}
+	
+	private boolean isNativeNumericType() {
+		return ((this.mysqlType >= MysqlDefs.FIELD_TYPE_TINY && 
+					this.mysqlType <= MysqlDefs.FIELD_TYPE_DOUBLE) ||
+					this.mysqlType == MysqlDefs.FIELD_TYPE_LONGLONG ||
+					this.mysqlType == MysqlDefs.FIELD_TYPE_YEAR);
+	}
+	
+	private boolean isNativeDateTimeType() {
+		return (this.mysqlType == MysqlDefs.FIELD_TYPE_DATE ||
+				this.mysqlType == MysqlDefs.FIELD_TYPE_NEWDATE ||
+				this.mysqlType == MysqlDefs.FIELD_TYPE_DATETIME ||
+				this.mysqlType == MysqlDefs.FIELD_TYPE_TIME ||
+				this.mysqlType == MysqlDefs.FIELD_TYPE_TIMESTAMP);
+	}
 
 	/**
 	 * DOCUMENT ME!

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/MysqlIO.java	2006-02-07 22:48:22 UTC (rev 4908)
@@ -507,7 +507,7 @@
                 packet.writeString(database);
             }
 
-            send(packet);
+            send(packet, packet.getPosition());
             checkErrorPacket();
 			
 			if (!localUseConnectWithDb) {
@@ -1081,7 +1081,7 @@
                     packet.writeString(database);
                 }
 
-                send(packet);
+                send(packet, packet.getPosition());
             }
         } else {
             negotiateSSLConnection(user, password, database, packLength);
@@ -1668,7 +1668,7 @@
             packet.writeInt((int) this.clientParam);
         }
 
-        send(packet);
+        send(packet, packet.getPosition());
 
         ExportControlled.transformSocketToSSLSocket(this);
 
@@ -1703,7 +1703,7 @@
                 packet.writeString(database);
             }
 
-            send(packet);
+            send(packet, packet.getPosition());
         }
     }
 
@@ -1775,7 +1775,7 @@
         Buffer packet = new Buffer(6);
         this.packetSequence = -1;
         packet.writeByte((byte) MysqlDefs.QUIT);
-        send(packet);
+        send(packet, packet.getPosition());
         forceClose();
     }
 
@@ -2402,7 +2402,7 @@
             packet.writeString(database);
         }
 
-        send(packet);
+        send(packet, packet.getPosition());
 
         //
         // Don't continue stages if password is empty
@@ -2573,7 +2573,7 @@
             packet.writeString(database);
         }
 
-        send(packet);
+        send(packet, packet.getPosition());
 
         byte savePacketSequence = this.packetSequence++;
 
@@ -2589,32 +2589,13 @@
 
             String seed323 = this.seed.substring(0, 8);
             packet.writeString(Util.newCrypt(password, seed323));
-            send(packet);
+            send(packet, packet.getPosition());
 
             /* Read what server thinks about out new auth message report */
             checkErrorPacket();
         }
     }
 
-    /**
-    * Send a packet to the MySQL server
-    *
-    * @param packet DOCUMENT ME!
-    *
-    * @throws SQLException DOCUMENT ME!
-    */
-    final void send(Buffer packet) throws SQLException {
-        int l = packet.getPosition();
-        send(packet, l);
-
-        // 
-        // Don't hold on to large packets
-        //
-        if (packet == this.sharedSendPacket) {
-            reclaimLargeSharedSendPacket();
-        }
-    }
-
     private final void send(Buffer packet, int packetLen)
         throws SQLException {
         try {
@@ -2793,10 +2774,10 @@
                         this.sendPacket.writeLong(id);
                     }
 
-                    send(this.sendPacket);
+                    send(this.sendPacket, this.sendPacket.getPosition());
                 } else {
                     this.packetSequence = -1;
-                    send(queryPacket); // packet passed by PreparedStatement
+                    send(queryPacket, queryPacket.getPosition()); // packet passed by PreparedStatement
                 }
             } catch (SQLException sqlEx) {
                 // don't wrap SQLExceptions
@@ -2899,7 +2880,7 @@
             while ((bytesRead = fileIn.read(fileBuf)) != -1) {
                 filePacket.clear();
                 filePacket.writeBytesNoNull(fileBuf, 0, bytesRead);
-                send(filePacket);
+                send(filePacket, filePacket.getPosition());
             }
         } catch (IOException ioEx) {
             StringBuffer messageBuf = new StringBuffer(Messages.getString(
@@ -2937,14 +2918,14 @@
             } else {
                 // file open failed, but server needs one packet
                 filePacket.clear();
-                send(filePacket);
+                send(filePacket, filePacket.getPosition());
                 checkErrorPacket(); // to clear response off of queue
             }
         }
 
         // send empty packet to mark EOF
         filePacket.clear();
-        send(filePacket);
+        send(filePacket, filePacket.getPosition());
 
         Buffer resultPacket = checkErrorPacket();
 

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java	2006-02-07 22:48:22 UTC (rev 4908)
@@ -264,7 +264,7 @@
 
 		try {
 			Connection newConn = new com.mysql.jdbc.Connection(host(props),
-					port(props), props, database(props), url, this);
+					port(props), props, database(props), url);
 
 			return newConn;
 		} catch (SQLException sqlEx) {

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java	2006-02-07 22:48:22 UTC (rev 4908)
@@ -741,7 +741,7 @@
 							this.connection.execSQL(this,
 									"SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1, //$NON-NLS-1$
 									null, java.sql.ResultSet.TYPE_FORWARD_ONLY,
-									java.sql.ResultSet.CONCUR_READ_ONLY, false,
+									java.sql.ResultSet.CONCUR_READ_ONLY,
 									false, this.currentCatalog, true);
 						} else {
 							this.connection
@@ -751,7 +751,7 @@
 											null,
 											java.sql.ResultSet.TYPE_FORWARD_ONLY,
 											java.sql.ResultSet.CONCUR_READ_ONLY,
-											false, false, this.currentCatalog,
+											false, this.currentCatalog,
 											true);
 						}
 					}
@@ -759,7 +759,7 @@
 					this.connection.execSQL(this,
 							"SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1, null, //$NON-NLS-1$
 							java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
 							this.currentCatalog, true);
 				}
 
@@ -945,8 +945,8 @@
 			
 			rs = this.connection.execSQL(this, null, maxRowsToRetrieve, sendPacket,
 				this.resultSetType, this.resultSetConcurrency,
-				createStreamingResultSet, false, this.currentCatalog,
-				unpackFields, USES_VARIABLES_UNKNOWN, isBatch);
+				createStreamingResultSet, this.currentCatalog,
+				unpackFields, isBatch);
 		
 			if (this.wasCancelled) {
 				this.wasCancelled = false;
@@ -1029,7 +1029,7 @@
 										"SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1, null, //$NON-NLS-1$
 										java.sql.ResultSet.TYPE_FORWARD_ONLY,
 										java.sql.ResultSet.CONCUR_READ_ONLY,
-										false, false, this.currentCatalog, true);
+										false, this.currentCatalog, true);
 					} else {
 						this.connection
 								.execSQL(
@@ -1037,7 +1037,7 @@
 										"SET OPTION SQL_SELECT_LIMIT=" + this.maxRows, -1, null, //$NON-NLS-1$
 										java.sql.ResultSet.TYPE_FORWARD_ONLY,
 										java.sql.ResultSet.CONCUR_READ_ONLY,
-										false, false, this.currentCatalog, true);
+										false, this.currentCatalog, true);
 					}
 
 					this.results = executeInternal(-1, sendPacket,
@@ -1173,7 +1173,7 @@
 				this.connection.execSQL(this,
 						"SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1, null, //$NON-NLS-1$
 						java.sql.ResultSet.TYPE_FORWARD_ONLY,
-						java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
+						java.sql.ResultSet.CONCUR_READ_ONLY, false,
 						this.currentCatalog, true);
 			}
 

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java	2006-02-07 22:39:40 UTC (rev 4907)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java	2006-02-07 22:48:22 UTC (rev 4908)
@@ -650,7 +650,7 @@
 													null,
 													java.sql.ResultSet.TYPE_FORWARD_ONLY,
 													java.sql.ResultSet.CONCUR_READ_ONLY,
-													false, false,
+													false, 
 													this.currentCatalog, true); //$NON-NLS-1$
 								} else {
 									this.connection
@@ -661,7 +661,7 @@
 													null,
 													java.sql.ResultSet.TYPE_FORWARD_ONLY,
 													java.sql.ResultSet.CONCUR_READ_ONLY,
-													false, false,
+													false,
 													this.currentCatalog, true); //$NON-NLS-1$
 								}
 							}
@@ -672,19 +672,19 @@
 											"SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1, null, //$NON-NLS-1$
 											java.sql.ResultSet.TYPE_FORWARD_ONLY,
 											java.sql.ResultSet.CONCUR_READ_ONLY,
-											false, false, this.currentCatalog,
+											false, this.currentCatalog,
 											true); //$NON-NLS-1$
 						}
 
 						// Finally, execute the query
 						rs = this.connection.execSQL(this, sql, rowLimit, null,
 								this.resultSetType, this.resultSetConcurrency,
-								createStreamingResultSet(), isSelect,
+								createStreamingResultSet(), 
 								this.currentCatalog, (cachedMetaData == null));
 					} else {
 						rs = this.connection.execSQL(this, sql, -1, null,
 								this.resultSetType, this.resultSetConcurrency,
-								createStreamingResultSet(), isSelect,
+								createStreamingResultSet(),
 								this.currentCatalog, (cachedMetaData == null));
 					}
 
@@ -975,7 +975,7 @@
 						this.results = this.connection.execSQL(this, sql,
 								this.maxRows, null, this.resultSetType,
 								this.resultSetConcurrency,
-								createStreamingResultSet(), true,
+								createStreamingResultSet(),
 								this.currentCatalog, (cachedMetaData == null));
 					} else {
 						if (this.maxRows <= 0) {
@@ -985,7 +985,7 @@
 											"SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1, null, //$NON-NLS-1$
 											java.sql.ResultSet.TYPE_FORWARD_ONLY,
 											java.sql.ResultSet.CONCUR_READ_ONLY,
-											false, false, this.currentCatalog,
+											false, this.currentCatalog,
 											true); //$NON-NLS-1$
 						} else {
 							this.connection
@@ -995,14 +995,14 @@
 											null,
 											java.sql.ResultSet.TYPE_FORWARD_ONLY,
 											java.sql.ResultSet.CONCUR_READ_ONLY,
-											false, false, this.currentCatalog,
+											false, this.currentCatalog,
 											true); //$NON-NLS-1$
 						}
 
 						this.results = this.connection.execSQL(this, sql, -1,
 								null, this.resultSetType,
 								this.resultSetConcurrency,
-								createStreamingResultSet(), true,
+								createStreamingResultSet(),
 								this.currentCatalog, (cachedMetaData == null));
 
 						if (oldCatalog != null) {
@@ -1012,7 +1012,7 @@
 				} else {
 					this.results = this.connection.execSQL(this, sql, -1, null,
 							this.resultSetType, this.resultSetConcurrency,
-							createStreamingResultSet(), true,
+							createStreamingResultSet(),
 							this.currentCatalog, (cachedMetaData == null));
 				}
 
@@ -1144,16 +1144,16 @@
 							this,
 							"SET OPTION SQL_SELECT_LIMIT=DEFAULT", //$NON-NLS-1$
 							-1, null, java.sql.ResultSet.TYPE_FORWARD_ONLY,
-							java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
+							java.sql.ResultSet.CONCUR_READ_ONLY, false,
 							this.currentCatalog, true);
 				}
 
 				rs = this.connection.execSQL(this, sql, -1, null,
 						java.sql.ResultSet.TYPE_FORWARD_ONLY,
-						java.sql.ResultSet.CONCUR_READ_ONLY, false, false,
+						java.sql.ResultSet.CONCUR_READ_ONLY, false,
 						this.currentCatalog,
 						true /* force read of field info on DML */,
-						USES_VARIABLES_FALSE, isBatch);
+						isBatch);
 
 				if (oldCatalog != null) {
 					this.connection.setCatalog(oldCatalog);

Thread
Connector/J commit: r4908 - in branches/branch_5_1/connector-j: . src/com/mysql/jdbcmmatthews7 Feb