📄 simpletextresultset.java
字号:
// getFloat - JDBC API // Get the value of a column in the current row as a Java float. // // columnIndex the first column is 1, the second is 2, ... // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public float getFloat( int columnIndex) throws SQLException { // We could coerce the data, but for now an exception is thrown throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // getDouble - JDBC API // Get the value of a column in the current row as a Java double. // // columnIndex the first column is 1, the second is 2, ... // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public double getDouble( int columnIndex) throws SQLException { // We could coerce the data, but for now an exception is thrown throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // getBigDecimal - JDBC API // Get the value of a column in the current row as a java.math.BigDecimal // object. // // columnIndex the first column is 1, the second is 2, ... // scale the number of digits to the right of the decimal // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public java.math.BigDecimal getBigDecimal( int columnIndex, int scale) throws SQLException { String s = getString(columnIndex); java.math.BigDecimal d = null; if (s != null) { java.math.BigInteger i = new java.math.BigInteger(s); d = new java.math.BigDecimal (i, scale); } return d; } //------------------------------------------------------------------------ // getBytes - JDBC API // Get the value of a column in the current row as a Java byte array. // The bytes represent the raw values returned by the driver. // // columnIndex the first column is 1, the second is 2, ... // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public byte[] getBytes( int columnIndex) throws SQLException { // Verify the column verify(columnIndex); byte b[] = null; if (inMemoryRows != null) { b = (getColumn(rowNum, columnIndex)).getBytes(); } else { CommonValue value = getValue(columnIndex); if (value != null) { b = value.getBytes(); } } if (b == null) { lastNull = true; } return b; } //------------------------------------------------------------------------ // getDate - JDBC API // Get the value of a column in the current row as a java.sql.Date object. // // columnIndex the first column is 1, the second is 2, ... // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public java.sql.Date getDate( int columnIndex) throws SQLException { // We could coerce the data, but for now an exception is thrown throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // getTime - JDBC API // Get the value of a column in the current row as a java.sql.Time object. // // columnIndex the first column is 1, the second is 2, ... // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public java.sql.Time getTime( int columnIndex) throws SQLException { // We could coerce the data, but for now an exception is thrown throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // getTimestamp - JDBC API // Get the value of a column in the current row as a java.sql.Timestamp // object. // // columnIndex the first column is 1, the second is 2, ... // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public java.sql.Timestamp getTimestamp( int columnIndex) throws SQLException { // We could coerce the data, but for now an exception is thrown throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // A column value can be retrieved as a stream of ASCII characters // and then read in chunks from the stream. This method is particularly // suitable for retrieving large LONGVARCHAR values. The JDBC driver will // do any necessary conversion from the database format into ASCII. // // Note: All the data in the returned stream must // be read prior to getting the value of any other column. The // next call to a get method implicitly closes the stream. // // columnIndex the first column is 1, the second is 2, ... // // Returns a Java input stream that delivers the database column value // as a stream of one byte ASCII characters. If the value is SQL NULL // then the result is null. //------------------------------------------------------------------------ public java.io.InputStream getAsciiStream( int columnIndex) throws SQLException { // Binary InputStreams are the only InputStream types supported throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // getUnicodeStream - JDBC API // A column value can be retrieved as a stream of Unicode characters // and then read in chunks from the stream. This method is particularly // suitable for retrieving large LONGVARCHAR values. The JDBC driver will // do any necessary conversion from the database format into Unicode. // // Note: All the data in the returned stream must // be read prior to getting the value of any other column. The // next call to a get method implicitly closes the stream. // // columnIndex the first column is 1, the second is 2, ... // // Returns a Java input stream that delivers the database column value // as a stream of two byte Unicode characters. If the value is SQL NULL // then the result is null. //------------------------------------------------------------------------ public java.io.InputStream getUnicodeStream( int columnIndex) throws SQLException { // Binary InputStreams are the only InputStream types supported throw DataTypeNotSupported(); } //------------------------------------------------------------------------ // getBinaryStream - JDBC API // A column value can be retrieved as a stream of uninterpreted bytes // and then read in chunks from the stream. This method is particularly // suitable for retrieving large LONGVARBINARY values. // // Note: All the data in the returned stream must // be read prior to getting the value of any other column. The // next call to a get method implicitly closes the stream. // // columnIndex the first column is 1, the second is 2, ... // // Returns a Java input stream that delivers the database column value // as a stream of uninterpreted bytes. If the value is SQL NULL // then the result is null. //------------------------------------------------------------------------ public java.io.InputStream getBinaryStream( int columnIndex) throws SQLException { // Verify the column verify(columnIndex); CommonValue value = null; if (inMemoryRows != null) { value = getColumn(rowNum, columnIndex); } else { value = getValue(columnIndex); } int length = -1; // Get the length, if possible if (value != null) { byte b[] = value.getBytes(); if (b != null) { length = b.length; } } SimpleTextInputStream inputStream = new SimpleTextInputStream( value, SimpleTextInputStream.STREAM_TYPE_BINARY, length); return inputStream; } //====================================================================== // Methods for accessing results by column name //====================================================================== //------------------------------------------------------------------------ // getString - JDBC API // Get the value of a column in the current row as a Java String. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public String getString( String columnName) throws SQLException { return getString(findColumn(columnName)); } //------------------------------------------------------------------------ // getBoolean - JDBC API // Get the value of a column in the current row as a Java boolean. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is false //------------------------------------------------------------------------ public boolean getBoolean( String columnName) throws SQLException { return getBoolean(findColumn(columnName)); } //------------------------------------------------------------------------ // getByte - JDBC API // Get the value of a column in the current row as a Java byte. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public byte getByte( String columnName) throws SQLException { return getByte(findColumn(columnName)); } //------------------------------------------------------------------------ // getShort - JDBC API // Get the value of a column in the current row as a Java short. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public short getShort( String columnName) throws SQLException { return getShort(findColumn(columnName)); } //------------------------------------------------------------------------ // getInt - JDBC API // Get the value of a column in the current row as a Java int. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public int getInt( String columnName) throws SQLException { return getInt(findColumn(columnName)); } //------------------------------------------------------------------------ // getLong - JDBC API // Get the value of a column in the current row as a Java long. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public long getLong( String columnName) throws SQLException { return getLong(findColumn(columnName)); } //------------------------------------------------------------------------ // getFloat - JDBC API // Get the value of a column in the current row as a Java float. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public float getFloat( String columnName) throws SQLException { return getFloat(findColumn(columnName)); } //------------------------------------------------------------------------ // getDouble - JDBC API // Get the value of a column in the current row as a Java double. // // columnName is the SQL name of the column // // Returns the column value; if the value is SQL NULL the result is 0 //------------------------------------------------------------------------ public double getDouble( String columnName) throws SQLException { return getDouble(findColumn(columnName)); } //------------------------------------------------------------------------ // getBigDecimal - JDBC API // Get the value of a column in the current row as a java.math.BigDecimal // object. // // columnName is the SQL name of the column // scale the number of digits to the right of the decimal // // Returns the column value; if the value is SQL NULL the result is null //------------------------------------------------------------------------ public java.math.BigDecimal getBigDecimal( String columnName,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -