/** * Gets the precision for this column. * * @param column the column index (1,2,...) * @return the precision * @throws SQLException if the result set is closed or invalid */ @Override public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Exception e) { throw logAndConvert(e); } }
/** * Write a result column to the given output. * * @param out the object to where to write the data * @param result the result * @param i the column index */ public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }
/** * Gets the precision for this column. * * @param column the column index (1,2,...) * @return the precision * @throws SQLException if the result set is closed or invalid */ @Override public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Exception e) { throw logAndConvert(e); } }
/** * Gets the precision for this column. * This method always returns 0. * * @param column the column index (1,2,...) * @return the precision * @throws SQLException if the result set is closed or invalid */ public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Throwable e) { throw logAndConvert(e); } }
/** * Gets the precision for this column. * * @param column the column index (1,2,...) * @return the precision * @throws SQLException if the result set is closed or invalid */ @Override public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Exception e) { throw logAndConvert(e); } }
private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) { int columnCount = rs.getVisibleColumnCount(); SimpleResultSet simple = new SimpleResultSet(); simple.setAutoClose(false); for (int i = 0; i < columnCount; i++) { String name = rs.getColumnName(i); int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i)); int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i)); int scale = rs.getColumnScale(i); simple.addColumn(name, sqlType, precision, scale); } rs.reset(); for (int i = 0; i < maxrows && rs.next(); i++) { Object[] list = new Object[columnCount]; for (int j = 0; j < columnCount; j++) { list[j] = rs.currentRow()[j].getObject(); } simple.addRow(list); } return simple; }
private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) { int columnCount = rs.getVisibleColumnCount(); SimpleResultSet simple = new SimpleResultSet(); simple.setAutoClose(false); for (int i = 0; i < columnCount; i++) { String name = rs.getColumnName(i); int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i)); int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i)); int scale = rs.getColumnScale(i); simple.addColumn(name, sqlType, precision, scale); } rs.reset(); for (int i = 0; i < maxrows && rs.next(); i++) { Object[] list = new Object[columnCount]; for (int j = 0; j < columnCount; j++) { list[j] = rs.currentRow()[j].getObject(); } simple.addRow(list); } return simple; }
public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); } }
/** * Write a result column to the given output. * * @param out the object to where to write the data * @param result the result * @param i the column index */ public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }
/** * Write a result column to the given output. * * @param out the object to where to write the data * @param result the result * @param i the column index */ public static void writeColumn(Transfer out, ResultInterface result, int i) throws IOException { out.writeString(result.getAlias(i)); out.writeString(result.getSchemaName(i)); out.writeString(result.getTableName(i)); out.writeString(result.getColumnName(i)); out.writeInt(result.getColumnType(i)); out.writeLong(result.getColumnPrecision(i)); out.writeInt(result.getColumnScale(i)); out.writeInt(result.getDisplaySize(i)); out.writeBoolean(result.isAutoIncrement(i)); out.writeInt(result.getNullable(i)); }