Skip to content

Instantly share code, notes, and snippets.

@tbk303
Created December 30, 2010 13:49
Show Gist options
  • Save tbk303/759805 to your computer and use it in GitHub Desktop.
Save tbk303/759805 to your computer and use it in GitHub Desktop.
correct representation of boolean values
Index: src/henplus/commands/ResultSetRenderer.java
===================================================================
RCS file: /cvsroot/henplus/henplus/src/henplus/commands/ResultSetRenderer.java,v
retrieving revision 1.22
diff -u -r1.22 ResultSetRenderer.java
--- src/henplus/commands/ResultSetRenderer.java 18 Jun 2005 04:58:13 -0000 1.22
+++ src/henplus/commands/ResultSetRenderer.java 9 Jan 2008 14:12:42 -0000
@@ -103,13 +103,19 @@
Column[] currentRow = new Column[ columns ];
for (int i = 0 ; i < columns ; ++i) {
int col = (showColumns != null) ? showColumns[i] : i+1;
- String colString;
- if (meta.getColumnType( col ) == Types.CLOB) {
- colString = readClob(rset.getClob( col ));
- }
- else {
- colString = rset.getString( col );
- }
+ String colString;
+ switch (meta.getColumnType( col )) {
+ case Types.CLOB:
+ colString = readClob(rset.getClob( col ));
+ break;
+ case Types.BIT:
+ case Types.BOOLEAN:
+ colString = rset.getObject(col) == null ? null : Boolean.toString(rset.getBoolean(col));
+ break;
+ default:
+ colString = rset.getString( col );
+ break;
+ }
Column thisCol = new Column(colString);
currentRow[i] = thisCol;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment