Add more SQL Types

This commit is contained in:
2017-10-30 16:15:43 +01:00
parent 8194709fbf
commit cbc35dedc7
2 changed files with 11 additions and 0 deletions

View File

@@ -155,6 +155,16 @@ public class SqlExecutor {
columnBuilder.value(rs.getString(columnIndex)); columnBuilder.value(rs.getString(columnIndex));
} else if (columnType == Types.NUMERIC) { } else if (columnType == Types.NUMERIC) {
columnBuilder.value(rs.getLong(columnIndex)); columnBuilder.value(rs.getLong(columnIndex));
} else if (columnType == Types.DATE) {
columnBuilder.value(rs.getDate(columnIndex));
} else if (columnType == Types.TIME) {
columnBuilder.value(rs.getTime(columnIndex));
} else if (columnType == Types.TIMESTAMP) {
columnBuilder.value(rs.getTimestamp(columnIndex));
} else if (columnType == Types.CLOB) {
columnBuilder.value(rs.getClob(columnIndex).getSubString(1, 100));
} else if (columnType == Types.BLOB) {
columnBuilder.value("[BLOB]");
} else { } else {
String message = String.format("Unhandled column type <%s>. Defaulting to String", rs.getMetaData().getColumnTypeName(columnIndex)); String message = String.format("Unhandled column type <%s>. Defaulting to String", rs.getMetaData().getColumnTypeName(columnIndex));
log.warn(message); log.warn(message);

View File

@@ -119,6 +119,7 @@ public class Main {
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
executionMode = ExecutionMode.TERMINAL;
BasicConfigurator.configure(); BasicConfigurator.configure();
LogManager.getRootLogger().setLevel(Level.OFF); LogManager.getRootLogger().setLevel(Level.OFF);
LogManager.getLogger("at.compax.tools.sql.main").setLevel(executionMode.getLoggingLevel()); LogManager.getLogger("at.compax.tools.sql.main").setLevel(executionMode.getLoggingLevel());