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.46
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.47
Choose a head ref
  • 14 commits
  • 26 files changed
  • 2 contributors

Commits on Jul 5, 2018

  1. Post-release changes.

    soklakov committed Jul 5, 2018
    Copy the full SHA
    52a14bf View commit details
  2. Fix for BUG#90024 (27677574), SOME TESTS FAILED AGAINST MYSQL 8.0.5

    BECAUSE OF DEPRECATED FEATURES REMOVAL.
    soklakov committed Jul 5, 2018
    Copy the full SHA
    3647f24 View commit details

Commits on Jul 19, 2018

  1. Fix for BUG#22305979, WRONG RECORD UPDATED IF

    SENDFRACTIONALSECONDS=FALSE AND SMT IS SCROLLABLE.
    soklakov committed Jul 19, 2018
    Copy the full SHA
    df80d95 View commit details
  2. Copy the full SHA
    091a65d View commit details

Commits on Jul 24, 2018

  1. Fix for BUG#80532 (22847443), ENCODING OF RESULTSET.UPDATEROW IS BROKEN

    FOR NON ASCII CHARCTERS.
    soklakov committed Jul 24, 2018
    Copy the full SHA
    f790295 View commit details
  2. Fix for BUG#80532 test case.

    soklakov committed Jul 24, 2018
    Copy the full SHA
    58c3030 View commit details

Commits on Jul 25, 2018

  1. Fix for Bug#89948 (27658489), Batched statements are not committed fo…

    …r useLocalTransactionState=true.
    fjssilva committed Jul 25, 2018
    Copy the full SHA
    96c6843 View commit details
  2. Fix for Bug#87534 (26730196), UNION ALL query fails when useServerPre…

    …pStmts=true on database connection.
    fjssilva committed Jul 25, 2018
    Copy the full SHA
    614b595 View commit details

Commits on Jul 27, 2018

  1. Copy the full SHA
    d2d71a7 View commit details
  2. Copy the full SHA
    518d3fc View commit details
  3. Copy the full SHA
    c4f544d View commit details
  4. Fix for Bug#81063 (23098159), w/ rewriteBatchedStatements, when 2 tab…

    …les involved, the rewriting not correct.
    fjssilva committed Jul 27, 2018
    Copy the full SHA
    70c0c5e View commit details

Commits on Aug 2, 2018

  1. Update for Bug#81196 (23227334) fix. Charset name was not properly

    rewritten by connectionCollation.
    soklakov committed Aug 2, 2018
    Copy the full SHA
    8a7a9dd View commit details

Commits on Aug 3, 2018

  1. Fix for Bug#28449601, MASTER : UNITTEST FOR BUG#22305979

    (TESTBUG22305979) STILL FAILS ON QA SETUP.
    soklakov committed Aug 3, 2018
    Copy the full SHA
    fe1903b View commit details
23 changes: 23 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Changelog
# https://dev.mysql.com/doc/relnotes/connector-j/5.1/en/

Version 5.1.47

- Fix for Bug#28449601, MASTER : UNITTEST FOR BUG#22305979 (TESTBUG22305979) STILL FAILS ON QA SETUP.

- Fix for Bug#81063 (23098159), w/ rewriteBatchedStatements, when 2 tables involved, the rewriting not correct.

- Fix for Bug#84813 (25501750), rewriteBatchedStatements fails in INSERT.

- Fix for Bug#81196 (23227334), CONNECTOR/J NOT FOLLOWING DATABASE CHARACTER SET.

- Fix for Bug#72609 (18749544), SETDATE() NOT USING A PROLEPTIC GREGORIAN CALENDAR.

- Fix for Bug#87534 (26730196), UNION ALL query fails when useServerPrepStmts=true on database connection.
Test case only. Base bug fixed in MySQL 5.7.22.

- Fix for Bug#89948 (27658489), Batched statements are not committed for useLocalTransactionState=true.

- Fix for BUG#80532 (22847443), ENCODING OF RESULTSET.UPDATEROW IS BROKEN FOR NON ASCII CHARCTERS.

- Fix for BUG#22305979, WRONG RECORD UPDATED IF SENDFRACTIONALSECONDS=FALSE AND SMT IS SCROLLABLE.

- Fix for BUG#90024 (27677574), SOME TESTS FAILED AGAINST MYSQL 8.0.5 BECAUSE OF DEPRECATED FEATURES REMOVAL.

Version 5.1.46

- WL#11629, Change caching_sha2_password padding.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -158,7 +158,7 @@ com.mysql.jdbc.noCleanBetweenCompiles=yes

<property name="major_version" value="5" />
<property name="minor_version" value="1" />
<property name="subminor_version" value="46" />
<property name="subminor_version" value="47" />
<property name="version_status" value="" />

<property name="version" value="${major_version}.${minor_version}.${subminor_version}${version_status}" />
6 changes: 5 additions & 1 deletion src/com/mysql/fabric/jdbc/FabricMySQLConnectionProxy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2018, 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.
@@ -3065,4 +3065,8 @@ public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {

public void decachePreparedStatement(ServerPreparedStatement pstmt) throws SQLException {
}

public boolean isServerTruncatesFracSecs() {
return getActiveMySQLConnection().isServerTruncatesFracSecs();
}
}
9 changes: 5 additions & 4 deletions src/com/mysql/jdbc/BufferRow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2018, 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.
@@ -544,8 +544,8 @@ public Time getTimeFast(int columnIndex, Calendar targetCalendar, TimeZone tz, b
}

@Override
public Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs)
throws SQLException {
public Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs,
boolean useGmtMillis, boolean useJDBCCompliantTimezoneShift) throws SQLException {
if (isNull(columnIndex)) {
return null;
}
@@ -556,7 +556,8 @@ public Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, Time

int offset = this.rowFromServer.getPosition();

return getTimestampFast(columnIndex, this.rowFromServer.getByteBuffer(), offset, (int) length, targetCalendar, tz, rollForward, conn, rs);
return getTimestampFast(columnIndex, this.rowFromServer.getByteBuffer(), offset, (int) length, targetCalendar, tz, rollForward, conn, rs, useGmtMillis,
useJDBCCompliantTimezoneShift);
}

@Override
9 changes: 5 additions & 4 deletions src/com/mysql/jdbc/ByteArrayRow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2007, 2018, 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.
@@ -119,15 +119,16 @@ public long getLong(int columnIndex) {
}

@Override
public Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs)
throws SQLException {
public Timestamp getTimestampFast(int columnIndex, Calendar targetCalendar, TimeZone tz, boolean rollForward, MySQLConnection conn, ResultSetImpl rs,
boolean useGmtMillis, boolean useJDBCCompliantTimezoneShift) throws SQLException {
byte[] columnValue = this.internalRowData[columnIndex];

if (columnValue == null) {
return null;
}

return getTimestampFast(columnIndex, this.internalRowData[columnIndex], 0, columnValue.length, targetCalendar, tz, rollForward, conn, rs);
return getTimestampFast(columnIndex, this.internalRowData[columnIndex], 0, columnValue.length, targetCalendar, tz, rollForward, conn, rs, useGmtMillis,
useJDBCCompliantTimezoneShift);
}

@Override
77 changes: 46 additions & 31 deletions src/com/mysql/jdbc/ConnectionImpl.java
Original file line number Diff line number Diff line change
@@ -529,6 +529,8 @@ private static boolean nullSafeCompare(String s1, String s2) {

private boolean noBackslashEscapes = false;

private boolean serverTruncatesFracSecs = false;

private long numberOfPreparedExecutes = 0;

private long numberOfPrepares = 0;
@@ -1034,7 +1036,15 @@ private boolean canHandleAsServerPreparedStatementNoCache(String sql) throws SQL

boolean canHandleAsStatement = true;

if (!versionMeetsMinimum(5, 0, 7) && (StringUtils.startsWithIgnoreCaseAndNonAlphaNumeric(sql, "SELECT")
boolean allowBackslashEscapes = !this.noBackslashEscapes;
String quoteChar = this.useAnsiQuotes ? "\"" : "'";

if (this.getAllowMultiQueries()) {
if (StringUtils.indexOfIgnoreCase(0, sql, ";", quoteChar, quoteChar,
allowBackslashEscapes ? StringUtils.SEARCH_MODE__ALL : StringUtils.SEARCH_MODE__MRK_COM_WS) != -1) {
canHandleAsStatement = false;
}
} else if (!versionMeetsMinimum(5, 0, 7) && (StringUtils.startsWithIgnoreCaseAndNonAlphaNumeric(sql, "SELECT")
|| StringUtils.startsWithIgnoreCaseAndNonAlphaNumeric(sql, "DELETE") || StringUtils.startsWithIgnoreCaseAndNonAlphaNumeric(sql, "INSERT")
|| StringUtils.startsWithIgnoreCaseAndNonAlphaNumeric(sql, "UPDATE") || StringUtils.startsWithIgnoreCaseAndNonAlphaNumeric(sql, "REPLACE"))) {

@@ -1047,8 +1057,6 @@ private boolean canHandleAsServerPreparedStatementNoCache(String sql) throws SQL
int currentPos = 0;
int statementLength = sql.length();
int lastPosToLook = statementLength - 7; // "LIMIT ".length()
boolean allowBackslashEscapes = !this.noBackslashEscapes;
String quoteChar = this.useAnsiQuotes ? "\"" : "'";
boolean foundLimitWithPlaceholder = false;

while (currentPos < lastPosToLook) {
@@ -1626,6 +1634,19 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws
configureCharsetProperties();
realJavaEncoding = getEncoding(); // we need to do this again to grab this for versions > 4.1.0

String connectionCollationSuffix = "";
String connectionCollationCharset = "";

if (!getUseOldUTF8Behavior() && !StringUtils.isNullOrEmpty(getConnectionCollation())) {
for (int i = 1; i < CharsetMapping.COLLATION_INDEX_TO_COLLATION_NAME.length; i++) {
if (CharsetMapping.COLLATION_INDEX_TO_COLLATION_NAME[i].equals(getConnectionCollation())) {
connectionCollationSuffix = " COLLATE " + CharsetMapping.COLLATION_INDEX_TO_COLLATION_NAME[i];
connectionCollationCharset = CharsetMapping.COLLATION_INDEX_TO_CHARSET[i].charsetName;
realJavaEncoding = CharsetMapping.getJavaEncodingForCollationIndex(i);
}
}
}

try {

// Fault injection for testing server character set indices
@@ -1695,14 +1716,17 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws
// charset names are case-sensitive

boolean utf8mb4Supported = versionMeetsMinimum(5, 5, 2);
boolean useutf8mb4 = utf8mb4Supported && (CharsetMapping.UTF8MB4_INDEXES.contains(this.io.serverCharsetIndex));
String utf8CharsetName = connectionCollationSuffix.length() > 0 ? connectionCollationCharset
: (utf8mb4Supported ? "utf8mb4" : "utf8");

if (!getUseOldUTF8Behavior()) {
if (dontCheckServerMatch || !characterSetNamesMatches("utf8") || (utf8mb4Supported && !characterSetNamesMatches("utf8mb4"))) {
execSQL(null, "SET NAMES " + (useutf8mb4 ? "utf8mb4" : "utf8"), -1, null, DEFAULT_RESULT_SET_TYPE,
if (dontCheckServerMatch || !characterSetNamesMatches("utf8") || (utf8mb4Supported && !characterSetNamesMatches("utf8mb4"))
|| (connectionCollationSuffix.length() > 0
&& !getConnectionCollation().equalsIgnoreCase(this.serverVariables.get("collation_server")))) {
execSQL(null, "SET NAMES " + utf8CharsetName + connectionCollationSuffix, -1, null, DEFAULT_RESULT_SET_TYPE,
DEFAULT_RESULT_SET_CONCURRENCY, false, this.database, null, false);
this.serverVariables.put("character_set_client", useutf8mb4 ? "utf8mb4" : "utf8");
this.serverVariables.put("character_set_connection", useutf8mb4 ? "utf8mb4" : "utf8");
this.serverVariables.put("character_set_client", utf8CharsetName);
this.serverVariables.put("character_set_connection", utf8CharsetName);
}
} else {
execSQL(null, "SET NAMES latin1", -1, null, DEFAULT_RESULT_SET_TYPE, DEFAULT_RESULT_SET_CONCURRENCY, false, this.database, null,
@@ -1713,7 +1737,8 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws

setEncoding(realJavaEncoding);
} /* not utf-8 */else {
String mysqlCharsetName = CharsetMapping.getMysqlCharsetForJavaEncoding(realJavaEncoding.toUpperCase(Locale.ENGLISH), this);
String mysqlCharsetName = connectionCollationSuffix.length() > 0 ? connectionCollationCharset
: CharsetMapping.getMysqlCharsetForJavaEncoding(realJavaEncoding.toUpperCase(Locale.ENGLISH), this);

/*
* if ("koi8_ru".equals(mysqlEncodingName)) { //
@@ -1727,8 +1752,8 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws
if (mysqlCharsetName != null) {

if (dontCheckServerMatch || !characterSetNamesMatches(mysqlCharsetName)) {
execSQL(null, "SET NAMES " + mysqlCharsetName, -1, null, DEFAULT_RESULT_SET_TYPE, DEFAULT_RESULT_SET_CONCURRENCY, false,
this.database, null, false);
execSQL(null, "SET NAMES " + mysqlCharsetName + connectionCollationSuffix, -1, null, DEFAULT_RESULT_SET_TYPE,
DEFAULT_RESULT_SET_CONCURRENCY, false, this.database, null, false);
this.serverVariables.put("character_set_client", mysqlCharsetName);
this.serverVariables.put("character_set_connection", mysqlCharsetName);
}
@@ -1740,11 +1765,8 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws
}
} else if (getEncoding() != null) {
// Tell the server we'll use the server default charset to send our queries from now on....
String mysqlCharsetName = getServerCharset();

if (getUseOldUTF8Behavior()) {
mysqlCharsetName = "latin1";
}
String mysqlCharsetName = connectionCollationSuffix.length() > 0 ? connectionCollationCharset
: (getUseOldUTF8Behavior() ? "latin1" : getServerCharset());

boolean ucs2 = false;
if ("ucs2".equalsIgnoreCase(mysqlCharsetName) || "utf16".equalsIgnoreCase(mysqlCharsetName)
@@ -1758,8 +1780,8 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws

if (dontCheckServerMatch || !characterSetNamesMatches(mysqlCharsetName) || ucs2) {
try {
execSQL(null, "SET NAMES " + mysqlCharsetName, -1, null, DEFAULT_RESULT_SET_TYPE, DEFAULT_RESULT_SET_CONCURRENCY, false,
this.database, null, false);
execSQL(null, "SET NAMES " + mysqlCharsetName + connectionCollationSuffix, -1, null, DEFAULT_RESULT_SET_TYPE,
DEFAULT_RESULT_SET_CONCURRENCY, false, this.database, null, false);
this.serverVariables.put("character_set_client", mysqlCharsetName);
this.serverVariables.put("character_set_connection", mysqlCharsetName);
} catch (SQLException ex) {
@@ -1864,19 +1886,6 @@ private boolean configureClientCharacterSet(boolean dontCheckServerMatch) throws
this.serverVariables.put(JDBC_LOCAL_CHARACTER_SET_RESULTS, onServer);
}
}

if (getConnectionCollation() != null) {
StringBuilder setBuf = new StringBuilder("SET collation_connection = ".length() + getConnectionCollation().length());
setBuf.append("SET collation_connection = ").append(getConnectionCollation());

try {
execSQL(null, setBuf.toString(), -1, null, DEFAULT_RESULT_SET_TYPE, DEFAULT_RESULT_SET_CONCURRENCY, false, this.database, null, false);
} catch (SQLException ex) {
if (ex.getErrorCode() != MysqlErrorNumbers.ER_MUST_CHANGE_PASSWORD || getDisconnectOnExpiredPasswords()) {
throw ex;
}
}
}
} else {
// Use what the server has specified
realJavaEncoding = getEncoding(); // so we don't get
@@ -3303,6 +3312,7 @@ private void initializePropsFromServer() throws SQLException {
} else if (sqlModeAsString != null) {
this.useAnsiQuotes = sqlModeAsString.indexOf("ANSI_QUOTES") != -1;
this.noBackslashEscapes = sqlModeAsString.indexOf("NO_BACKSLASH_ESCAPES") != -1;
this.serverTruncatesFracSecs = sqlModeAsString.indexOf("TIME_TRUNCATE_FRACTIONAL") != -1; // truncate instead of round
}
}
}
@@ -3759,6 +3769,7 @@ private void loadServerVariables() throws SQLException {
queryBuf.append(", @@character_set_results AS character_set_results");
queryBuf.append(", @@character_set_server AS character_set_server");
queryBuf.append(", @@collation_server AS collation_server");
queryBuf.append(", @@collation_connection AS collation_connection");
queryBuf.append(", @@init_connect AS init_connect");
queryBuf.append(", @@interactive_timeout AS interactive_timeout");
if (!versionMeetsMinimum(5, 5, 0)) {
@@ -5501,6 +5512,10 @@ public void setProfilerEventHandlerInstance(ProfilerEventHandler h) {
this.eventSink = h;
}

public boolean isServerTruncatesFracSecs() {
return this.serverTruncatesFracSecs;
}

private static class NetworkTimeoutSetter implements Runnable {
private final WeakReference<ConnectionImpl> connImplRef;
private final WeakReference<MysqlIO> mysqlIoRef;
9 changes: 5 additions & 4 deletions src/com/mysql/jdbc/EscapeProcessor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2018, 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.
@@ -373,15 +373,16 @@ private static void processTimestampToken(MySQLConnection conn, StringBuilder ne
try {
if (!conn.getUseLegacyDatetimeCode()) {
Timestamp ts = Timestamp.valueOf(argument);
SimpleDateFormat tsdf = new SimpleDateFormat("''yyyy-MM-dd HH:mm:ss", Locale.US);

tsdf.setTimeZone(conn.getServerTimezoneTZ());
ts = TimeUtil.adjustTimestampNanosPrecision(ts, 6, !conn.isServerTruncatesFracSecs());

SimpleDateFormat tsdf = TimeUtil.getSimpleDateFormat(null, "''yyyy-MM-dd HH:mm:ss", null, conn.getServerTimezoneTZ());

newSql.append(tsdf.format(ts));

if (ts.getNanos() > 0 && conn.versionMeetsMinimum(5, 6, 4)) {
newSql.append('.');
newSql.append(TimeUtil.formatNanos(ts.getNanos(), true, true));
newSql.append(TimeUtil.formatNanos(ts.getNanos(), true, 6));
}

newSql.append('\'');
8 changes: 7 additions & 1 deletion src/com/mysql/jdbc/Field.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2018, 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.
@@ -787,6 +787,12 @@ private boolean isNativeDateTimeType() {
|| this.mysqlType == MysqlDefs.FIELD_TYPE_TIME || this.mysqlType == MysqlDefs.FIELD_TYPE_TIMESTAMP);
}

public boolean isCharsetApplicableType() {
return (this.mysqlType == MysqlDefs.FIELD_TYPE_ENUM || this.mysqlType == MysqlDefs.FIELD_TYPE_JSON || this.mysqlType == MysqlDefs.FIELD_TYPE_SET
|| this.mysqlType == MysqlDefs.FIELD_TYPE_STRING || this.mysqlType == MysqlDefs.FIELD_TYPE_VAR_STRING
|| this.mysqlType == MysqlDefs.FIELD_TYPE_VARCHAR);
}

public void setConnection(MySQLConnection conn) {
this.connection = conn;

Loading