List:Internals« Previous MessageNext Message »
From:mmatthews Date:August 10 2005 3:31am
Subject:Connector/J commit: r4046 - branches/branch_3_1/connector-j/src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
Log:
Fix for ClassCastException when calling .setBytes() when using a server-side prepared
statement.

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
---
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java	2005-08-10
00:08:34 UTC (rev 4045)
+++
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java	2005-08-10
01:31:47 UTC (rev 4046)
@@ -1971,13 +1971,13 @@
 			case MysqlDefs.FIELD_TYPE_VAR_STRING:
 			case MysqlDefs.FIELD_TYPE_STRING:
 			case MysqlDefs.FIELD_TYPE_VARCHAR:
-				if (!this.isLoadDataQuery) {
+				if (value instanceof byte[]) {
+					packet.writeLenBytes((byte[]) value);
+				} else if (!this.isLoadDataQuery) {
 					packet.writeLenString((String) value, this.charEncoding,
 							this.connection.getServerCharacterEncoding(),
 							this.charConverter, this.connection
 									.parserKnowsUnicode());
-				} else if (value instanceof byte[]) {
-					packet.writeLenBytes((byte[]) value);
 				} else {
 					packet.writeLenBytes(((String) value).getBytes());
 				}

Thread
Connector/J commit: r4046 - branches/branch_3_1/connector-j/src/com/mysql/jdbcmmatthews10 Aug