List of utility methods to do SQL Table Column
String[] | getColumns(ResultSetMetaData rsmd) Returns an array of strings as upper-case column names. String[] names = new String[rsmd.getColumnCount()]; for (int i = 0; i < rsmd.getColumnCount(); i++) { names[i] = rsmd.getColumnName(i + 1); return names; |
String[] | getColumns(ResultSetMetaData rsMetaData) get Columns int colcount = rsMetaData.getColumnCount(); String[] result = new String[colcount]; for (int i = 0; i < result.length; i++) { result[i] = rsMetaData.getColumnName(i + 1); return result; |
String[] | getColumnsNames(ResultSet rs) get Columns Names String[] columnNames = null; try { ResultSetMetaData rsmd = rs.getMetaData(); List<String> lstColumnNames = new ArrayList<String>(); for (int i = 0; i < rsmd.getColumnCount(); i++) { lstColumnNames.add(rsmd.getColumnName(i)); columnNames = new String[lstColumnNames.size()]; ... |
int | getColumnType(ResultSet resultSet, int i, Map Gets type of column from result-set. Integer type = typeCache.get(i); if (type == null) { try { type = resultSet.getMetaData().getColumnType(i); } catch (Exception e) { type = Types.OTHER; typeCache.put(i, type); ... |
Map | getColumnType(ResultSetMetaData rsm) get column type return getColumnType(false, rsm);
|
String | getColumnType(ResultSetMetaData rsmd, int idx) Get the type of an external database's column as a Derby type name. int jdbcType = rsmd.getColumnType(idx); int precision = rsmd.getPrecision(idx); int scale = rsmd.getScale(idx); switch (jdbcType) { case Types.BIGINT: return "bigint"; case Types.BINARY: return "char " + precisionToLength(precision) + " for bit data"; ... |
int[] | getColumnTypes(ResultSet rs) Determines the SQL column types used in the provided resultset. return getColumnTypes(rs.getMetaData());
|
String | getColumnValue(ResultSet rs, ResultSetMetaData rsmd, int colIndex) get Column Value String s = rs.getString(colIndex); if (rs.wasNull()) return "null"; switch (rsmd.getColumnType(colIndex)) { case Types.BIT: if (s.equals("t") || s.equals("f")) return String.valueOf(rs.getBoolean(colIndex)); else ... |
String | getColumnValue(String column, String defaultValue, Map get Column Value int index = columnIndexMap.containsKey(column.toUpperCase()) ? columnIndexMap.get(column.toUpperCase()) : -1; if (index > -1) { String str; try { Object obj = res.getObject(index); if (obj == null) { return null; ... |
Object | getColumnValueFromResultSet(int columnIndex, int argType, ResultSet rs) get Column Value From Result Set switch (argType) { case Types.INTEGER: return new Integer(rs.getInt(columnIndex)); case Types.BOOLEAN: return new Boolean(rs.getBoolean(columnIndex)); case Types.FLOAT: return new Float(rs.getFloat(columnIndex)); case Types.DOUBLE: ... |