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

[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.
parent 6f154e19
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ import uws.ISO8601Format; ...@@ -43,7 +43,7 @@ import uws.ISO8601Format;
* </i></p> * </i></p>
* *
* @author Gr&eacute;gory Mantelet (ARI) * @author Gr&eacute;gory Mantelet (ARI)
* @version 2.1 (08/2016) * @version 2.1 (09/2016)
* @since 2.0 * @since 2.0
*/ */
public class ResultSetTableIterator implements TableIterator { public class ResultSetTableIterator implements TableIterator {
...@@ -706,6 +706,9 @@ 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 the column value is a Timestamp object, format it in ISO8601:
if (colValue instanceof Timestamp) if (colValue instanceof Timestamp)
colValue = ISO8601Format.format(((Timestamp)colValue).getTime()); 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: // 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) else if (colType != null && colValue != null && colType.type == DBDatatype.CHAR && (colType.length == 1 || colType.length <= 0) && colValue instanceof String)
colValue = ((String)colValue).charAt(0); colValue = ((String)colValue).charAt(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment