From 0d89d7c8b081692fa8648c485ff683b9885e42f4 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Tue, 9 Dec 2014 15:54:32 +0100
Subject: [PATCH] [TAP] Deal with the DB type 'BOOLEAN' while uploading boolean
 values in the database => convert the boolean in a short value (1 or 0).

---
 src/tap/db/JDBCConnection.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/tap/db/JDBCConnection.java b/src/tap/db/JDBCConnection.java
index 437ffdb..974a649 100644
--- a/src/tap/db/JDBCConnection.java
+++ b/src/tap/db/JDBCConnection.java
@@ -1667,6 +1667,9 @@ public class JDBCConnection implements DBConnection {
 								throw new DataReadException("Incorrect STC-S syntax for the geometrical value \"" + val + "\"!", e);
 							}
 						}
+						/* BOOLEAN CASE (more generally, type incompatibility) */
+						else if (val != null && cols[c - 1].getDatatype().type == DBDatatype.SMALLINT && val instanceof Boolean)
+							val = ((Boolean)val) ? (short)1 : (short)0;
 					}
 					stmt.setObject(c++, val);
 				}
-- 
GitLab