From c5cba4ba50fe3d749d29394ba4328e9dbc8a6f32 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Fri, 2 Sep 2016 14:24:35 +0200
Subject: [PATCH] [TAP] Fix bug about BOOLEAN datatypes. If a BOOLEAN database
 column is encountered, its datatype will be considered as SMALLINT (because
 TAP 1.0 does not support BOOLEAN) and its values will be converted into 0 for
 FALSE and 1 for TRUE. This last part was missing in the TAP library before
 this commit.

---
 src/tap/data/ResultSetTableIterator.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/tap/data/ResultSetTableIterator.java b/src/tap/data/ResultSetTableIterator.java
index bee5725..8b7202d 100644
--- a/src/tap/data/ResultSetTableIterator.java
+++ b/src/tap/data/ResultSetTableIterator.java
@@ -43,7 +43,7 @@ import uws.ISO8601Format;
  * </i></p>
  * 
  * @author Gr&eacute;gory Mantelet (ARI)
- * @version 2.1 (08/2016)
+ * @version 2.1 (09/2016)
  * @since 2.0
  */
 public class ResultSetTableIterator implements TableIterator {
@@ -706,6 +706,9 @@ public class ResultSetTableIterator implements TableIterator {
 			// if the column value is a Timestamp object, format it in ISO8601:
 			if (colValue instanceof Timestamp)
 				colValue = ISO8601Format.format(((Timestamp)colValue).getTime());
+			// if the column value is a Boolean object, format it as a SMALLINT:
+			else if (colValue instanceof Boolean)
+				colValue = ((Boolean)colValue) ? 1 : 0;
 			// if the column should be only a character:
 			else if (colType != null && colValue != null && colType.type == DBDatatype.CHAR && (colType.length == 1 || colType.length <= 0) && colValue instanceof String)
 				colValue = ((String)colValue).charAt(0);
-- 
GitLab