Skip to content
Snippets Groups Projects
Commit 79af7156 authored by gmantele's avatar gmantele
Browse files

[TAP] Postgres does not support 0x00 value for a single character.

Such value is replaced by NULL while ingesting it into a Postgres
database.
parent 23ccc7af
No related branches found
No related tags found
No related merge requests found
...@@ -144,7 +144,7 @@ import adql.translator.TranslationException; ...@@ -144,7 +144,7 @@ import adql.translator.TranslationException;
* </i></p> * </i></p>
* *
* @author Gr&eacute;gory Mantelet (CDS;ARI) * @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 2.0 (06/2015) * @version 2.1 (07/2015)
* @since 2.0 * @since 2.0
*/ */
public class JDBCConnection implements DBConnection { public class JDBCConnection implements DBConnection {
...@@ -1805,6 +1805,9 @@ public class JDBCConnection implements DBConnection { ...@@ -1805,6 +1805,9 @@ public class JDBCConnection implements DBConnection {
/* BOOLEAN CASE (more generally, type incompatibility) */ /* BOOLEAN CASE (more generally, type incompatibility) */
else if (val != null && cols[c - 1].getDatatype().type == DBDatatype.SMALLINT && val instanceof Boolean) else if (val != null && cols[c - 1].getDatatype().type == DBDatatype.SMALLINT && val instanceof Boolean)
val = ((Boolean)val) ? (short)1 : (short)0; val = ((Boolean)val) ? (short)1 : (short)0;
/* NULL CHARACTER CASE (JUST FOR POSTGRESQL) */
else if ((dbms == null || dbms.equalsIgnoreCase(DBMS_POSTGRES)) && val instanceof Character && (Character)val == 0x00)
val = null;
} }
stmt.setObject(c++, val); stmt.setObject(c++, val);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment