Page MenuHomePhabricator
Paste P4768

(An Untitled Masterwork)
ActivePublic

Authored by Paladox on Jan 19 2017, 7:59 PM.
Tags
None
Referenced Files
F5313828:
Jan 19 2017, 7:59 PM
Subscribers
None
diff --git a/build.xml b/build.xml
index 8a92c99..81a025d 100644
--- a/build.xml
+++ b/build.xml
@@ -219,7 +219,7 @@ See also com.mysql.cj.core.conf.PropertyDefinitions.SYSP_* variables for other t
</condition>
<!-- The following property are needed for finding the JDK needed for compile and can be passed on the command line to ant via -D switch. -->
- <property name="com.mysql.cj.build.jdk" value="/usr/lib/jvm/jdk1.8" />
+ <property name="com.mysql.cj.build.jdk" value="/usr/lib/jvm/java-8-openjdk-amd64" />
<!-- The folloing property sets whether javac should generate debugging info or not and can be passed on the command line to ant via -D switch. -->
<property name="com.mysql.cj.build.addDebugInfo" value="on" />
@@ -324,7 +324,7 @@ See also com.mysql.cj.core.conf.PropertyDefinitions.SYSP_* variables for other t
resultproperty="com.mysql.cj.build.jdk.exitstatus">
<arg value="-version" />
</exec>
-
+<!--
<fail message="Java 8 is required. Set the full path to this JDK home with the property 'com.mysql.cj.build.jdk'. Default: '/usr/lib/jvm/jdk1.8').">
<condition>
<not>
@@ -334,7 +334,7 @@ See also com.mysql.cj.core.conf.PropertyDefinitions.SYSP_* variables for other t
</and>
</not>
</condition>
- </fail>
+ </fail>-->
</target>
diff --git a/src/main/java/com/mysql/cj/jdbc/ConnectionImpl.java b/src/main/java/com/mysql/cj/jdbc/ConnectionImpl.java
index d3eb7ed..82e390a 100644
--- a/src/main/java/com/mysql/cj/jdbc/ConnectionImpl.java
+++ b/src/main/java/com/mysql/cj/jdbc/ConnectionImpl.java
@@ -1333,14 +1333,17 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
if (!this.useOldUTF8Behavior.getValue()) {
if (dontCheckServerMatch || !this.session.characterSetNamesMatches("utf8") || (!this.session.characterSetNamesMatches("utf8mb4"))) {
- execSQL(null, "SET NAMES " + (useutf8mb4 ? "utf8mb4" : "utf8"), -1, null, false, this.database, null, false);
- this.session.getServerVariables().put("character_set_client", useutf8mb4 ? "utf8mb4" : "utf8");
- this.session.getServerVariables().put("character_set_connection", useutf8mb4 ? "utf8mb4" : "utf8");
+ execSQL(null, "SET NAMES utf8mb4"/* + (useutf8mb4 ? "utf8mb4" : "utf8")*/, -1, null, false, this.database, null, false);
+ this.session.getServerVariables().put("character_set_client", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
+ this.session.getServerVariables().put("character_set_connection", "uf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
+ this.session.getServerVariables().put("character_set_results", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
+ this.session.getServerVariables().put("character_set_server", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
}
} else {
- execSQL(null, "SET NAMES latin1", -1, null, false, this.database, null, false);
- this.session.getServerVariables().put("character_set_client", "latin1");
- this.session.getServerVariables().put("character_set_connection", "latin1");
+ execSQL(null, "SET NAMES utf8mb4"/* latin1"*/, -1, null, false, this.database, null, false);
+ this.session.getServerVariables().put("character_set_client", "utf8mb4"/* "latin1"*/);
+ this.session.getServerVariables().put("character_set_connection", "utf8mb4"/* "latin1"*/);
+ this.session.getServerVariables().put("character_set_server", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
}
this.characterEncoding.setValue(realJavaEncoding);
@@ -1350,9 +1353,13 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
if (mysqlCharsetName != null) {
if (dontCheckServerMatch || !this.session.characterSetNamesMatches(mysqlCharsetName)) {
- execSQL(null, "SET NAMES " + mysqlCharsetName, -1, null, false, this.database, null, false);
- this.session.getServerVariables().put("character_set_client", mysqlCharsetName);
- this.session.getServerVariables().put("character_set_connection", mysqlCharsetName);
+ execSQL(null, "SET NAMES " + "utf8mb4"/*mysqlCharsetName*/, -1, null, false, this.database, null, false);
+ /* this.session.getServerVariables().put("character_set_client", mysqlCharsetName);
+ this.session.getServerVariables().put("character_set_connection", mysqlCharsetName);*/
+ this.session.getServerVariables().put("character_set_client", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
+ this.session.getServerVariables().put("character_set_connection", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
+ this.session.getServerVariables().put("character_set_results", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
+ this.session.getServerVariables().put("character_set_server", "utf8mb4" /*useutf8mb4 ? "utf8mb4" : "utf8"*/);
}
}
@@ -1365,7 +1372,8 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
String mysqlCharsetName = getSession().getServerCharset();
if (this.useOldUTF8Behavior.getValue()) {
- mysqlCharsetName = "latin1";
+ // mysqlCharsetName = "latin1";
+ mysqlCharsetName = "utf8mb4";
}
boolean ucs2 = false;
@@ -1380,9 +1388,11 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
if (dontCheckServerMatch || !this.session.characterSetNamesMatches(mysqlCharsetName) || ucs2) {
try {
- execSQL(null, "SET NAMES " + mysqlCharsetName, -1, null, false, this.database, null, false);
- this.session.getServerVariables().put("character_set_client", mysqlCharsetName);
- this.session.getServerVariables().put("character_set_connection", mysqlCharsetName);
+ execSQL(null, "SET NAMES utf8mb4" /* + mysqlCharsetName*/, -1, null, false, this.database, null, false);
+ this.session.getServerVariables().put("character_set_client", "utf8mb4"/*, mysqlCharsetName*/);
+ this.session.getServerVariables().put("character_set_connection", "utf8mb4"/*mysqlCharsetName*/);
+ this.session.getServerVariables().put("character_set_results", "utf8mb4"/*mysqlCharsetName*/);
+ this.session.getServerVariables().put("character_set_server", "utf8mb4"/*mysqlCharsetName*/);
} catch (PasswordExpiredException ex) {
if (this.disconnectOnExpiredPasswords.getValue()) {
throw ex;
@@ -1436,9 +1446,10 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
if (this.useOldUTF8Behavior.getValue()) {
try {
- execSQL(null, "SET NAMES latin1", -1, null, false, this.database, null, false);
- this.session.getServerVariables().put("character_set_client", "latin1");
- this.session.getServerVariables().put("character_set_connection", "latin1");
+ execSQL(null, "SET NAMES utf8mb4", /*latin1",*/ -1, null, false, this.database, null, false);
+ this.session.getServerVariables().put("character_set_client", "utf8mb4" /*"latin1"*/);
+ this.session.getServerVariables().put("character_set_connection", "utf8mb4" /*"latin1"*/);
+ this.session.getServerVariables().put("character_set_server", "utf8mb4" /*"latin1"*/);
} catch (PasswordExpiredException ex) {
if (this.disconnectOnExpiredPasswords.getValue()) {
throw ex;
@@ -1470,11 +1481,11 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
}
if (!mysqlEncodingName.equalsIgnoreCase(this.session.getServerVariable("character_set_results"))) {
- StringBuilder setBuf = new StringBuilder("SET character_set_results = ".length() + mysqlEncodingName.length());
- setBuf.append("SET character_set_results = ").append(mysqlEncodingName);
+ StringBuilder setBuf = new StringBuilder("SET character_set_results = utf8mb4"/* ".length() + mysqlEncodingName.length()*/);
+ setBuf.append("SET character_set_results = ").append("utf8mb4");
try {
- execSQL(null, setBuf.toString(), -1, null, false, this.database, null, false);
+ execSQL(null, "set character_set_results = utf8mb4" /*setBuf.toString()*/, -1, null, false, this.database, null, false);
} catch (PasswordExpiredException ex) {
if (this.disconnectOnExpiredPasswords.getValue()) {
throw ex;
@@ -1485,7 +1496,7 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
}
}
- this.session.getServerVariables().put(ServerSession.JDBC_LOCAL_CHARACTER_SET_RESULTS, mysqlEncodingName);
+ this.session.getServerVariables().put(ServerSession.JDBC_LOCAL_CHARACTER_SET_RESULTS,"utf8mb4" /* mysqlEncodingName*/);
// We have to set errorMessageEncoding according to new value of charsetResults for server version 5.5 and higher
this.session.setErrorMessageEncoding(charsetResults);
@@ -1497,11 +1508,13 @@ public class ConnectionImpl extends AbstractJdbcConnection implements JdbcConnec
String connectionCollation = getPropertySet().getStringReadableProperty(PropertyDefinitions.PNAME_connectionCollation).getStringValue();
if (connectionCollation != null) {
- StringBuilder setBuf = new StringBuilder("SET collation_connection = ".length() + connectionCollation.length());
+ /* StringBuilder setBuf = new StringBuilder("SET collation_connection = ".length() + connectionCollation.length());
setBuf.append("SET collation_connection = ").append(connectionCollation);
-
+*/
try {
- execSQL(null, setBuf.toString(), -1, null, false, this.database, null, false);
+ execSQL(null, "set collation_connection = utf8mb4_unicode_ci", -1, null, false, this.database, null, false);
+ execSQL(null, "set collation_database = utf8mb4_unicode_ci", -1, null, false, this.database, null, false);
+ execSQL(null, "set collation_server = utf8mb4_unicode_ci", -1, null, false, this.database, null, false);
} catch (PasswordExpiredException ex) {
if (this.disconnectOnExpiredPasswords.getValue()) {
throw ex;
diff --git a/src/main/java/com/mysql/jdbc/Driver.java b/src/main/java/com/mysql/jdbc/Driver.java
index 7a548a6..9ba536f 100644
--- a/src/main/java/com/mysql/jdbc/Driver.java
+++ b/src/main/java/com/mysql/jdbc/Driver.java
@@ -30,11 +30,11 @@ import java.sql.SQLException;
*/
public class Driver extends com.mysql.cj.jdbc.Driver {
public Driver() throws SQLException {
- super();
+ /* super();*/
}
- static {
+ /* static {
System.err.println("Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. "
+ "The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.");
- }
+ }*/
}