Removed:
trunk/src/com/mysql/jdbc/exceptions/NotYetImplementedException.java
Modified:
trunk/
trunk/CHANGES
trunk/build.xml
trunk/src/com/mysql/jdbc/Blob.java
trunk/src/com/mysql/jdbc/BlobFromLocator.java
trunk/src/com/mysql/jdbc/BufferRow.java
trunk/src/com/mysql/jdbc/CallableStatement.java
trunk/src/com/mysql/jdbc/Clob.java
trunk/src/com/mysql/jdbc/CommunicationsException.java
trunk/src/com/mysql/jdbc/ConnectionFeatureNotAvailableException.java
trunk/src/com/mysql/jdbc/ConnectionImpl.java
trunk/src/com/mysql/jdbc/DatabaseMetaData.java
trunk/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
trunk/src/com/mysql/jdbc/ExportControlled.java
trunk/src/com/mysql/jdbc/JDBC4CallableStatement.java
trunk/src/com/mysql/jdbc/JDBC4ClientInfoProvider.java
trunk/src/com/mysql/jdbc/JDBC4Connection.java
trunk/src/com/mysql/jdbc/JDBC4MysqlSQLXML.java
trunk/src/com/mysql/jdbc/JDBC4PreparedStatement.java
trunk/src/com/mysql/jdbc/JDBC4PreparedStatementHelper.java
trunk/src/com/mysql/jdbc/JDBC4ResultSet.java
trunk/src/com/mysql/jdbc/JDBC4UpdatableResultSet.java
trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties
trunk/src/com/mysql/jdbc/MysqlIOprotocol.java
trunk/src/com/mysql/jdbc/PreparedStatement.java
trunk/src/com/mysql/jdbc/ResultSetImpl.java
trunk/src/com/mysql/jdbc/ResultSetMetaData.java
trunk/src/com/mysql/jdbc/ResultSetRow.java
trunk/src/com/mysql/jdbc/RowDataStatic.java
trunk/src/com/mysql/jdbc/SQLError.java
trunk/src/com/mysql/jdbc/ServerPreparedStatement.java
trunk/src/com/mysql/jdbc/StatementImpl.java
trunk/src/com/mysql/jdbc/UpdatableResultSet.java
trunk/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java
trunk/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java
trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4CallableStatementWrapper.java
trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java
trunk/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java
trunk/src/com/mysql/jdbc/log/LogFactory.java
trunk/src/testsuite/regression/BlobRegressionTest.java
trunk/src/testsuite/regression/CallableStatementRegressionTest.java
trunk/src/testsuite/regression/ConnectionRegressionTest.java
trunk/src/testsuite/regression/MetaDataRegressionTest.java
trunk/src/testsuite/regression/ResultSetRegressionTest.java
trunk/src/testsuite/regression/StatementRegressionTest.java
Log:
Merged revisions
6585-6586,6593-6597,6599-6602,6605,6607-6609,6612,6614-6617,6619-6620,6623-6627,6632,6636-6638,6641,6649,6658-6659,6663,6665-6673,6676,6681-6682,6684,6686,6688,6690-6691,6693,6698,6707,6709-6713,6718,6720,6722-6724,6726-6747
via svnmerge from
svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_1
.......
r6729 | mmatthews | 2008-02-06 21:59:31 -0600 (Wed, 06 Feb 2008) | 2 lines
Fixed issue where META-INF in the binary .jar file wasn't packed correctly,
leading to failure of the JDBC-4.0 SPI mechanism.
.......
r6730 | mmatthews | 2008-02-07 09:57:27 -0600 (Thu, 07 Feb 2008) | 3 lines
CallableStatements that aren't really stored procedure or stored function calls can
now be used, for tools such as Oracle JDeveloper ADF that issue statements such as
DDL through CallableStatements.
.......
r6731 | mmatthews | 2008-02-07 10:03:02 -0600 (Thu, 07 Feb 2008) | 1 line
Use nested exceptions for failure to load a logger implementation.
.......
r6732 | mmatthews | 2008-02-13 08:06:48 -0600 (Wed, 13 Feb 2008) | 3 lines
Fixed BUG#34518 - Statements using cursor fetch leaked internal prepared statements
until connection was closed. The internal prepared statement is now held open
while
the result set is open, and closed by the result set itself being closed.
.......
r6733 | mmatthews | 2008-02-15 15:30:33 -0600 (Fri, 15 Feb 2008) | 4 lines
CommunicationExceptions now carry information about the last time a packet
was received from the MySQL server, as well as when the last packet was sent
to one, in an effort to make it easier to debug communications errors caused
by network timeouts.
.......
r6734 | mmatthews | 2008-02-20 11:13:12 -0600 (Wed, 20 Feb 2008) | 1 line
Fixed BUG#34677 - Blob.truncate() wouldn't take "0" as an argument.
.......
r6735 | mmatthews | 2008-02-20 20:52:52 -0600 (Wed, 20 Feb 2008) | 5 lines
Reverted a change to DatabaseMetadata.getColumns() from 5.0, where
getColumns() would report NULL for COLUMN_SIZE for TIME, DATE, DATETIME
and TIMESTAMP types. It now reports the column size, in the
DatabaseMetadata implementations that use "SHOW" commands, and the
INFORMATION_SCHEMA.
.......
r6737 | mmatthews | 2008-02-26 22:30:46 -0600 (Tue, 26 Feb 2008) | 4 lines
Fixed Bug#34762 - RowDataStatic does't always set the metadata in
ResultSetRow, which can lead to failures when unpacking DATE,
TIME, DATETIME and TIMESTAMP types when using absolute, relative,
and previous result set navigation methods.
.......
r6738 | mmatthews | 2008-02-26 22:52:31 -0600 (Tue, 26 Feb 2008) | 1 line
Added missing argument to CommunicationsException constructor when loading reflectively
(for JDBC4 support).
.......
r6739 | mmatthews | 2008-02-26 23:24:07 -0600 (Tue, 26 Feb 2008) | 2 lines
Fixed BUG#34703 - Connection.isValid() invalidates connection after
timeout, even if connection is actually valid.
.......
r6740 | mmatthews | 2008-02-26 23:34:59 -0600 (Tue, 26 Feb 2008) | 2 lines
Fixed BUG#34194 - ResultSetMetaData.getColumnTypeName() returns
"UNKNOWN" for GEOMETRY type.
.......
r6741 | mmatthews | 2008-02-27 08:47:20 -0600 (Wed, 27 Feb 2008) | 1 line
Don't try and re-cache on double close.
.......
r6742 | mmatthews | 2008-02-27 08:48:04 -0600 (Wed, 27 Feb 2008) | 1 line
When we added the ability to prepareCall("not-a-stored-procedure-or-function"), we broke
calling a stored function.
.......
r6743 | mmatthews | 2008-02-27 08:58:58 -0600 (Wed, 27 Feb 2008) | 1 line
Covnerted setMetadata into a fluent interface method (see
http://martinfowler.com/bliki/FluentInterface.html), as it makes it easier to work with
higher up, rather than returning void.
.......
r6744 | mmatthews | 2008-02-27 09:06:43 -0600 (Wed, 27 Feb 2008) | 3 lines
Fixed BUG#33162 - NullPointerException instead of SQLException
thrown for ResultSet.getTimestamp() when not positioned on a
row.
.......
r6745 | mmatthews | 2008-02-27 09:35:10 -0600 (Wed, 27 Feb 2008) | 1 line
Use JDBC4 feature not supported exception.
.......
r6746 | mmatthews | 2008-02-27 09:36:19 -0600 (Wed, 27 Feb 2008) | 1 line
Fixed up a couple of JDBC4-related stream methods.
.......
r6747 | mmatthews | 2008-02-27 10:21:34 -0600 (Wed, 27 Feb 2008) | 1 line
Testcase fixups (for JDBC-4.0)
.......
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
- /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6725
+ /branches/branch_5_0:1-6636,6638-6670 /branches/branch_5_1:1-6582,6584-6678,6680-6747
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/CHANGES 2008-02-27 17:12:05 UTC (rev 6748)
@@ -122,7 +122,46 @@
- Fixed BUG#31192 - Encoding Issue retrieving serverVersion in MysqlIO in the
method doHandshake when encoding doesn't contain ASCII characters in the "standard"
place (i.e. ebcdic).
+
+ - Fixed issue where META-INF in the binary .jar file wasn't packed correctly,
+ leading to failure of the JDBC-4.0 SPI mechanism.
+ - CallableStatements that aren't really stored procedure or stored function calls can
+ now be used, for tools such as Oracle JDeveloper ADF that issue statements such as
+ DDL through CallableStatements.
+
+ - Fixed BUG#34518 - Statements using cursor fetch leaked internal prepared statements
+ until connection was closed. The internal prepared statement is now held open while
+ the result set is open, and closed by the result set itself being closed.
+
+ - Fixed BUG#34677 - Blob.truncate() wouldn't take "0" as an argument.
+
+ - CommunicationExceptions now carry information about the last time a packet
+ was received from the MySQL server, as well as when the last packet was sent
+ to one, in an effort to make it easier to debug communications errors caused
+ by network timeouts.
+
+ - Reverted a change to DatabaseMetadata.getColumns() from 5.0, where
+ getColumns() would report NULL for COLUMN_SIZE for TIME, DATE, DATETIME
+ and TIMESTAMP types. It now reports the column size, in the
+ DatabaseMetadata implementations that use "SHOW" commands, and the
+ INFORMATION_SCHEMA.
+
+ - Fixed Bug#34762 - RowDataStatic does't always set the metadata in
+ ResultSetRow, which can lead to failures when unpacking DATE,
+ TIME, DATETIME and TIMESTAMP types when using absolute, relative,
+ and previous result set navigation methods.
+
+ - Fixed BUG#34703 - Connection.isValid() invalidates connection after
+ timeout, even if connection is actually valid.
+
+ - Fixed BUG#34194 - ResultSetMetaData.getColumnTypeName() returns
+ "UNKNOWN" for GEOMETRY type.
+
+ - Fixed BUG#33162 - NullPointerException instead of SQLException
+ thrown for ResultSet.getTimestamp() when not positioned on a
+ row.
+
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-02-27 16:21:34 UTC (rev 6747)
+++ trunk/build.xml 2008-02-27 17:12:05 UTC (rev 6748)
@@ -375,11 +375,11 @@
<!-- JDBC-4.0 support of service provider mechanism -->
- <mkdir dir="${buildDir}/META-INF/services/" />
- <echo file="${buildDir}/META-INF/services/java.sql.Driver"
+ <mkdir dir="${buildDir}/${fullProdName}/META-INF/services/" />
+ <echo file="${buildDir}/${fullProdName}/META-INF/services/java.sql.Driver"
message="com.mysql.jdbc.Driver" />
- <manifest file="${buildDir}/META-INF/MANIFEST.MF">
+ <manifest file="${buildDir}/${fullProdName}/META-INF/MANIFEST.MF">
<attribute name="Built-By" value="${user.name}" />
<section name="common">
@@ -395,10 +395,10 @@
<jar jarfile="${buildDir}/${fullProdName}/${fullProdName}-bin.jar"
basedir="${buildDir}/${fullProdName}"
- includes="**/*.class,**/*.properties*,COPYING,README"
+ includes="**/*.class,**/*.properties*,COPYING,README,META-INF/**"
excludes="testsuite/**"
index="true"
- manifest="${buildDir}/META-INF/MANIFEST.MF"/>
+ manifest="${buildDir}/${fullProdName}/META-INF/MANIFEST.MF"/>
</target>
<target name="-dist-trace" depends="init, compile-driver-trace">
@@ -408,12 +408,18 @@
<mkdir dir="${distDir}" />
<mkdir dir="${buildDir}/${fullProdName}/debug"/>
- <manifest file="${buildDir}/MANIFEST.MF">
+ <!-- JDBC-4.0 support of service provider mechanism -->
+
+ <mkdir dir="${buildDir}/${fullProdName}/META-INF/services/" />
+ <echo file="${buildDir}/${fullProdName}/META-INF/services/java.sql.Driver"
+ message="com.mysql.jdbc.Driver" />
+
+ <manifest file="${buildDir}/${fullProdName}/MANIFEST.MF">
<attribute name="Built-By" value="${user.name}" />
<section name="common">
<attribute name="Specification-Title" value="JDBC" />
- <attribute name="Specification-Version" value="3.0" />
+ <attribute name="Specification-Version" value="4.0" />
<attribute name="Specification-Vendor" value="Sun Microsystems Inc." />
<attribute name="Implementation-Title" value="MySQL Connector/J (trace/debug
enabled)" />
<attribute name="Implementation-Version" value="${full-version}
(trace/debug-enabled)" />
@@ -423,10 +429,10 @@
<jar jarfile="${buildDir}/${fullProdName}/debug/${fullProdName}-bin-g.jar"
basedir="${buildDir}/${fullProdName}"
- includes="**/*.class,**/*.properties*,COPYING,README"
+ includes="**/*.class,**/*.properties*,COPYING,README,META-INF/**"
excludes="testsuite/**"
index="true"
- manifest="${buildDir}/MANIFEST.MF"
+ manifest="${buildDir}/${fullProdName}/MANIFEST.MF"
/>
</target>
Modified: trunk/src/com/mysql/jdbc/Blob.java
===================================================================
--- trunk/src/com/mysql/jdbc/Blob.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/Blob.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -296,7 +296,7 @@
public synchronized void truncate(long len) throws SQLException {
checkClosed();
- if (len < 1) {
+ if (len < 0) {
throw SQLError.createSQLException("\"len\" argument can not be < 1.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
Modified: trunk/src/com/mysql/jdbc/BlobFromLocator.java
===================================================================
--- trunk/src/com/mysql/jdbc/BlobFromLocator.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/BlobFromLocator.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -32,8 +32,6 @@
import java.util.ArrayList;
import java.util.List;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
-
/**
* The representation (mapping) in the JavaTM programming language of an SQL
* BLOB value. An SQL BLOB is a built-in type that stores a Binary Large Object
@@ -164,7 +162,7 @@
*/
public OutputStream setBinaryStream(long indexToWriteAt)
throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -577,6 +575,29 @@
pStmt = createGetBytesStatement();
}
+ LocatorInputStream(long pos, long len) throws SQLException {
+ length = pos + len;
+ currentPositionInBlob = pos;
+ long blobLength = length();
+
+ if (pos + len > blobLength) {
+ throw SQLError.createSQLException(
+ Messages.getString("Blob.invalidStreamLength",
+ new Object[] {new Long(blobLength), new Long(pos), new Long(len)}),
+ SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+ }
+
+ if (pos < 1) {
+ throw SQLError.createSQLException(Messages.getString("Blob.invalidStreamPos"),
+ SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+ }
+
+ if (pos > blobLength) {
+ throw SQLError.createSQLException(Messages.getString("Blob.invalidStreamPos"),
+ SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
+ }
+ }
+
public int read() throws IOException {
if (currentPositionInBlob + 1 > length) {
return -1;
@@ -677,6 +698,6 @@
}
public InputStream getBinaryStream(long pos, long length) throws SQLException {
- throw new NotYetImplementedException();
+ return new LocatorInputStream(pos, length);
}
}
Modified: trunk/src/com/mysql/jdbc/BufferRow.java
===================================================================
--- trunk/src/com/mysql/jdbc/BufferRow.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/BufferRow.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -637,12 +637,14 @@
throw new OperationNotSupportedException();
}
- public void setMetadata(Field[] f) throws SQLException {
+ public ResultSetRow setMetadata(Field[] f) throws SQLException {
super.setMetadata(f);
if (this.isBinaryEncoded) {
setupIsNullBitmask();
}
+
+ return this;
}
/**
Modified: trunk/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/CallableStatement.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/CallableStatement.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -601,10 +601,19 @@
this.callingStoredFunction = isFunctionCall;
- determineParameterTypes();
- generateParameterMap();
-
- if (this.callingStoredFunction) {
+ if (!this.callingStoredFunction) {
+ if (!StringUtils.startsWithIgnoreCaseAndWs(sql, "CALL")) {
+ // not really a stored procedure call
+ fakeParameterTypes(false);
+ } else {
+ determineParameterTypes();
+ }
+
+ generateParameterMap();
+ } else {
+ determineParameterTypes();
+ generateParameterMap();
+
this.parameterCount += 1;
}
}
@@ -714,7 +723,7 @@
*
* @throws SQLException if we can't build the metadata.
*/
- private void fakeParameterTypes() throws SQLException {
+ private void fakeParameterTypes(boolean isReallyProcedure) throws SQLException {
Field[] fields = new Field[13];
fields[0] = new Field("", "PROCEDURE_CAT", Types.CHAR, 0);
@@ -731,12 +740,12 @@
fields[11] = new Field("", "NULLABLE", Types.SMALLINT, 0);
fields[12] = new Field("", "REMARKS", Types.CHAR, 0);
- String procName = extractProcedureName();
+ String procName = isReallyProcedure ? extractProcedureName() : null;
byte[] procNameAsBytes = null;
try {
- procNameAsBytes = procName.getBytes("UTF-8");
+ procNameAsBytes = procName == null ? null : procName.getBytes("UTF-8");
} catch (UnsupportedEncodingException ueEx) {
procNameAsBytes = StringUtils.s2b(procName, this.connection);
}
@@ -779,7 +788,7 @@
private void determineParameterTypes() throws SQLException {
if (this.connection.getNoAccessToProcedureBodies()) {
- fakeParameterTypes();
+ fakeParameterTypes(true);
return;
}
Modified: trunk/src/com/mysql/jdbc/Clob.java
===================================================================
--- trunk/src/com/mysql/jdbc/Clob.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/Clob.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -32,8 +32,6 @@
import java.io.Writer;
import java.sql.SQLException;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
-
/**
* Simplistic implementation of java.sql.Clob for MySQL Connector/J
*
@@ -294,10 +292,10 @@
}
public void free() throws SQLException {
- throw new NotYetImplementedException();
+ this.charData = null;
}
public Reader getCharacterStream(long pos, long length) throws SQLException {
- throw new NotYetImplementedException();
+ return new StringReader(getSubString(pos, (int)length));
}
}
Modified: trunk/src/com/mysql/jdbc/CommunicationsException.java
===================================================================
--- trunk/src/com/mysql/jdbc/CommunicationsException.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/com/mysql/jdbc/CommunicationsException.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -46,10 +46,10 @@
private boolean streamingResultSetInPlay = false;
public CommunicationsException(ConnectionImpl conn, long lastPacketSentTimeMs,
- Exception underlyingException) {
+ long lastPacketReceivedTimeMs, Exception underlyingException) {
this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
- lastPacketSentTimeMs, underlyingException, this.streamingResultSetInPlay);
+ lastPacketSentTimeMs, lastPacketReceivedTimeMs, underlyingException,
this.streamingResultSetInPlay);
if (underlyingException != null) {
initCause(underlyingException);
Modified: trunk/src/com/mysql/jdbc/ConnectionFeatureNotAvailableException.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionFeatureNotAvailableException.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/ConnectionFeatureNotAvailableException.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -44,7 +44,7 @@
*/
public ConnectionFeatureNotAvailableException(ConnectionImpl conn,
long lastPacketSentTimeMs, Exception underlyingException) {
- super(conn, lastPacketSentTimeMs, underlyingException);
+ super(conn, lastPacketSentTimeMs, 0, underlyingException);
}
/*
Modified: trunk/src/com/mysql/jdbc/ConnectionImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ConnectionImpl.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/ConnectionImpl.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -1239,10 +1239,16 @@
* @throws SQLException
*/
protected void abortInternal() throws SQLException {
- io.forceClose();
- io = null;
- isClosed = true;
- cleanup(null);
+ if (this.io != null) {
+ try {
+ this.io.forceClose();
+ } catch (Throwable t) {
+ // can't do anything about it, and we're forcibly aborting
+ }
+ this.io = null;
+ }
+
+ this.isClosed = true;
}
/**
@@ -2111,6 +2117,8 @@
throw SQLError.createCommunicationsException(this,
(this.io != null) ? this.io
.getLastPacketSentTimeMs() : 0,
+ (this.io != null) ? this.io
+ .getLastPacketReceivedTimeMs() : 0,
EEE);
}
}
@@ -4696,7 +4704,7 @@
}
}
} else {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
}
@@ -5079,7 +5087,7 @@
}
}
} else {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
}
Modified: trunk/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- trunk/src/com/mysql/jdbc/DatabaseMetaData.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/DatabaseMetaData.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -343,18 +343,19 @@
"varchar")) {
this.columnSize = Constants.integerValueOf(255);
} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
+ "timestamp")) {
+ this.columnSize = Constants.integerValueOf(19);
+ } else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
+ "datetime")) {
+ this.columnSize = Constants.integerValueOf(19);
+ } else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
"date")) {
- this.columnSize = null;
+ this.columnSize = Constants.integerValueOf(10);
} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
"time")) {
- this.columnSize = null;
+ this.columnSize = Constants.integerValueOf(8);
+
} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
- "timestamp")) {
- this.columnSize = null;
- } else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
- "datetime")) {
- this.columnSize = null;
- } else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
"tinyblob")) {
this.columnSize = Constants.integerValueOf(255);
} else if (StringUtils.startsWithIgnoreCaseAndWs(typeInfo,
Modified: trunk/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
===================================================================
--- trunk/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -215,9 +215,8 @@
}
sqlBuf
- .append("CASE WHEN CHARACTER_MAXIMUM_LENGTH IS NULL THEN NUMERIC_PRECISION ELSE CASE
WHEN CHARACTER_MAXIMUM_LENGTH > "
- + Integer.MAX_VALUE + " THEN " + Integer.MAX_VALUE +
- " ELSE CHARACTER_MAXIMUM_LENGTH END END AS COLUMN_SIZE, "
+ .append("CASE WHEN LCASE(DATA_TYPE)='date' THEN 10 WHEN LCASE(DATA_TYPE)='time' THEN
8 WHEN LCASE(DATA_TYPE)='datetime' THEN 19 WHEN LCASE(DATA_TYPE)='timestamp' THEN 19 WHEN
CHARACTER_MAXIMUM_LENGTH IS NULL THEN NUMERIC_PRECISION WHEN CHARACTER_MAXIMUM_LENGTH >
"
+ + Integer.MAX_VALUE + " THEN " + Integer.MAX_VALUE + " ELSE
CHARACTER_MAXIMUM_LENGTH END AS COLUMN_SIZE, "
+ ConnectionImpl.INITIAL_MAX_BUFFER_SIZE + " AS BUFFER_LENGTH,"
+ "NUMERIC_SCALE AS DECIMAL_DIGITS,"
+ "10 AS NUM_PREC_RADIX,"
Modified: trunk/src/com/mysql/jdbc/ExportControlled.java
===================================================================
--- trunk/src/com/mysql/jdbc/ExportControlled.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/ExportControlled.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -102,7 +102,8 @@
mysqlIO.mysqlOutput.flush();
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(mysqlIO.connection,
- mysqlIO.lastPacketSentTimeMs, ioEx);
+ mysqlIO.getLastPacketSentTimeMs(), mysqlIO.getLastPacketReceivedTimeMs(),
+ ioEx);
}
}
Modified: trunk/src/com/mysql/jdbc/JDBC4CallableStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4CallableStatement.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/com/mysql/jdbc/JDBC4CallableStatement.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -32,8 +32,8 @@
import java.sql.SQLXML;
import java.sql.NClob;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4CallableStatement extends CallableStatement {
public JDBC4CallableStatement(ConnectionImpl conn,
Modified: trunk/src/com/mysql/jdbc/JDBC4ClientInfoProvider.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4ClientInfoProvider.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/com/mysql/jdbc/JDBC4ClientInfoProvider.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -27,8 +27,8 @@
import java.sql.SQLClientInfoException;
import java.util.Properties;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
/**
* Classes that implement this interface and provide a no-args constructor
* can be used by the driver to store and retrieve client information and/or
Modified: trunk/src/com/mysql/jdbc/JDBC4Connection.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4Connection.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/JDBC4Connection.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -37,8 +37,8 @@
import com.mysql.jdbc.ConnectionImpl;
import com.mysql.jdbc.Messages;
import com.mysql.jdbc.SQLError;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4Connection extends ConnectionImpl {
private JDBC4ClientInfoProvider infoProvider;
@@ -52,11 +52,11 @@
}
public java.sql.Array createArrayOf(String typeName, Object[] elements) throws
SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
public Properties getClientInfo() throws SQLException {
@@ -96,7 +96,7 @@
TimerTask timeoutTask = null;
if (timeout != 0) {
- getCancelTimer().schedule(new TimerTask() {
+ timeoutTask = new TimerTask() {
public void run() {
new Thread() {
public void run() {
@@ -108,7 +108,9 @@
}
}.start();
}
- }, timeout * 1000);
+ };
+
+ getCancelTimer().schedule(timeoutTask, timeout * 1000);
}
try {
Modified: trunk/src/com/mysql/jdbc/JDBC4MysqlSQLXML.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4MysqlSQLXML.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/JDBC4MysqlSQLXML.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -67,8 +67,8 @@
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.SAXException;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4MysqlSQLXML implements SQLXML {
private XMLInputFactory inputFactory;
Modified: trunk/src/com/mysql/jdbc/JDBC4PreparedStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4PreparedStatement.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/com/mysql/jdbc/JDBC4PreparedStatement.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -34,8 +34,8 @@
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.PreparedStatement.ParseInfo;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4PreparedStatement extends PreparedStatement {
public JDBC4PreparedStatement(ConnectionImpl conn, String catalog) throws SQLException {
Modified: trunk/src/com/mysql/jdbc/JDBC4PreparedStatementHelper.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4PreparedStatementHelper.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/com/mysql/jdbc/JDBC4PreparedStatementHelper.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -8,15 +8,15 @@
import java.sql.Types;
import com.mysql.jdbc.PreparedStatement;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4PreparedStatementHelper {
private JDBC4PreparedStatementHelper() {
}
static void setRowId(PreparedStatement pstmt, int parameterIndex, RowId x) throws
SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
Modified: trunk/src/com/mysql/jdbc/JDBC4ResultSet.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4ResultSet.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/JDBC4ResultSet.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -38,8 +38,8 @@
import com.mysql.jdbc.RowData;
import com.mysql.jdbc.SQLError;
import com.mysql.jdbc.Statement;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4ResultSet extends ResultSetImpl {
public JDBC4ResultSet(long updateCount, long updateID,
@@ -300,11 +300,11 @@
}
public int getHoldability() throws SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
public RowId getRowId(int columnIndex) throws SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
public RowId getRowId(String columnLabel) throws SQLException {
Modified: trunk/src/com/mysql/jdbc/JDBC4UpdatableResultSet.java
===================================================================
--- trunk/src/com/mysql/jdbc/JDBC4UpdatableResultSet.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/com/mysql/jdbc/JDBC4UpdatableResultSet.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -39,8 +39,8 @@
import com.mysql.jdbc.StringUtils;
import com.mysql.jdbc.UpdatableResultSet;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
public class JDBC4UpdatableResultSet extends UpdatableResultSet {
public JDBC4UpdatableResultSet(String catalog, Field[] fields, RowData tuples,
ConnectionImpl conn, StatementImpl creatorStmt) throws SQLException {
@@ -343,7 +343,7 @@
}
public int getHoldability() throws SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
/**
@@ -507,7 +507,7 @@
}
public RowId getRowId(int columnIndex) throws SQLException {
- throw new NotYetImplementedException();
+ throw SQLError.notImplemented();
}
public RowId getRowId(String columnLabel) throws SQLException {
Modified: trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties
===================================================================
--- trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/com/mysql/jdbc/LocalizedErrorMessages.properties 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -162,7 +162,9 @@
CommunicationsException.6=(the driver was unable to determine the value of either the
CommunicationsException.7='wait_timeout' or 'interactive_timeout' configuration values
from
CommunicationsException.8=the server.
-CommunicationsException.9=The last communications with the server was
+CommunicationsException.9_1=The last packet successfully received from the server was
+CommunicationsException.9_2=\ seconds ago.
+CommunicationsException.9=The last packet sent successfully to the server was
CommunicationsException.10=\ seconds 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,
Modified: trunk/src/com/mysql/jdbc/MysqlIOprotocol.java
===================================================================
--- trunk/src/com/mysql/jdbc/MysqlIOprotocol.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/MysqlIOprotocol.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -220,6 +220,7 @@
private int warningCount = 0;
protected long clientParam = 0;
protected long lastPacketSentTimeMs = 0;
+ protected long lastPacketReceivedTimeMs = 0;
private boolean traceProtocol = false;
private boolean enablePacketDebug = false;
private Calendar sessionCalendar;
@@ -371,6 +372,10 @@
return this.lastPacketSentTimeMs;
}
+ protected long getLastPacketReceivedTimeMs() {
+ return this.lastPacketReceivedTimeMs;
+ }
+
/**
* Build a result set. Delegates to buildResultSetWithRows() to build a
* JDBC-version-specific ResultSet, given rows as byte data, and field
@@ -571,7 +576,7 @@
skipFully(this.mysqlInput, packetLength);
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
} catch (OutOfMemoryError oom) {
try {
this.connection.realClose(false, false, true, oom);
@@ -662,10 +667,14 @@
this.packetHeaderBuf, packet);
}
+ if (this.connection.getMaintainTimeStats()) {
+ this.lastPacketReceivedTimeMs = System.currentTimeMillis();
+ }
+
return packet;
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
} catch (OutOfMemoryError oom) {
try {
this.connection.realClose(false, false, true, oom);
@@ -942,7 +951,7 @@
}
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
}
}
@@ -1342,7 +1351,7 @@
try {
this.mysqlConnection = this.socketFactory.afterHandshake();
} catch (IOException ioEx) {
- throw SQLError.createCommunicationsException(this.connection,
this.lastPacketSentTimeMs, ioEx);
+ throw SQLError.createCommunicationsException(this.connection,
this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
}
}
@@ -1361,7 +1370,7 @@
sendCommand(MysqlDefs.INIT_DB, database, null, false, null);
} else {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ex);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ex);
}
}
}
@@ -1617,7 +1626,7 @@
if (bytesRead != len) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs,
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs,
new IOException(Messages.getString("MysqlIO.43")));
}
@@ -1632,7 +1641,7 @@
return new ByteArrayRow(rowData);
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
}
}
@@ -1912,7 +1921,7 @@
throw sqlEx;
} catch (Exception ex) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ex);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ex);
}
Buffer returnPacket = null;
@@ -1930,7 +1939,7 @@
return returnPacket;
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
}
}
@@ -2967,10 +2976,14 @@
reuse.getByteBuffer()[packetLength] = 0; // Null-termination
}
+ if (this.connection.getMaintainTimeStats()) {
+ this.lastPacketReceivedTimeMs = System.currentTimeMillis();
+ }
+
return reuse;
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
} catch (OutOfMemoryError oom) {
try {
// _Try_ this
@@ -3052,7 +3065,7 @@
if (bytesRead != lengthToWrite) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs,
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs,
SQLError.createSQLException(Messages.getString(
"MysqlIO.50") //$NON-NLS-1$
+lengthToWrite +
@@ -3092,7 +3105,7 @@
if (bytesRead != lengthToWrite) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs,
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs,
SQLError.createSQLException(Messages.getString(
"MysqlIO.54") //$NON-NLS-1$
+lengthToWrite +
@@ -3118,14 +3131,14 @@
throws SQLException {
if ((multiPacketSeq == -128) && (this.readPacketSequence != 127)) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs,
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs,
new IOException("Packets out of order, expected packet # -128, but
received packet # " +
multiPacketSeq));
}
if ((this.readPacketSequence == -1) && (multiPacketSeq != 0)) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs,
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs,
new IOException("Packets out of order, expected packet # -1, but received
packet # " +
multiPacketSeq));
}
@@ -3133,7 +3146,7 @@
if ((multiPacketSeq != -128) && (this.readPacketSequence != -1)
&&
(multiPacketSeq != (this.readPacketSequence + 1))) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs,
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs,
new IOException("Packets out of order, expected packet # " +
(this.readPacketSequence + 1) + ", but received packet # " +
multiPacketSeq));
@@ -3229,9 +3242,13 @@
if (packet == this.sharedSendPacket) {
reclaimLargeSharedSendPacket();
}
+
+ if (this.connection.getMaintainTimeStats()) {
+ this.lastPacketSentTimeMs = System.currentTimeMillis();
+ }
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
}
}
@@ -3404,7 +3421,7 @@
throw sqlEx;
} catch (Exception fallThru) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, fallThru);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, fallThru);
}
checkErrorPacket(resultPacket);
@@ -3651,7 +3668,7 @@
}
} catch (IOException ioEx) {
throw SQLError.createCommunicationsException(this.connection,
- this.lastPacketSentTimeMs, ioEx);
+ this.lastPacketSentTimeMs, this.lastPacketReceivedTimeMs, ioEx);
}
}
Modified: trunk/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/PreparedStatement.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/PreparedStatement.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -2675,7 +2675,7 @@
* DOCUMENT ME!
*/
public void setArray(int i, Array x) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -3855,7 +3855,7 @@
* DOCUMENT ME!
*/
public void setRef(int i, Ref x) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
Modified: trunk/src/com/mysql/jdbc/ResultSetImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetImpl.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/ResultSetImpl.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -1151,7 +1151,7 @@
public java.sql.Array getArray(int i) throws SQLException {
checkColumnBounds(i);
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -3013,7 +3013,7 @@
* DOCUMENT ME!
*/
protected java.sql.Array getNativeArray(int i) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -4320,7 +4320,7 @@
* DOCUMENT ME!
*/
protected java.sql.Ref getNativeRef(int i) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -5138,7 +5138,7 @@
*/
public java.sql.Ref getRef(int i) throws SQLException {
checkColumnBounds(i);
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -6625,6 +6625,7 @@
rollForward);
} else {
checkClosed();
+ checkRowPos();
checkColumnBounds(columnIndex);
tsVal = this.thisRow.getTimestampFast(columnIndex - 1,
@@ -7489,6 +7490,18 @@
}
}
+ if (this.statementUsedForFetchingRows != null) {
+ try {
+ this.statementUsedForFetchingRows.realClose(true, false);
+ } catch (SQLException sqlEx) {
+ if (exceptionDuringClose != null) {
+ exceptionDuringClose.setNextException(sqlEx);
+ } else {
+ exceptionDuringClose = sqlEx;
+ }
+ }
+ }
+
this.rowData = null;
this.defaultTimeZone = null;
this.fields = null;
@@ -7610,7 +7623,7 @@
* @see DatabaseMetaData#deletesAreDetected
*/
public boolean rowDeleted() throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -7628,7 +7641,7 @@
* @see DatabaseMetaData#insertsAreDetected
*/
public boolean rowInserted() throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -7646,7 +7659,7 @@
* @see DatabaseMetaData#updatesAreDetected
*/
public boolean rowUpdated() throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -7839,14 +7852,14 @@
* @see ResultSetInternalMethods#updateArray(int, Array)
*/
public void updateArray(int arg0, Array arg1) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
* @see ResultSetInternalMethods#updateArray(String, Array)
*/
public void updateArray(String arg0, Array arg1) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -8159,7 +8172,7 @@
* @see ResultSetInternalMethods#updateClob(int, Clob)
*/
public void updateClob(int arg0, java.sql.Clob arg1) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -8486,14 +8499,14 @@
* @see ResultSetInternalMethods#updateRef(int, Ref)
*/
public void updateRef(int arg0, Ref arg1) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
* @see ResultSetInternalMethods#updateRef(String, Ref)
*/
public void updateRef(String arg0, Ref arg1) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
Modified: trunk/src/com/mysql/jdbc/ResultSetMetaData.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetMetaData.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/ResultSetMetaData.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -371,7 +371,10 @@
case MysqlDefs.FIELD_TYPE_SET:
return "SET"; //$NON-NLS-1$
-
+
+ case MysqlDefs.FIELD_TYPE_GEOMETRY:
+ return "GEOMETRY"; //$NON-NLS-1$
+
default:
return "UNKNOWN"; //$NON-NLS-1$
}
Modified: trunk/src/com/mysql/jdbc/ResultSetRow.java
===================================================================
--- trunk/src/com/mysql/jdbc/ResultSetRow.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/ResultSetRow.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -1391,7 +1391,9 @@
public abstract void setColumnValue(int index, byte[] value)
throws SQLException;
- public void setMetadata(Field[] f) throws SQLException {
+ public ResultSetRow setMetadata(Field[] f) throws SQLException {
this.metadata = f;
+
+ return this;
}
}
Modified: trunk/src/com/mysql/jdbc/RowDataStatic.java
===================================================================
--- trunk/src/com/mysql/jdbc/RowDataStatic.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/RowDataStatic.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -98,12 +98,12 @@
*
* @return DOCUMENT ME!
*/
- public ResultSetRow getAt(int atIndex) {
+ public ResultSetRow getAt(int atIndex) throws SQLException {
if ((atIndex < 0) || (atIndex >= this.rows.size())) {
return null;
}
- return (ResultSetRow) this.rows.get(atIndex);
+ return ((ResultSetRow) this.rows.get(atIndex)).setMetadata(this.metadata);
}
/**
@@ -215,9 +215,8 @@
if (this.index < this.rows.size()) {
ResultSetRow row = (ResultSetRow) this.rows.get(this.index);
- row.setMetadata(this.metadata);
- return row;
+ return row.setMetadata(this.metadata);
}
return null;
Modified: trunk/src/com/mysql/jdbc/SQLError.java
===================================================================
--- trunk/src/com/mysql/jdbc/SQLError.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/SQLError.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -154,7 +154,7 @@
JDBC_4_COMMUNICATIONS_EXCEPTION_CTOR = Class.forName(
"com.mysql.jdbc.exceptions.jdbc4.CommunicationsException")
.getConstructor(
- new Class[] { ConnectionImpl.class, Long.TYPE, Exception.class });
+ new Class[] { ConnectionImpl.class, Long.TYPE, Long.TYPE, Exception.class });
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
@@ -1061,17 +1061,18 @@
}
}
- public static SQLException createCommunicationsException(ConnectionImpl conn, long
lastPacketSentTimeMs,
+ public static SQLException createCommunicationsException(ConnectionImpl conn, long
lastPacketSentTimeMs,
+ long lastPacketReceivedTimeMs,
Exception underlyingException) {
SQLException exToReturn = null;
if (!Util.isJdbc4()) {
- exToReturn = new CommunicationsException(conn, lastPacketSentTimeMs,
underlyingException);
+ exToReturn = new CommunicationsException(conn, lastPacketSentTimeMs,
lastPacketReceivedTimeMs, underlyingException);
} else {
try {
exToReturn = (SQLException)
Util.handleNewInstance(JDBC_4_COMMUNICATIONS_EXCEPTION_CTOR, new Object[] {
- conn, Constants.longValueOf(lastPacketSentTimeMs), underlyingException});
+ conn, Constants.longValueOf(lastPacketSentTimeMs),
Constants.longValueOf(lastPacketReceivedTimeMs), underlyingException});
} catch (SQLException sqlEx) {
// We should _never_ get this, but let's not swallow it either
@@ -1104,7 +1105,9 @@
*/
public static String createLinkFailureMessageBasedOnHeuristics(
ConnectionImpl conn,
- long lastPacketSentTimeMs, Exception underlyingException,
+ long lastPacketSentTimeMs,
+ long lastPacketReceivedTimeMs,
+ Exception underlyingException,
boolean streamingResultSetInPlay) {
long serverTimeoutSeconds = 0;
boolean isInteractiveClient = false;
@@ -1139,7 +1142,8 @@
}
long timeSinceLastPacket = (System.currentTimeMillis() - lastPacketSentTimeMs) / 1000;
-
+ long timeSinceLastPacketReceived = (System.currentTimeMillis() -
lastPacketReceivedTimeMs) / 1000;
+
int dueToTimeout = DUE_TO_TIMEOUT_FALSE;
StringBuffer timeoutMessageBuf = null;
@@ -1185,6 +1189,12 @@
|| dueToTimeout == DUE_TO_TIMEOUT_MAYBE) {
exceptionMessageBuf.append(Messages
+ .getString("CommunicationsException.9_1")); //$NON-NLS-1$
+ exceptionMessageBuf.append(timeSinceLastPacketReceived);
+ exceptionMessageBuf.append(Messages
+ .getString("CommunicationsException.9_2")); //$NON-NLS-1$
+
+ exceptionMessageBuf.append(Messages
.getString("CommunicationsException.9")); //$NON-NLS-1$
exceptionMessageBuf.append(timeSinceLastPacket);
exceptionMessageBuf.append(Messages
@@ -1257,4 +1267,18 @@
return exceptionMessageBuf.toString();
}
+
+ public static SQLException notImplemented() {
+ if (Util.isJdbc4()) {
+ try {
+ return (SQLException) Class.forName(
+ "java.sql.SQLFeatureNotSupportedException")
+ .newInstance();
+ } catch (Throwable t) {
+ // proceed
+ }
+ }
+
+ return SQLError.notImplemented();
+ }
}
Modified: trunk/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
--- trunk/src/com/mysql/jdbc/ServerPreparedStatement.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/com/mysql/jdbc/ServerPreparedStatement.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -585,7 +585,7 @@
* @see java.sql.Statement#close()
*/
public synchronized void close() throws SQLException {
- if (this.isCached) {
+ if (this.isCached && !this.isClosed) {
clearParameters();
this.isClosed = true;
@@ -955,7 +955,7 @@
if (bindValue.isNull) {
return null;
} else if (bindValue.isLongData) {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
} else {
if (this.outByteBuffer == null) {
this.outByteBuffer = new Buffer(this.connection
@@ -1706,7 +1706,7 @@
* @see java.sql.PreparedStatement#setArray(int, java.sql.Array)
*/
public void setArray(int i, Array x) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -2061,7 +2061,7 @@
* @see java.sql.PreparedStatement#setRef(int, java.sql.Ref)
*/
public void setRef(int i, Ref x) throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -2277,7 +2277,7 @@
throws SQLException {
checkClosed();
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
Modified: trunk/src/com/mysql/jdbc/StatementImpl.java
===================================================================
--- trunk/src/com/mysql/jdbc/StatementImpl.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/StatementImpl.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -2270,7 +2270,6 @@
this.warningChain = null;
this.openResults = null;
this.batchedGeneratedKeys = null;
- this.cancelTimeoutMutex = null;
this.localInfileInputStream = null;
this.pingTarget = null;
}
Modified: trunk/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- trunk/src/com/mysql/jdbc/UpdatableResultSet.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/UpdatableResultSet.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -1412,7 +1412,7 @@
* @see DatabaseMetaData#deletesAreDetected
*/
public synchronized boolean rowDeleted() throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -1430,7 +1430,7 @@
* @see DatabaseMetaData#insertsAreDetected
*/
public synchronized boolean rowInserted() throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
@@ -1448,7 +1448,7 @@
* @see DatabaseMetaData#updatesAreDetected
*/
public synchronized boolean rowUpdated() throws SQLException {
- throw new NotImplemented();
+ throw SQLError.notImplemented();
}
/**
Deleted: trunk/src/com/mysql/jdbc/exceptions/NotYetImplementedException.java
===================================================================
--- trunk/src/com/mysql/jdbc/exceptions/NotYetImplementedException.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/exceptions/NotYetImplementedException.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -1,18 +0,0 @@
-package com.mysql.jdbc.exceptions;
-
-public class NotYetImplementedException extends RuntimeException {
-
- public NotYetImplementedException() {
- // TODO Auto-generated constructor stub
- }
-
- public NotYetImplementedException(String reason) {
- super(reason);
- // TODO Auto-generated constructor stub
- }
-
- public NotYetImplementedException(Throwable cause) {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-}
Modified: trunk/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java
===================================================================
--- trunk/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/exceptions/jdbc4/CommunicationsException.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -51,10 +51,11 @@
private boolean streamingResultSetInPlay = false;
public CommunicationsException(ConnectionImpl conn, long lastPacketSentTimeMs,
+ long lastPacketReceivedTimeMs,
Exception underlyingException) {
this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
- lastPacketSentTimeMs, underlyingException, this.streamingResultSetInPlay);
+ lastPacketSentTimeMs, lastPacketReceivedTimeMs, underlyingException,
this.streamingResultSetInPlay);
if (underlyingException != null) {
initCause(underlyingException);
Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -2626,11 +2626,11 @@
// }
//
// public boolean isWrapperFor(Class arg0) throws SQLException {
-// throw new NotYetImplementedException();
+// throw SQLError.notImplemented();
// }
//
// public Object unwrap(Class arg0) throws SQLException {
-// throw new NotYetImplementedException();
+// throw SQLError.notImplemented();
// }
}
Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4CallableStatementWrapper.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4CallableStatementWrapper.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/JDBC4CallableStatementWrapper.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -49,7 +49,7 @@
import com.mysql.jdbc.ConnectionImpl;
import com.mysql.jdbc.SQLError;
-import com.mysql.jdbc.exceptions.NotYetImplementedException;
+
import com.mysql.jdbc.jdbc2.optional.ConnectionWrapper;
import com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection;
Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -423,10 +423,10 @@
}
//
// public boolean isWrapperFor(Class<?> iface) throws SQLException {
-// throw new NotYetImplementedException();
+// throw SQLError.notImplemented();
// }
//
// public <T> T unwrap(Class<T> iface) throws SQLException {
-// throw new NotYetImplementedException();
+// throw SQLError.notImplemented();
// }
}
Modified: trunk/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java
===================================================================
--- trunk/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -1217,10 +1217,10 @@
// }
//
// public boolean isWrapperFor(Class arg0) throws SQLException {
-// throw new NotYetImplementedException();
+// throw SQLError.notImplemented();
// }
//
// public Object unwrap(Class arg0) throws SQLException {
-// throw new NotYetImplementedException();
+// throw SQLError.notImplemented();
// }
}
Modified: trunk/src/com/mysql/jdbc/log/LogFactory.java
===================================================================
--- trunk/src/com/mysql/jdbc/log/LogFactory.java 2008-02-27 16:21:34 UTC (rev 6747)
+++ trunk/src/com/mysql/jdbc/log/LogFactory.java 2008-02-27 17:12:05 UTC (rev 6748)
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2002-2004 MySQL AB
+ Copyright (C) 2002-2007 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
Modified: trunk/src/testsuite/regression/BlobRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/BlobRegressionTest.java 2008-02-27 16:21:34 UTC (rev
6747)
+++ trunk/src/testsuite/regression/BlobRegressionTest.java 2008-02-27 17:12:05 UTC (rev
6748)
@@ -400,4 +400,20 @@
}
}
}
+
+ public void testBug34677() throws Exception {
+ createTable("testBug34677", "(field1 BLOB)");
+ this.stmt.executeUpdate("INSERT INTO testBug34677 VALUES ('abc')");
+
+ try {
+ this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug34677");
+ this.rs.next();
+ Blob blob = this.rs.getBlob(1);
+ blob.truncate(0L);
+ assertEquals(0, blob.length());
+ assertEquals(-1, blob.getBinaryStream().read());
+ } finally {
+ closeMemberJDBCResources();
+ }
+ }
}
\ No newline at end of file
Modified: trunk/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/CallableStatementRegressionTest.java 2008-02-27
16:21:34 UTC (rev 6747)
+++ trunk/src/testsuite/regression/CallableStatementRegressionTest.java 2008-02-27
17:12:05 UTC (rev 6748)
@@ -1316,7 +1316,8 @@
setters[i].invoke(callable, new Object[] {
new Integer(2), null });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1326,7 +1327,8 @@
setters[i].invoke(callable, new Object[] {
new Integer(2), Boolean.FALSE });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1339,7 +1341,8 @@
new Object[] { new Integer(2),
new Byte((byte) 0) });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1352,7 +1355,8 @@
setters[i].invoke(callable, new Object[] {
new Integer(2), new Double(0) });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1365,7 +1369,8 @@
setters[i].invoke(callable, new Object[] {
new Integer(2), new Float(0) });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1378,7 +1383,8 @@
setters[i].invoke(callable, new Object[] {
new Integer(2), new Integer(0) });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1390,7 +1396,8 @@
setters[i].invoke(callable, new Object[] {
new Integer(2), new Long(0) });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1402,7 +1409,8 @@
new Integer(2),
new Short((short) 0) });
} catch (InvocationTargetException ive) {
- if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented)) {
+ if (!(ive.getCause() instanceof com.mysql.jdbc.NotImplemented ||
+ ive.getCause().getClass().getName().equals("java.sql.SQLFeatureNotSupportedException")))
{
throw ive;
}
}
@@ -1549,4 +1557,24 @@
}
}
+
+ public void testNotReallyCallableStatement() throws Exception {
+ if (!versionMeetsMinimum(5, 0)) {
+ return;
+ }
+
+ CallableStatement cstmt = null;
+
+ try {
+ this.stmt.executeUpdate("DROP TABLE IF EXISTS testNotReallyCallableStatement");
+ cstmt = this.conn.prepareCall("CREATE TABLE testNotReallyCallableStatement(field1
INT)");
+
+ } finally {
+ this.stmt.executeUpdate("DROP TABLE IF EXISTS testNotReallyCallableStatement");
+
+ if (cstmt != null) {
+ cstmt.close();
+ }
+ }
+ }
}
\ No newline at end of file
Modified: trunk/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/ConnectionRegressionTest.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/testsuite/regression/ConnectionRegressionTest.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -1513,7 +1513,13 @@
.getClass()
.getName()
.equals(
- "com.mysql.jdbc.NotImplemented")) {
+ "com.mysql.jdbc.NotImplemented")
+ && !invokeEx
+ .getCause()
+ .getClass()
+ .getName()
+ .equals(
+ "java.sql.SQLFeatureNotSupportedException")) {
throw invokeEx;
}
}
@@ -2197,7 +2203,7 @@
hostsString = badHost + firstHost;
break;
case 2:
- hostsString = firstHost + badHost + firstHost;
+ hostsString = firstHost + "," + badHost + firstHost;
break;
case 3:
hostsString = firstHost + "," + badHost;
@@ -2334,4 +2340,20 @@
testConn.close();
}
}
+
+ /** 34703 [NEW]: isValild() aborts Connection on timeout */
+
+ public void testBug34703() throws Exception {
+ if (!com.mysql.jdbc.Util.isJdbc4()) {
+ return;
+ }
+
+ Method isValid = java.sql.Connection.class.getMethod("isValid", new Class[]
{Integer.TYPE});
+
+
+ Connection newConn = getConnectionWithProps((Properties)null);
+ isValid.invoke(newConn, new Object[] {new Integer(1)});
+ Thread.sleep(2000);
+ assertTrue(((Boolean)isValid.invoke(newConn, new Object[] {new
Integer(0)})).booleanValue());
+ }
}
\ No newline at end of file
Modified: trunk/src/testsuite/regression/MetaDataRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/MetaDataRegressionTest.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/testsuite/regression/MetaDataRegressionTest.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -2194,4 +2194,18 @@
closeMemberJDBCResources();
}
}
+
+ public void testBug34194() throws Exception {
+ createTable("bug34194", "(id integer,geom geometry)");
+ try {
+ this.stmt
+ .execute("insert into bug34194 values('1',GeomFromText('POINT(622572.881
5156121.034)'))");
+ this.rs = this.stmt.executeQuery("select * from bug34194");
+ ResultSetMetaData RSMD = this.rs.getMetaData();
+ assertEquals("GEOMETRY", RSMD.getColumnTypeName(2));
+
+ } finally {
+ closeMemberJDBCResources();
+ }
+ }
}
Modified: trunk/src/testsuite/regression/ResultSetRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/ResultSetRegressionTest.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/testsuite/regression/ResultSetRegressionTest.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -4073,14 +4073,16 @@
advisorStmt = advisorConn.createStatement();
advisorStmt.setFetchSize(1);
+ this.rs = advisorStmt.executeQuery("SELECT 1, 2 LIMIT 0");
+ advisorBuf = new StringBuffer();
StandardLogger.bufferedLog = advisorBuf;
-
- this.rs = advisorStmt.executeQuery("SELECT 1, 2 LIMIT 0");
this.rs.next();
this.rs.close();
}
- assertEquals("", advisorBuf.toString());
+ assertEquals(
+ -1, advisorBuf.toString().indexOf(
+ Messages.getString("ResultSet.Possible_incomplete_traversal_of_result_set").substring(0,
10)));
} finally {
StandardLogger.bufferedLog = null;
@@ -4457,7 +4459,7 @@
}
createTable("testBug30664_1", "(id int)");
- createTable("testBug30664_2", "(id int, binaryvalue varbinary(10))");
+ createTable("testBug30664_2", "(id int, binaryvalue varbinary(255))");
try {
this.stmt
@@ -4599,7 +4601,11 @@
this.rs = this.stmt.executeQuery("select now() from dual where 1=0");
this.rs.next();
- this.rs.getTimestamp(1); // fails
+ try {
+ this.rs.getTimestamp(1); // fails
+ } catch (SQLException sqlEx) {
+ assertEquals(SQLError.SQL_STATE_GENERAL_ERROR, sqlEx.getSQLState());
+ }
}
public void testBug30195() throws Exception {
@@ -4625,4 +4631,50 @@
this.rs.close();
}
+ public void testBug34762() throws Exception {
+ createTable("testBug34762", "(field1 TIMESTAMP)");
+ int numRows = 10;
+
+ for (int i = 0; i < numRows; i++) {
+ this.stmt.executeUpdate("INSERT INTO testBug34762 VALUES (NOW())");
+ }
+
+ this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug34762");
+
+ while (this.rs.next()) {
+ this.rs.getTimestamp(1);
+ }
+
+ this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug34762");
+
+ for (int i = 1; i <= numRows; i++) {
+ this.rs.absolute(i);
+ this.rs.getTimestamp(1);
+ }
+
+ this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug34762");
+
+ this.rs.last();
+ this.rs.getTimestamp(1);
+
+ while (this.rs.previous()) {
+ this.rs.getTimestamp(1);
+ }
+
+ this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug34762");
+
+ this.rs.last();
+
+ while (this.rs.relative(-1)) {
+ this.rs.getTimestamp(1);
+ }
+
+ this.rs = this.stmt.executeQuery("SELECT field1 FROM testBug34762");
+
+ this.rs.beforeFirst();
+
+ while (this.rs.relative(1)) {
+ this.rs.getTimestamp(1);
+ }
+ }
}
Modified: trunk/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- trunk/src/testsuite/regression/StatementRegressionTest.java 2008-02-27 16:21:34 UTC
(rev 6747)
+++ trunk/src/testsuite/regression/StatementRegressionTest.java 2008-02-27 17:12:05 UTC
(rev 6748)
@@ -5346,4 +5346,22 @@
}
}
}
+
+ public void testBug34518() throws Exception {
+ if (!versionMeetsMinimum(5, 0)) {
+ return;
+ }
+
+ Connection fetchConn = getConnectionWithProps("useCursorFetch=true");
+ Statement fetchStmt = fetchConn.createStatement();
+
+ int stmtCount = ((com.mysql.jdbc.Connection)fetchConn).getActiveStatementCount();
+
+ fetchStmt.setFetchSize(100);
+ this.rs = fetchStmt.executeQuery("SELECT 1");
+
+ assertEquals(((com.mysql.jdbc.Connection)fetchConn).getActiveStatementCount(),
stmtCount + 1);
+ this.rs.close();
+ assertEquals(((com.mysql.jdbc.Connection)fetchConn).getActiveStatementCount(),
stmtCount);
+ }
}
\ No newline at end of file
| Thread |
|---|
| • Connector/J commit: r6748 - in trunk: . src/com/mysql/jdbc src/com/mysql/jdbc/exceptions src/com/mysql/jdbc/exceptions/jdbc4 src/com/mysql/jdbc/jdbc2/... | mmatthews | 27 Feb 2008 |