List of utility methods to do SQL Type
String[] | getJDBCTypes() get JDBC Types checkTypes(); return (String[]) jdbcTypes.keySet().toArray(new String[jdbcTypes.size()]); |
int | getLength(String format, String columnTypeName) get Length String col = columnTypeName.substring(0, 3); try { if (col.equals("TIM") || col.equals("DAT")) { return String.format(format, new java.sql.Timestamp(0)).length(); } else if (col.equals("NUM") || col.equals("DEC")) { return String.format(format, new java.math.BigDecimal(0)).length(); } else if (col.equals("VAR") || col.equals("CHA") || col.equals("STR")) { return String.format(format, " ").length(); ... |
Long | getLong(Object object) get Long if (object == null) { return null; } else if (object instanceof BigDecimal) { return Long.valueOf(((BigDecimal) object).longValue()); } else if (object instanceof Long) { return (Long) object; } else if (object instanceof String) { return Long.valueOf((String) object); ... |
byte[] | getMBTileData(int column, int row, int zoomLevel, String jdbcConnectionString) Loads the MBTile data from the database as blob, and returns it as byte array. Class.forName(SQLITE_JDBC_DRIVER);
Connection conn = DriverManager.getConnection(jdbcConnectionString);
Statement stat = conn.createStatement();
PreparedStatement prep = conn
.prepareStatement("SELECT * FROM tiles WHERE tile_column = ? AND tile_row = ? AND zoom_level = ?;");
prep.setInt(1, column);
prep.setInt(2, row);
prep.setInt(3, zoomLevel);
...
|
byte[] | getMBTileData(int column, int row, int zoomLevel, String jdbcConnectionString) Loads the MBTile data from the database as blob, and returns it as byte array. Class.forName(SQLITE_JDBC_DRIVER); Connection conn = null; byte[] tileData = null; try { conn = connectionsMap.get(jdbcConnectionString); if (conn == null) { conn = DriverManager.getConnection(jdbcConnectionString); connectionsMap.put(jdbcConnectionString, conn); ... |
List | getMessages(Array arr) get Messages List arrRes = new ArrayList(); if (arr != null) { String[] msgs = (String[]) arr.getArray(); for (int i = 0; i < msgs.length; i++) arrRes.add(msgs[i]); return arrRes; |
String | getNameByType(int sqlType) Returns SQL type name by code. switch (sqlType) { case Types.BIT: return "BIT"; case Types.BIGINT: return "BIGINT"; case Types.DECIMAL: return "DECIMAL"; case Types.DOUBLE: ... |
String | getNameFromJdbcType(int jdbcType) get Name From Jdbc Type switch (jdbcType) { case Types.BIT: return "Types.BIT"; case Types.BOOLEAN: return "Types.BOOLEAN"; case Types.TINYINT: return "Types.TINYINT"; case Types.SMALLINT: ... |
String | getNextQuotes(String lastQuotes, int lastType) get Next Quotes StringBuffer quotes = new StringBuffer(); if (lastQuotes.length() == 0) { return "\""; } else { if (lastType == Types.ARRAY) { int length = lastQuotes.length(); for (int i = 0; i < length; ++i) { quotes.append('\\'); ... |
Integer | getNumberType(Integer precision, Integer scale) getNumberType if (precision == null) { if (scale == null) { return Types.NUMERIC; } else if (scale == 0) { return Types.BIGINT; } else if (scale == null || scale == 0) { if (precision == 1) { ... |