Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mysql/mysql-connector-j
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.1.27
Choose a base ref
...
head repository: mysql/mysql-connector-j
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.1.28
Choose a head ref
  • 20 commits
  • 37 files changed
  • 5 contributors

Commits on Oct 21, 2013

  1. Post-release changes.

    soklakov committed Oct 21, 2013
    Copy the full SHA
    871f6c2 View commit details

Commits on Nov 6, 2013

  1. Copy the full SHA
    14cd95c View commit details
  2. Copy the full SHA
    17fd9af View commit details
  3. Merge

    tofarmer committed Nov 6, 2013
    Copy the full SHA
    a100f56 View commit details
  4. Fixing broken tests.

    tofarmer committed Nov 6, 2013
    Copy the full SHA
    7be2aec View commit details

Commits on Nov 11, 2013

  1. Copy the full SHA
    36bc1e8 View commit details
  2. Fix broken XA RECOVER test.

    soklakov committed Nov 11, 2013
    Copy the full SHA
    bd1c0fa View commit details

Commits on Nov 14, 2013

  1. Fixes Bug#17750877, throwing correct JDBC4 SQLException subclass for …

    …query interrupted errors. Also adds testing around JDBC4 SQLException subclasses.
    tofarmer committed Nov 14, 2013
    Copy the full SHA
    6ac39b1 View commit details

Commits on Nov 17, 2013

  1. Bug #68916 closeOnCompletion doesn't work

    Bug #69746 ResultSet closed after Statement.close() when dontTrackOpenResources=true
    
    StatementImpl handles closing itself when the last ResultSet is closed explicitely
    and calls back to StatementImpl to remove itself from the set of open result sets.
    Results from getGeneratedKeys() are considered part of this set of open result sets.
    
    Implicit closing of result sets by StatementImpl was refactored to operate consistently
    unless "dontTrackOpenResources" or "holdResultsOpenOverClose/holdResultsOpenOverStatementClose"
    (stmt or conn level) is set.
    
    Generated keys results were sometimes added to the set of open results. This is no longer done
    and this result set is tracked separately. This resulted in a change to internal behaviour
    checked in the test for Bug#44056. The test case was changed accordingly.
    
    The description of "dontTrackOpenResources" was updated to reflect the new implications.
    
    The "isClosed()" method was added to the "ResultSetInternalMethods" and moved from
    JDBC4ResultSetImpl to ResultSetImpl.
    Jess Balint committed Nov 17, 2013
    Copy the full SHA
    3d3f594 View commit details

Commits on Nov 19, 2013

  1. YEAR type will still be identified as java.sql.Types.DATE (as Bug#104…

    …85 fix states), however, if connection property yearIsDateType=false, columns with this type are processed as java.lang.Short instead of java.sql.Date.
    fjssilva committed Nov 19, 2013
    Copy the full SHA
    106d603 View commit details
  2. Copy the full SHA
    b776f4f View commit details
  3. Bug#69452 test case no longer needs to check the adjustment made for …

    …'blobSendChunkSize' in ConnectionImpl.initializePropsFromServer().
    fjssilva committed Nov 19, 2013
    Copy the full SHA
    498a898 View commit details

Commits on Nov 20, 2013

  1. Copy the full SHA
    c536e9d View commit details
  2. Merge

    Todd Farmer committed Nov 20, 2013
    Copy the full SHA
    b8a78e7 View commit details

Commits on Nov 21, 2013

  1. Copy the full SHA
    3500bc1 View commit details
  2. Fix for Bug#55340, initializeResultsMetadataFromCache fails on second…

    … call to stored proc.
    fjssilva committed Nov 21, 2013
    Copy the full SHA
    c451d7b View commit details

Commits on Nov 22, 2013

  1. EscapeTokenizer was refactored to fix Bug#51313 - Escape processing i…

    …s confused by multiple backslashes.
    fjssilva committed Nov 22, 2013
    Copy the full SHA
    2fdbec5 View commit details
  2. Copy the full SHA
    b217ff9 View commit details
  3. Copy the full SHA
    10e57d3 View commit details

Commits on Nov 25, 2013

  1. New version, 5.1.28

    soklakov committed Nov 25, 2013
    Copy the full SHA
    c9e30df View commit details
Showing with 3,253 additions and 726 deletions.
  1. +25 −0 CHANGES
  2. +1 −1 build.xml
  3. +2 −2 src/com/mysql/jdbc/CallableStatement.java
  4. +17 −8 src/com/mysql/jdbc/ConnectionImpl.java
  5. +84 −97 src/com/mysql/jdbc/EscapeTokenizer.java
  6. +1 −5 src/com/mysql/jdbc/JDBC4ResultSet.java
  7. +5 −5 src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
  8. +8 −4 src/com/mysql/jdbc/LocalizedErrorMessages.properties
  9. +1 −1 src/com/mysql/jdbc/MysqlParameterMetadata.java
  10. +1 −1 src/com/mysql/jdbc/OperationNotSupportedException.java
  11. +6 −24 src/com/mysql/jdbc/PreparedStatement.java
  12. +36 −10 src/com/mysql/jdbc/ReplicationConnection.java
  13. +18 −2 src/com/mysql/jdbc/ReplicationConnectionGroup.java
  14. +54 −1 src/com/mysql/jdbc/ReplicationConnectionGroupManager.java
  15. +15 −6 src/com/mysql/jdbc/ResultSetImpl.java
  16. +16 −10 src/com/mysql/jdbc/ResultSetInternalMethods.java
  17. +27 −28 src/com/mysql/jdbc/ResultSetMetaData.java
  18. +1 −15 src/com/mysql/jdbc/RowDataDynamic.java
  19. +11 −3 src/com/mysql/jdbc/SQLError.java
  20. +3 −3 src/com/mysql/jdbc/ServerPreparedStatement.java
  21. +98 −86 src/com/mysql/jdbc/StandardSocketFactory.java
  22. +3 −3 src/com/mysql/jdbc/Statement.java
  23. +97 −60 src/com/mysql/jdbc/StatementImpl.java
  24. +5 −4 src/com/mysql/jdbc/UpdatableResultSet.java
  25. +45 −0 src/com/mysql/jdbc/exceptions/jdbc4/MySQLQueryInterruptedException.java
  26. +71 −1 src/com/mysql/jdbc/jmx/ReplicationGroupManager.java
  27. +18 −0 src/com/mysql/jdbc/jmx/ReplicationGroupManagerMBean.java
  28. +29 −1 src/testsuite/BaseTestCase.java
  29. +693 −312 src/testsuite/regression/ConnectionRegressionTest.java
  30. +53 −11 src/testsuite/regression/MetaDataRegressionTest.java
  31. +56 −8 src/testsuite/regression/StatementRegressionTest.java
  32. +6 −11 src/testsuite/regression/SyntaxRegressionTest.java
  33. +62 −0 src/testsuite/regression/jdbc4/ExceptionSubclassesTest.java
  34. +1,642 −0 src/testsuite/regression/jdbc4/StatementRegressionTest.java
  35. +35 −0 src/testsuite/simple/EscapeProcessingTest.java
  36. +2 −2 src/testsuite/simple/StatementsTest.java
  37. +6 −1 src/testsuite/simple/XATest.java
25 changes: 25 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog
# $Id$
12-23-13 - Version 5.1.28

- Fix for Bug#69579, DriverManager.setLoginTimeout not honored.

- Fix for Bug#51313, Escape processing is confused by multiple backslashes.

- Fix for Bug#55340, initializeResultsMetadataFromCache fails on second call to stored proc.

- Fix for Bug#70969, Shadow declaration of OperationNotSupportedException in RowDataDynamic.

- Fix for Bug#70835 (17750877), SQLExceptions thrown because of query interruption (KILL QUERY, query timeout, etc.)
didn't extend java.sql.SQLNonTransientException for JDBC4+ deployments.

- Fix for Bug#24344 test case, test fails if it's run with UTC timezone settings.

- Fix for Bug#69777, Setting maxAllowedPacket below 8203 makes blobSendChunkSize negative.

- Fix for Bug#35115, yearIsDateType=false has no effect on result's column type and class.

- Fix for Bug#68916 (16691047), closeOnCompletion doesn't work.

- Fix for Bug #69746 (17164058), ResultSet closed after Statement.close() when dontTrackOpenResources=true

- Fix for Bug#70842 (17753369), Adding live management of replication host topographies.

11-04-13 - Version 5.1.27

- Fix for Bug#17248345, getFunctionColumns() method returns columns of procedure.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@

<property name="major_version" value="5"/>
<property name="minor_version" value="1"/>
<property name="subminor_version" value="27"/>
<property name="subminor_version" value="28"/>
<property name="version_status" value=""/>

<property name="version" value="${major_version}.${minor_version}.${subminor_version}${version_status}"/>
4 changes: 2 additions & 2 deletions src/com/mysql/jdbc/CallableStatement.java
Original file line number Diff line number Diff line change
@@ -308,8 +308,8 @@ public String getParameterClassName(int arg0) throws SQLException {
mysqlTypeIfKnown = MysqlDefs.FIELD_TYPE_INT24;
}

return ResultSetMetaData.getClassNameForJavaType(getParameterType(arg0),
isUnsigned, mysqlTypeIfKnown, isBinaryOrBlob, false);
return ResultSetMetaData.getClassNameForJavaType(getParameterType(arg0), isUnsigned, mysqlTypeIfKnown,
isBinaryOrBlob, false, connection.getYearIsDateType());
}

public int getParameterCount() throws SQLException {
25 changes: 17 additions & 8 deletions src/com/mysql/jdbc/ConnectionImpl.java
Original file line number Diff line number Diff line change
@@ -3621,14 +3621,23 @@ private void initializePropsFromServer() throws SQLException {
else if (serverMaxAllowedPacket == -1 && getMaxAllowedPacket() == -1)
setMaxAllowedPacket(65535);

int preferredBlobSendChunkSize = getBlobSendChunkSize();

int allowedBlobSendChunkSize = Math.min(preferredBlobSendChunkSize,
getMaxAllowedPacket()) -
ServerPreparedStatement.BLOB_STREAM_READ_BUF_SIZE
- 11 /* LONG_DATA and MySQLIO packet header size */;

setBlobSendChunkSize(String.valueOf(allowedBlobSendChunkSize));
if (getUseServerPrepStmts()) {
int preferredBlobSendChunkSize = getBlobSendChunkSize();

// LONG_DATA and MySQLIO packet header size
int packetHeaderSize = ServerPreparedStatement.BLOB_STREAM_READ_BUF_SIZE + 11;
int allowedBlobSendChunkSize = Math.min(preferredBlobSendChunkSize, getMaxAllowedPacket())
- packetHeaderSize;

if (allowedBlobSendChunkSize <= 0) {
throw SQLError.createSQLException("Connection setting too low for 'maxAllowedPacket'. "
+ "When 'useServerPrepStmts=true', 'maxAllowedPacket' must be higher than "
+ packetHeaderSize + ". Check also 'max_allowed_packet' in MySQL configuration files.",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE, getExceptionInterceptor());
}

setBlobSendChunkSize(String.valueOf(allowedBlobSendChunkSize));
}
}

if (this.serverVariables.containsKey("net_buffer_length")) {
181 changes: 84 additions & 97 deletions src/com/mysql/jdbc/EscapeTokenizer.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors.
@@ -19,9 +18,6 @@
You should have received a copy of the GNU General Public License along with this
program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
Floor, Boston, MA 02110-1301 USA
*/
package com.mysql.jdbc;

@@ -31,49 +27,38 @@
* @author Mark Matthews
*/
public class EscapeTokenizer {
// ~ Instance fields
// --------------------------------------------------------
private static final char CHR_ESCAPE = '\\';
private static final char CHR_SGL_QUOTE = '\'';
private static final char CHR_DBL_QUOTE = '"';
private static final char CHR_LF = '\n';
private static final char CHR_CR = '\r';
private static final char CHR_COMMENT = '-';
private static final char CHR_BEGIN_TOKEN = '{';
private static final char CHR_END_TOKEN = '}';
private static final char CHR_VARIABLE = '@';

private int bracesLevel = 0;
private String source = null;
private int sourceLength = 0;
private int pos = 0;

private boolean emittingEscapeCode = false;

private boolean inComment = false;

private boolean sawVariableUse = false;
private int bracesLevel = 0;
private boolean inQuotes = false;

private char lastChar = 0;

private char lastLastChar = 0;

private int pos = 0;

private char quoteChar = 0;

private boolean sawVariableUse = false;

private String source = null;

private int sourceLength = 0;

// ~ Constructors
// -----------------------------------------------------------

/**
* Creates a new EscapeTokenizer object.
*
* @param s
* @param source
* the string to tokenize
*/
public EscapeTokenizer(String s) {
this.source = s;
this.sourceLength = s.length();
public EscapeTokenizer(String source) {
this.source = source;
this.sourceLength = source.length();
this.pos = 0;
}

// ~ Methods
// ----------------------------------------------------------------

/**
* Does this tokenizer have more tokens available?
*
@@ -90,107 +75,109 @@ public synchronized boolean hasMoreTokens() {
*/
public synchronized String nextToken() {
StringBuffer tokenBuf = new StringBuffer();
boolean backslashEscape = false;

if (this.emittingEscapeCode) {
tokenBuf.append("{"); //$NON-NLS-1$
// Previous token ended at the beginning of an escape code, so this token must start with '{'
tokenBuf.append("{");
this.emittingEscapeCode = false;
}

for (; this.pos < this.sourceLength; this.pos++) {
char c = this.source.charAt(this.pos);

// Detect variable usage

if (!this.inQuotes && c == '@') {
this.sawVariableUse = true;
// process escape char: (\)
if (c == CHR_ESCAPE) {
tokenBuf.append(c);
backslashEscape = !backslashEscape;
continue;
}

if ((c == '\'' || c == '"') && !inComment) {
if (this.inQuotes && c == quoteChar) {
if (this.pos + 1 < this.sourceLength) {
if (this.source.charAt(this.pos + 1) == quoteChar) {
// Doubled-up quote escape, if the first quote isn't already escaped
if (this.lastChar != '\\') {
tokenBuf.append(quoteChar);
tokenBuf.append(quoteChar);
this.pos++;
continue;
}
}
}
}
if (this.lastChar != '\\') {
if (this.inQuotes) {
if (this.quoteChar == c) {
this.inQuotes = false;
}
} else {
this.inQuotes = true;
this.quoteChar = c;
}
} else if (this.lastLastChar == '\\') {
if (this.inQuotes) {
if (this.quoteChar == c) {
// process quotes: ('|")
if ((c == CHR_SGL_QUOTE || c == CHR_DBL_QUOTE) && !backslashEscape) {
tokenBuf.append(c);
if (this.inQuotes) {
if (c == this.quoteChar) {
// look ahead for doubled quote
if ((this.pos + 1 < this.sourceLength) && (this.source.charAt(this.pos + 1) == this.quoteChar)) {
tokenBuf.append(c);
this.pos++; // consume following char '\'' or '"'
} else {
this.inQuotes = false;
}
} else {
this.inQuotes = true;
this.quoteChar = c;
}
} else {
this.inQuotes = true;
this.quoteChar = c;
}
continue;
}

// process new line: (\n|\r)
if ((c == CHR_LF) || (c == CHR_CR)) {
tokenBuf.append(c);
} else if (c == '-') {
if ((this.lastChar == '-')
&& ((this.lastLastChar != '\\') && !this.inQuotes)) {
this.inComment = true;
}

tokenBuf.append(c);
} else if ((c == '\n') || (c == '\r')) {
this.inComment = false;
backslashEscape = false;
continue;
}

tokenBuf.append(c);
} else if (c == '{') {
if (this.inQuotes || this.inComment) {
if (!this.inQuotes && !backslashEscape) {
// process comments: (--)
if (c == CHR_COMMENT) {
tokenBuf.append(c);
} else {
this.bracesLevel++;
// look ahead for double hyphen
if ((this.pos + 1 < this.sourceLength) && (this.source.charAt(this.pos + 1) == CHR_COMMENT)) {
// consume following chars until new line or end of string
while (++this.pos < this.sourceLength && c != CHR_LF && c != CHR_CR) {
c = this.source.charAt(this.pos);
tokenBuf.append(c);
}
this.pos--;
}
continue;
}

// process begin token: ({)
if (c == CHR_BEGIN_TOKEN) {
this.bracesLevel++;
if (this.bracesLevel == 1) {
this.pos++;
this.emittingEscapeCode = true;

this.pos++; // consume char '{' before returning
return tokenBuf.toString();
}

tokenBuf.append(c);
continue;
}
} else if (c == '}') {
tokenBuf.append(c);

if (!this.inQuotes && !this.inComment) {
this.lastChar = c;

// process end token: (})
if (c == CHR_END_TOKEN) {
tokenBuf.append(c);
this.bracesLevel--;

if (this.bracesLevel == 0) {
this.pos++;

this.pos++; // consume char '}' before returning
return tokenBuf.toString();
}
continue;
}

// detect variable usage: (@)
if (c == CHR_VARIABLE) {
this.sawVariableUse = true;
}
} else {
tokenBuf.append(c);
}

this.lastLastChar = this.lastChar;
this.lastChar = c;
tokenBuf.append(c);
backslashEscape = false;
}

return tokenBuf.toString();
}

/**
* Returns true if a variable reference was found. Note that this information isn't accurate until finishing to
* process all tokens from source String. It also can't be used as per token basis.
*
* @return true if a variable reference was found.
*/
boolean sawVariableUse() {
return this.sawVariableUse;
}
6 changes: 1 addition & 5 deletions src/com/mysql/jdbc/JDBC4ResultSet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/J is licensed under the terms of the GPLv2
@@ -324,10 +324,6 @@ public SQLXML getSQLXML(String columnLabel) throws SQLException {
return getSQLXML(findColumn(columnLabel));
}

public synchronized boolean isClosed() throws SQLException {
return this.isClosed;
}

public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
throw new NotUpdatable();

10 changes: 5 additions & 5 deletions src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
Original file line number Diff line number Diff line change
@@ -616,11 +616,11 @@ public synchronized Object invoke(Object proxy, Method method, Object[] args, bo
this.isClosed = false;
this.closedReason = null;
} else {
String reason = "No operations allowed after connection closed.";
if(this.closedReason != null){
reason += (" " + this.closedReason);
}
throw SQLError.createSQLException(
String reason = "No operations allowed after connection closed.";
if(this.closedReason != null){
reason += (" " + this.closedReason);
}
throw SQLError.createSQLException(
reason,
SQLError.SQL_STATE_CONNECTION_NOT_OPEN, null /*
* no access to
Loading