/** * Gets the Java class name of the object that will be returned * if ResultSet.getObject is called. * * @param column the column index (1,2,...) * @return the Java class name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnClassName(int column) throws SQLException { try { debugCodeCall("getColumnClassName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the data type name of a column. * * @param column the column index (1,2,...) * @return the data type name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the data type of a column. * See also java.sql.Type. * * @param column the column index (1,2,...) * @return the data type * @throws SQLException if the result set is closed or invalid */ @Override public int getColumnType(int column) throws SQLException { try { debugCodeCall("getColumnType", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.convertTypeToSQLType(type); } catch (Exception e) { throw logAndConvert(e); } }
/** * Re-reads a row from the database and updates the values in the array. * * @param row the values that contain the key * @return the row */ public Value[] readRow(Value[] row) throws SQLException { StatementBuilder buff = new StatementBuilder("SELECT "); appendColumnList(buff, false); buff.append(" FROM "); appendTableName(buff); appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); setKey(prep, 1, row); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw DbException.get(ErrorCode.NO_DATA_AVAILABLE); } Value[] newRow = new Value[columnCount]; for (int i = 0; i < columnCount; i++) { int type = result.getColumnType(i); newRow[i] = DataType.readValue(conn.getSession(), rs, i + 1, type); } return newRow; }
return getValueSlow(rows, l); int dataType = rows.getColumnType(0); if (dataType == Value.NULL) { return ValueBoolean.FALSE;
/** * 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)); }
private Value[] readRow(Value[] row) throws SQLException { StringBuffer buff = new StringBuffer(); buff.append("SELECT "); appendColumnList(buff, false); buff.append(" FROM "); appendTableName(buff); appendKeyCondition(buff); PreparedStatement prep = conn.prepareStatement(buff.toString()); setKey(prep, 1, row); ResultSet rs = prep.executeQuery(); if (!rs.next()) { throw Message.getSQLException(ErrorCode.NO_DATA_AVAILABLE); } Value[] newRow = new Value[columnCount]; for (int i = 0; i < columnCount; i++) { int type = result.getColumnType(i); newRow[i] = DataType.readValue(session, rs, i + 1, type); } return newRow; }
/** * Returns the data type of a column. * * @param column the column index (1,2,...) * @return the data type * @throws SQLException if the result set is closed or invalid */ public int getColumnType(int column) throws SQLException { try { debugCodeCall("getColumnType", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.convertTypeToSQLType(type); } catch (Throwable e) { throw logAndConvert(e); } }
/** * Returns the data type name of a column. * * @param column the column index (1,2,...) * @return the data type name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
/** * Gets the Java class name of the object that will be returned * if ResultSet.getObject is called. * * @param column the column index (1,2,...) * @return the Java class name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnClassName(int column) throws SQLException { try { debugCodeCall("getColumnClassName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the data type name of a column. * * @param column the column index (1,2,...) * @return the data type * @throws SQLException if the result set is closed or invalid */ public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Throwable e) { throw logAndConvert(e); } }
/** * Gets the Java class name of the object that will be returned * if ResultSet.getObject is called. * * @param column the column index (1,2,...) * @return the Java class name * @throws SQLException if the result set is closed or invalid */ public String getColumnClassName(int column) throws SQLException { try { debugCodeCall("getColumnClassName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getTypeClassName(type); } catch (Throwable e) { throw logAndConvert(e); } }
/** * Returns the data type name of a column. * * @param column the column index (1,2,...) * @return the data type name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnTypeName(int column) throws SQLException { try { debugCodeCall("getColumnTypeName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getDataType(type).name; } catch (Exception e) { throw logAndConvert(e); } }
/** * Gets the Java class name of the object that will be returned * if ResultSet.getObject is called. * * @param column the column index (1,2,...) * @return the Java class name * @throws SQLException if the result set is closed or invalid */ @Override public String getColumnClassName(int column) throws SQLException { try { debugCodeCall("getColumnClassName", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.getTypeClassName(type); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the data type of a column. * See also java.sql.Type. * * @param column the column index (1,2,...) * @return the data type * @throws SQLException if the result set is closed or invalid */ @Override public int getColumnType(int column) throws SQLException { try { debugCodeCall("getColumnType", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.convertTypeToSQLType(type); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the data type of a column. * See also java.sql.Type. * * @param column the column index (1,2,...) * @return the data type * @throws SQLException if the result set is closed or invalid */ @Override public int getColumnType(int column) throws SQLException { try { debugCodeCall("getColumnType", column); checkColumnIndex(column); int type = result.getColumnType(--column); return DataType.convertTypeToSQLType(type); } 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; }
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)); }