Skip to content

Commit

Permalink
fixed an incompatibility with PostgreSQL JDBC Driver 9.1
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/jailer/code/trunk@1111 3dd849cd-670e-4645-a7cd-dd197c8d0e81
  • Loading branch information
rwisser committed Nov 22, 2016
1 parent 07d7b3a commit 1c23253
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions releasenotes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
6.1.3
- fixed an incompatibility with PostgreSQL JDBC Driver 9.1.

6.1.2
- Improved performance of the Data Browser.

Expand Down
2 changes: 1 addition & 1 deletion src/main/net/sf/jailer/Jailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class Jailer {
/**
* The Jailer version.
*/
public static final String VERSION = "6.1.2";
public static final String VERSION = "6.1.3";

/**
* The Jailer application name.
Expand Down
18 changes: 15 additions & 3 deletions src/main/net/sf/jailer/util/CellContentConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package net.sf.jailer.util;

import java.lang.reflect.Method;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
Expand Down Expand Up @@ -59,6 +60,7 @@ public class CellContentConverter {
private final Map<String, Integer> columnIndex = new HashMap<String, Integer>();
private final Session session;
private final Configuration configuration;
private Method pgObjectGetType;

/**
* Constructor.
Expand Down Expand Up @@ -152,9 +154,19 @@ public String toSql(Object content) {
return "'" + content + "'";
}
if (SqlUtil.dbms == DBMS.POSTGRESQL) {
if (content.getClass().getName().endsWith(".PGobject")) {
// PostgreSQL bit values
return "B'" + content + "'";
if (content.getClass().getSimpleName().equals("PGobject")) {
try {
if (pgObjectGetType == null) {
pgObjectGetType = content.getClass().getMethod("getType");
}
if ("varbit".equalsIgnoreCase((String) pgObjectGetType.invoke(content))) {
// PostgreSQL bit values
return "B'" + content + "'";
}
return "'" + Configuration.forDbms(session).convertToStringLiteral(content.toString()) + "'";
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
if (content instanceof UUID) {
Expand Down

0 comments on commit 1c23253

Please sign in to comment.