Skip to content
Permalink
Browse files

[CONJ-654] correct metadata driver name along with getDatabaseProduct…

…Name() according to server.

misc wrong "MySQL" description changed to "MariaDB"

(cherry picked from commit 5ec5099)

# Conflicts:
#	src/main/java/org/mariadb/jdbc/BasePrepareStatement.java
#	src/main/java/org/mariadb/jdbc/HostAddress.java
#	src/main/java/org/mariadb/jdbc/MariaDbConnection.java
#	src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java
#	src/main/java/org/mariadb/jdbc/internal/ColumnType.java
#	src/main/java/org/mariadb/jdbc/internal/failover/FailoverProxy.java
#	src/main/java/org/mariadb/jdbc/internal/io/TraceObject.java
#	src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java
#	src/main/java/org/mariadb/jdbc/internal/util/Utils.java
  • Loading branch information...
rusher committed Feb 4, 2019
1 parent 5c09b01 commit 59223f2d90563274e552f19162fbfd37a8960323
@@ -0,0 +1,48 @@
package org.mariadb.jdbc.internal.io.socket;

import com.sun.jna.Platform;
import org.mariadb.jdbc.UrlParser;
import org.mariadb.jdbc.internal.util.Utils;

import java.io.IOException;
import java.net.Socket;

public class SocketUtility {

/**
* Create socket according to options.
* In case of compilation ahead of time, will throw an error if dependencies found,
* then use default socket implementation.
*
* @return Socket
*/
@SuppressWarnings("unchecked")
public static Socket getSocketHandler(UrlParser urlParser, String host) throws IOException {
try {
//forcing use of JNA to ensure AOT compilation
Platform.getOSType();

if (urlParser.getOptions().pipe != null) {
return new NamedPipeSocket(host, urlParser.getOptions().pipe);
} else if (urlParser.getOptions().localSocket != null) {
try {
return new UnixDomainSocket(urlParser.getOptions().localSocket);
} catch (RuntimeException re) {
throw new IOException(re.getMessage(), re.getCause());
}
} else if (urlParser.getOptions().sharedMemory != null) {
try {
return new SharedMemorySocket(urlParser.getOptions().sharedMemory);
} catch (RuntimeException re) {
throw new IOException(re.getMessage(), re.getCause());
}
} else {
return Utils.standardSocket(urlParser, host);
}

} catch (Throwable cle) {
//jna jar's are not in classpath
}
return Utils.standardSocket(urlParser, host);
}
}
@@ -104,9 +104,13 @@ public void escape() throws SQLException {

@Test
public void backTickQuote() throws SQLException {
try (Connection conn = setConnection()) {
Connection conn = null;
try {
conn = setConnection();
Statement stmt = conn.createStatement();
stmt.execute("CREATE TEMPORARY TABLE `{tt1}`(`{Document id}` int, tt text)");
} finally {
if (conn != null) conn.close();
}
}
}

0 comments on commit 59223f2

Please sign in to comment.
You can’t perform that action at this time.