org.firebirdsql.jdbc.AbstractResultSet Maven / Gradle / Ivy
Show all versions of jaybird-jdk15 Show documentation
/* * $Id: AbstractResultSet.java 57878 2013-03-30 15:14:44Z mrotteveel $ * * Firebird Open Source J2ee connector - jdbc driver * * Distributable under LGPL license. * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * LGPL License for more details. * * This file was created by members of the firebird development team. * All individual contributions remain the Copyright (C) of those * individuals. Contributors to this file are either listed here or * can be obtained from a CVS history command. * * All rights reserved. */ package org.firebirdsql.jdbc; import java.io.*; import java.math.*; import java.net.*; import java.sql.*; import java.sql.Date; import java.util.*; import org.firebirdsql.gds.*; import org.firebirdsql.gds.impl.AbstractIscStmtHandle; import org.firebirdsql.gds.impl.GDSHelper; import org.firebirdsql.jdbc.field.*; import org.firebirdsql.util.SQLExceptionChainBuilder; /** * Implementation of {@link ResultSet} interface. * * @author David Jencks * @author Roman Rokytskyy * @author Mark Rotteveel */ public abstract class AbstractResultSet implements ResultSet, FirebirdResultSet, Synchronizable, FBObjectListener.FetcherListener { private AbstractStatement fbStatement; private FBFetcher fbFetcher; private FirebirdRowUpdater rowUpdater; protected GDSHelper gdsHelper; protected XSQLVAR[] xsqlvars; protected byte[][] row; private int maxRows = 0; private boolean wasNull = false; private boolean wasNullValid = false; // closed is false until the close method is invoked; private volatile boolean closed = false; //might be a bit of a kludge, or a useful feature. private boolean trimStrings; private SQLWarning firstWarning = null; private FBField[] fields = null; private java.util.HashMap colNames = new java.util.HashMap(); private String cursorName; private FBObjectListener.ResultSetListener listener; private int rsType = ResultSet.TYPE_FORWARD_ONLY; private int rsConcurrency = ResultSet.CONCUR_READ_ONLY; private int rsHoldability = ResultSet.CLOSE_CURSORS_AT_COMMIT; /* (non-Javadoc) * @see org.firebirdsql.jdbc.FBObjectListener.FetcherListener#allRowsFetched(org.firebirdsql.jdbc.FBFetcher) */ public void allRowsFetched(FBFetcher fetcher) throws SQLException { // notify our listener that all rows were fetched. listener.allRowsFetched(this); } /* (non-Javadoc) * @see org.firebirdsql.jdbc.FBObjectListener.FetcherListener#fetcherClosed(org.firebirdsql.jdbc.FBFetcher) */ public void fetcherClosed(FBFetcher fetcher) throws SQLException { // ignore, there nothing to do here } /* (non-Javadoc) * @see org.firebirdsql.jdbc.FBObjectListener.FetcherListener#rowChanged(org.firebirdsql.jdbc.FBFetcher, byte[][]) */ public void rowChanged(FBFetcher fetcher, byte[][] newRow) throws SQLException { this.row = newRow; } /** * Creates a new
previous() when there is no current row. * * @returnFBResultSet
instance. * * @param gdsHelper aAbstractConnection
value * @param fbStatement aAbstractStatement
value * @param stmt anisc_stmt_handle
value */ protected AbstractResultSet(GDSHelper gdsHelper, AbstractStatement fbStatement, AbstractIscStmtHandle stmt, FBObjectListener.ResultSetListener listener, boolean metaDataQuery, int rsType, int rsConcurrency, int rsHoldability, boolean cached) throws SQLException { this.gdsHelper = gdsHelper; this.cursorName = fbStatement.getCursorName(); this.listener = listener; this.rsType = rsType; this.rsConcurrency = rsConcurrency; this.rsHoldability = rsHoldability; this.trimStrings = metaDataQuery; this.xsqlvars = stmt.getOutSqlda().sqlvar; this.maxRows = fbStatement.getMaxRows(); this.fbStatement = fbStatement; boolean updatableCursor = fbStatement.isUpdatableCursor(); if (rsType != ResultSet.TYPE_FORWARD_ONLY || metaDataQuery) cached = true; if (cached) { prepareVars(true); fbFetcher = new FBCachedFetcher(gdsHelper, fbStatement.fetchSize, fbStatement.maxRows, stmt, this, rsType == ResultSet.TYPE_FORWARD_ONLY); } else { prepareVars(false); if (rsType == ResultSet.TYPE_SCROLL_SENSITIVE) { fbStatement.addWarning(new FBSQLWarning( "Result set type changed. " + "ResultSet.TYPE_SCROLL_SENSITIVE is not supported.")); rsType = ResultSet.TYPE_SCROLL_INSENSITIVE; } if (updatableCursor) fbFetcher = new FBUpdatableCursorFetcher(gdsHelper, fbStatement, stmt, this, fbStatement.getMaxRows(), fbStatement.getFetchSize()); else fbFetcher = new FBStatementFetcher(gdsHelper, fbStatement, stmt, this, fbStatement.getMaxRows(), fbStatement.getFetchSize()); } if (rsConcurrency == ResultSet.CONCUR_UPDATABLE) { try { rowUpdater = new FBRowUpdater(gdsHelper, xsqlvars, this, cached, listener); } catch (FBResultSetNotUpdatableException ex) { fbStatement.addWarning(new FBSQLWarning( "Result set concurrency changed to READ ONLY.")); rsConcurrency = ResultSet.CONCUR_READ_ONLY; } } } protected AbstractResultSet(XSQLVAR[] xsqlvars, ArrayList rows) throws SQLException { maxRows = 0; fbFetcher = new FBCachedFetcher(rows,this); this.xsqlvars = xsqlvars; prepareVars(true); } private void prepareVars(boolean cached) throws SQLException { fields = new FBField[xsqlvars.length]; colNames = new HashMap(xsqlvars.length,1); for (int i=0; ichain = new SQLExceptionChainBuilder (); // close current fields, so that resources are freed. for(int i = 0; i < fields.length; i++) { try { fields[i].close(); } catch (SQLException ex) { chain.append(ex); } } if (chain.hasException()) { throw chain.getException(); } } /* (non-Javadoc) * @see org.firebirdsql.jdbc.Synchronizable#getSynchronizationObject() */ public Object getSynchronizationObject() throws SQLException { return fbStatement.getSynchronizationObject(); } /** * Moves the cursor down one row from its current position. * A ResultSet
cursor is initially positioned * before the first row; the first call to the method *next
makes the first row the current row; the * second call makes the second row the current row, and so on. * *If an input stream is open for the current row, a call * to the method
next
will * implicitly close it. AResultSet
object's * warning chain is cleared when a new row is read. * * @returntrue
if the new current row is valid; *false
if there are no more rows * @exception SQLException if a database access error occurs */ public boolean next() throws SQLException { checkCursorMove(); boolean result = fbFetcher.next(); if (result) notifyRowUpdater(); return result; } /** * Releases thisResultSet
object's database and * JDBC resources immediately instead of waiting for * this to happen when it is automatically closed. * *Note: A
ResultSet
object * is automatically closed by the *Statement
object that generated it when * thatStatement
object is closed, * re-executed, or is used to retrieve the next result from a * sequence of multiple results. AResultSet
object * is also automatically closed when it is garbage collected. * * @exception SQLException if a database access error occurs */ public void close() throws SQLException { close(true); } public boolean isClosed() throws SQLException { return closed; } void close(boolean notifyListener) throws SQLException { if (isClosed()) return; closed = true; SQLExceptionChainBuilderchain = new SQLExceptionChainBuilder (); try { closeFields(); } catch (SQLException ex) { chain.append(ex); } finally { try { if (fbFetcher != null) { try { fbFetcher.close(); } catch (SQLException ex) { chain.append(ex); } } if (rowUpdater != null) { try { rowUpdater.close(); } catch (SQLException ex) { chain.append(ex); } } if (notifyListener && listener != null) { try { listener.resultSetClosed(this); } catch (SQLException ex) { chain.append(ex); } } } finally { fbFetcher = null; rowUpdater = null; } } if (chain.hasException()) { throw chain.getException(); } } /** * Reports whether * the last column read had a value of SQL NULL
. * Note that you must first call one of thegetXXX
methods * on a column to try to read its value and then call * the methodwasNull
to see if the value read was * SQLNULL
. * * @returntrue
if the last column value read was SQL *NULL
andfalse
otherwise * @exception SQLException if a database access error occurs */ public boolean wasNull() throws SQLException { if (!wasNullValid) { throw new FBSQLException("Look at a column before testing null."); } if (row == null) { throw new FBSQLException("No row available for wasNull."); } return wasNull; } /** * Retrieves the value of the designated column in the current row of this * ResultSet object as a stream of ASCII characters. The value can then be * read in chunks from the stream. This method is particularly suitable * for retrieving large LONGVARCHAR values. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return a stream of ascii characters * @throws SQLException if this parameter cannot be retrieved as an ASCII * stream */ public InputStream getAsciiStream(int columnIndex) throws SQLException { return getField(columnIndex).getAsciiStream(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as a BigDecimal object. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return The value of the field as a BigDecimal * @throws SQLException if this paramater cannot be retrieved as * a BigDecimal */ public BigDecimal getBigDecimal(int columnIndex) throws SQLException { return getField(columnIndex).getBigDecimal(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as a binary InputStream. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return The value of the field as a binary input stream * @throws SQLException if this paramater cannot be retrieved as * a binary InputStream */ public InputStream getBinaryStream(int columnIndex) throws SQLException { return getField(columnIndex).getBinaryStream(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as a Blob object. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return The value of the field as a Blob object * @throws SQLException if this paramater cannot be retrieved as * a Blob */ public Blob getBlob(int columnIndex) throws SQLException { return getField(columnIndex).getBlob(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as aboolean
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Theboolean
value of the field * @throws SQLException if this paramater cannot be retrieved as * aboolean
*/ public boolean getBoolean(int columnIndex) throws SQLException { return getField(columnIndex).getBoolean(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as abyte
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Thebyte
value of the field * @throws SQLException if this paramater cannot be retrieved as * abyte
*/ public byte getByte(int columnIndex) throws SQLException { return getField(columnIndex).getByte(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as abyte
array. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Thebyte
array value of the field * @throws SQLException if this paramater cannot be retrieved as * abyte
array */ public byte[] getBytes(int columnIndex) throws SQLException { return getField(columnIndex).getBytes(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as aDate
object. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return TheDate
object of the field * @throws SQLException if this paramater cannot be retrieved as * aDate
object */ public Date getDate(int columnIndex) throws SQLException { return getField(columnIndex).getDate(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as adouble
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Thedouble
value of the field * @throws SQLException if this paramater cannot be retrieved as * adouble
*/ public double getDouble(int columnIndex) throws SQLException { return getField(columnIndex).getDouble(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as afloat
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Thefloat
value of the field * @throws SQLException if this paramater cannot be retrieved as * afloat
*/ public float getFloat(int columnIndex) throws SQLException { return getField(columnIndex).getFloat(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as anint
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Theint
value of the field * @throws SQLException if this paramater cannot be retrieved as * anint
*/ public int getInt(int columnIndex) throws SQLException { return getField(columnIndex).getInt(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as along
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Thelong
value of the field * @throws SQLException if this paramater cannot be retrieved as * along
*/ public long getLong(int columnIndex) throws SQLException { return getField(columnIndex).getLong(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as anObject
. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return TheObject
representation of the field * @throws SQLException if this paramater cannot be retrieved as * anObject
*/ public Object getObject(int columnIndex) throws SQLException { return getField(columnIndex).getObject(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as ashort
value. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return Theshort
value of the field * @throws SQLException if this paramater cannot be retrieved as * ashort
*/ public short getShort(int columnIndex) throws SQLException { return getField(columnIndex).getShort(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as aString
object. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return TheString
representation of the field * @throws SQLException if this paramater cannot be retrieved as * aString
*/ public String getString(int columnIndex) throws SQLException { if (trimStrings) { String result = getField(columnIndex).getString(); return result != null ? result.trim() : null; } else return getField(columnIndex).getString(); } public String getNString(int columnIndex) throws SQLException { throw new FBDriverNotCapableException(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as aTime
object. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return TheTime
representation of the field * @throws SQLException if this paramater cannot be retrieved as * aTime
object */ public Time getTime(int columnIndex) throws SQLException { return getField(columnIndex).getTime(); } /** * Retrieve the value of the designated column in the current row of * this ResultSet as aTimestamp
object. * * @param columnIndex The index of the parameter to retrieve, first * parameter is 1, second is 2, ... * @return TheTimestamp
representation of the field * @throws SQLException if this paramater cannot be retrieved as * aTimestamp
object */ public Timestamp getTimestamp(int columnIndex) throws SQLException { return getField(columnIndex).getTimestamp(); } /** * @deprecated */ public InputStream getUnicodeStream(int columnIndex) throws SQLException { return getField(columnIndex).getUnicodeStream(); } public Reader getNCharacterStream(int columnIndex) throws SQLException { throw new FBDriverNotCapableException(); } /** * Returns the XSQLVAR structure for the specified column. */ protected XSQLVAR getXsqlvar(int columnIndex) { return xsqlvars[columnIndex - 1]; } /** * Get theFBField
object at the given column index * * @param columnIndex The index of the parameter, 1 is the first index * @throws SQLException If there is an error accessing the field */ public FBField getField(int columnIndex) throws SQLException { FBField field = getField(columnIndex, true); wasNullValid = true; // wasNull = field.isNull(); if (row != null) wasNull = (row[columnIndex - 1] == null); else wasNull = true; return field; } /** * Factory method for the field access objects */ public FBField getField(int columnIndex, boolean checkRowPosition) throws SQLException { if (isClosed()) throw new FBSQLException("The resultSet is closed"); if (checkRowPosition && row == null && rowUpdater == null) throw new FBSQLException( "The resultSet is not in a row, use next", FBSQLException.SQL_STATE_NO_ROW_AVAIL); if (columnIndex > xsqlvars.length) throw new FBSQLException( "Invalid column index.", FBSQLException.SQL_STATE_INVALID_COLUMN); if (rowUpdater != null) return rowUpdater.getField(columnIndex - 1); else return fields[columnIndex-1]; } /** * Get aFBField
by name. * * @param columnName The name of the field to be retrieved * @throws SQLException if the field cannot be retrieved */ public FBField getField(String columnName) throws SQLException { if (isClosed()) throw new FBSQLException("The resultSet is closed"); if (row == null && rowUpdater == null) throw new FBSQLException( "The resultSet is not in a row, use next", FBSQLException.SQL_STATE_NO_ROW_AVAIL); if (columnName == null) { throw new FBSQLException( "Column identifier must be not null.", FBSQLException.SQL_STATE_INVALID_COLUMN); } Integer fieldNum = (Integer) colNames.get(columnName); // If it is the first time the columnName is used if (fieldNum == null){ int colNum = findColumn(columnName); fieldNum = new Integer(colNum); colNames.put(columnName, fieldNum); } int colNum = fieldNum.intValue(); FBField field = rowUpdater != null ? rowUpdater.getField(colNum - 1) : fields[colNum - 1]; wasNullValid = true; wasNull = (row != null ? row[colNum - 1] == null : true); return field; } /** * Gets the value of the designated column in the current row * of thisResultSet
object as * ajava.math.BigDecimal
in the Java programming language. * * @param columnIndex the first column is 1, the second is 2, ... * @param scale the number of digits to the right of the decimal point * @return the column value; if the value is SQLNULL
, the * value returned isnull
* @exception SQLException if a database access error occurs * @deprecated */ public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { return getField(columnIndex).getBigDecimal(scale); } //====================================================================== // Methods for accessing results by column name //====================================================================== /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as aString
. * * @param columnName The SQL name of the column * @throws SQLException if the given column cannot be retrieved */ public String getString(String columnName) throws SQLException { if (trimStrings) { String result = getField(columnName).getString(); return result != null ? result.trim() : null; } else return getField(columnName).getString(); } public String getNString(String columnLabel) throws SQLException { throw new FBDriverNotCapableException(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as aboolean
value. * * @param columnName The SQL name of the column * @return TheString
value * @throws SQLException if the given column cannot be retrieved */ public boolean getBoolean(String columnName) throws SQLException { return getField(columnName).getBoolean(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as abyte
value. * * @param columnName The SQL name of the column * @return Thebyte
value * @throws SQLException if the given column cannot be retrieved */ public byte getByte(String columnName) throws SQLException { return getField(columnName).getByte(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as ashort
value. * * @param columnName The SQL name of the column * @return THeshort
value * @throws SQLException if the given column cannot be retrieved */ public short getShort(String columnName) throws SQLException { return getField(columnName).getShort(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as anint
value. * * @param columnName The SQL name of the column * @return Theint
value * @throws SQLException if the given column cannot be retrieved */ public int getInt(String columnName) throws SQLException { return getField(columnName).getInt(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as along
value. * * @param columnName The SQL name of the column * @return Thelong
value * @throws SQLException if the given column cannot be retrieved */ public long getLong(String columnName) throws SQLException { return getField(columnName).getLong(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as afloat
value. * * @param columnName The SQL name of the column * @return Thefloat
value * @throws SQLException if the given column cannot be retrieved */ public float getFloat(String columnName) throws SQLException { return getField(columnName).getFloat(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as adouble
value. * * @param columnName The SQL name of the column * @return Thedouble
value * @throws SQLException if the given column cannot be retrieved */ public double getDouble(String columnName) throws SQLException { return getField(columnName).getDouble(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as aBigDecimal
. * * @param columnName The SQL name of the column * @return TheBigDecimal
value * @throws SQLException if the given column cannot be retrieved * @deprecated */ public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { return getField(columnName).getBigDecimal(scale); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as abyte
array. * * @param columnName The SQL name of the column * @return Thebyte
array value * @throws SQLException if the given column cannot be retrieved */ public byte[] getBytes(String columnName) throws SQLException { return getField(columnName).getBytes(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as aDate
. * * @param columnName The SQL name of the column * @return TheDate
value * @throws SQLException if the given column cannot be retrieved */ public Date getDate(String columnName) throws SQLException { return getField(columnName).getDate(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as aTime
object. * * @param columnName The SQL name of the column * @return TheTime
value * @throws SQLException if the given column cannot be retrieved */ public Time getTime(String columnName) throws SQLException { return getField(columnName).getTime(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as aTimestamp
object. * * @param columnName The SQL name of the column * @return TheTimestamp
value * @throws SQLException if the given column cannot be retrieved */ public Timestamp getTimestamp(String columnName) throws SQLException { return getField(columnName).getTimestamp(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as anInputStream
. * * @param columnName The SQL name of the column * @return The value as anInputStream
* @throws SQLException if the given column cannot be retrieved */ public InputStream getAsciiStream(String columnName) throws SQLException { return getField(columnName).getAsciiStream(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as a unicodeInputStream
. * * @param columnName The SQL name of the column * @return The value as a unicodeInputStream
* @throws SQLException if the given column cannot be retrieved * @deprecated */ public InputStream getUnicodeStream(String columnName) throws SQLException { return getField(columnName).getUnicodeStream(); } public Reader getNCharacterStream(String columnLabel) throws SQLException { throw new FBDriverNotCapableException(); } /** * Retrieves the value of the designated column in the current row of this *ResultSet
object as a binaryInputStream
. * * @param columnName The SQL name of the column * @return The value as a binaryInputStream
* @throws SQLException if the given column cannot be retrieved */ public InputStream getBinaryStream(String columnName) throws SQLException { return getField(columnName).getBinaryStream(); } //===================================================================== // Advanced features: //===================================================================== /** * Returns the first warning reported by calls on this *ResultSet
object. * Subsequent warnings on thisResultSet
object * will be chained to theSQLWarning
object that * this method returns. * *The warning chain is automatically cleared each time a new * row is read. * *
Note: This warning chain only covers warnings caused * by
ResultSet
methods. Any warning caused by *Statement
methods * (such as reading OUT parameters) will be chained on the *Statement
object. * * @return the firstSQLWarning
object reported ornull
* @exception SQLException if a database access error occurs */ public SQLWarning getWarnings() throws SQLException { return firstWarning; } /** * Clears all warnings reported on thisResultSet
object. * After this method is called, the methodgetWarnings
* returnsnull
until a new warning is * reported for thisResultSet
object. * * @exception SQLException if a database access error occurs */ public void clearWarnings() throws SQLException { firstWarning = null; } /** * Gets the name of the SQL cursor used by thisResultSet
* object. * *In SQL, a result table is retrieved through a cursor that is * named. The current row of a result set can be updated or deleted * using a positioned update/delete statement that references the * cursor name. To insure that the cursor has the proper isolation * level to support update, the cursor's
select
statement should be * of the form 'select for update'. If the 'for update' clause is * omitted, the positioned updates may fail. * *The JDBC API supports this SQL feature by providing the name of the * SQL cursor used by a
ResultSet
object. * The current row of aResultSet
object * is also the current row of this SQL cursor. * *Note: If positioned update is not supported, a *
SQLException
is thrown. * * @return the SQL name for thisResultSet
object's cursor * @exception SQLException if a database access error occurs */ public String getCursorName() throws SQLException { return cursorName; } /** * Retrieves the number, types and properties of * thisResultSet
object's columns. * * @return the description of thisResultSet
object's columns * @exception SQLException if a database access error occurs * * TODO we need another way of specifying the exended metadata if * this result set is constructed in code. */ public ResultSetMetaData getMetaData() throws SQLException { return new FBResultSetMetaData(xsqlvars, gdsHelper); } /** *Gets the value of the designated column in the current row * of this
ResultSet
object as * anObject
in the Java programming language. * *This method will return the value of the given column as a * Java object. The type of the Java object will be the default * Java object type corresponding to the column's SQL type, * following the mapping for built-in types specified in the JDBC * specification. * *
This method may also be used to read datatabase-specific * abstract data types. * * In the JDBC 2.0 API, the behavior of the method *
getObject
is extended to materialize * data of SQL user-defined types. When a column contains * a structured or distinct value, the behavior of this method is as * if it were a call to:getObject(columnIndex, * this.getStatement().getConnection().getTypeMap())
. * * @param columnName the SQL name of the column * @return ajava.lang.Object
holding the column value * @exception SQLException if a database access error occurs */ public Object getObject(String columnName) throws SQLException { return getField(columnName).getObject(); } //---------------------------------------------------------------- /** * Maps the givenResultSet
column name to its *ResultSet
column index. * * @param columnName the name of the column * @return the column index of the given column name * @exception SQLException if a database access error occurs */ // See section 14.2.3 of jdbc-3.0 specification // "Column names supplied to getter methods are case insensitive // If a select list contains the same column more than once, // the first instance of the column will be returned public int findColumn(String columnName) throws SQLException { if (columnName == null || columnName.equals("")) { throw new FBSQLException( "Empty string does not identify column.", FBSQLException.SQL_STATE_INVALID_COLUMN); } if (columnName.startsWith("\"") && columnName.endsWith("\"")) { columnName = columnName.substring(1, columnName.length() - 1); // case-sensitively check column aliases for (int i = 0; i< xsqlvars.length; i++) { if (columnName.equals(xsqlvars[i].aliasname)) { return ++i; } } // case-sensitively check column names for (int i = 0; i< xsqlvars.length; i++) { if (columnName.equals(xsqlvars[i].sqlname)) { return ++i; } } } else { for (int i = 0; i< xsqlvars.length; i++) { if (columnName.equalsIgnoreCase(xsqlvars[i].aliasname)) { return ++i; } } for (int i = 0; i< xsqlvars.length; i++) { if (columnName.equalsIgnoreCase(xsqlvars[i].sqlname)) { return ++i; } } } throw new FBSQLException( "Column name " + columnName + " not found in result set.", FBSQLException.SQL_STATE_INVALID_COLUMN); } //--------------------------JDBC 2.0----------------------------------- //--------------------------------------------------------------------- // Getters and Setters //--------------------------------------------------------------------- /** * Gets the value of the designated column in the current row * of thisResultSet
object as a *java.io.Reader
object. * @return ajava.io.Reader
object that contains the column * value; if the value is SQLNULL
, the value returned is *null
in the Java programming language. * @param columnIndex the first column is 1, the second is 2, ... * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Reader getCharacterStream(int columnIndex) throws SQLException { return getField(columnIndex).getCharacterStream(); } /** * Gets the value of the designated column in the current row * of thisResultSet
object as a *java.io.Reader
object. * * @param columnName the name of the column * @return ajava.io.Reader
object that contains the column * value; if the value is SQLNULL
, the value returned is *null
in the Java programming language. * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Reader getCharacterStream(String columnName) throws SQLException { return getField(columnName).getCharacterStream(); } /** * Gets the value of the designated column in the current row * of thisResultSet
object as a *java.math.BigDecimal
with full precision. * * @param columnName the column name * @return the column value (full precision); * if the value is SQLNULL
, the value returned is *null
in the Java programming language. * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API * */ public BigDecimal getBigDecimal(String columnName) throws SQLException { return getField(columnName).getBigDecimal(); } //--------------------------------------------------------------------- // Traversal/Positioning //--------------------------------------------------------------------- /** * Indicates whether the cursor is before the first row in * thisResultSet
object. * * @returntrue
if the cursor is before the first row; *false
if the cursor is at any other position or the * result set contains no rows * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean isBeforeFirst() throws SQLException { return fbFetcher.isBeforeFirst(); } /** * Indicates whether the cursor is after the last row in * thisResultSet
object. * * @returntrue
if the cursor is after the last row; *false
if the cursor is at any other position or the * result set contains no rows * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean isAfterLast() throws SQLException { return fbFetcher.isAfterLast(); } /** * Indicates whether the cursor is on the first row of * thisResultSet
object. * * @returntrue
if the cursor is on the first row; *false
otherwise * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean isFirst() throws SQLException { return fbFetcher.isFirst(); } /** * Indicates whether the cursor is on the last row of * thisResultSet
object. * Note: Calling the methodisLast
may be expensive * because the JDBC driver * might need to fetch ahead one row in order to determine * whether the current row is the last row in the result set. * * @returntrue
if the cursor is on the last row; *false
otherwise * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean isLast() throws SQLException { return fbFetcher.isLast(); } /** * Moves the cursor to the front of * thisResultSet
object, just before the * first row. This method has no effect if the result set contains no rows. * * @exception SQLException if a database access error * occurs or the result set type isTYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void beforeFirst() throws SQLException { checkCursorMove(); fbFetcher.beforeFirst(); notifyRowUpdater(); } /** * Moves the cursor to the end of * thisResultSet
object, just after the * last row. This method has no effect if the result set contains no rows. * @exception SQLException if a database access error * occurs or the result set type isTYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void afterLast() throws SQLException { checkCursorMove(); fbFetcher.afterLast(); notifyRowUpdater(); } /** * Moves the cursor to the first row in * thisResultSet
object. * * @returntrue
if the cursor is on a valid row; *false
if there are no rows in the result set * @exception SQLException if a database access error * occurs or the result set type isTYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean first() throws SQLException { checkCursorMove(); boolean result = fbFetcher.first(); if (result) notifyRowUpdater(); return result; } /** * Moves the cursor to the last row in * thisResultSet
object. * * @returntrue
if the cursor is on a valid row; *false
if there are no rows in the result set * @exception SQLException if a database access error * occurs or the result set type isTYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean last() throws SQLException { checkCursorMove(); boolean result = fbFetcher.last(); if (result) notifyRowUpdater(); return result; } /** * Retrieves the current row number. The first row is number 1, the * second number 2, and so on. * * @return the current row number;0
if there is no current row * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public int getRow() throws SQLException { return fbFetcher.getRowNum(); } /** * Moves the cursor to the given row number in * thisResultSet
object. * *If the row number is positive, the cursor moves to * the given row number with respect to the * beginning of the result set. The first row is row 1, the second * is row 2, and so on. * *
If the given row number is negative, the cursor moves to * an absolute row position with respect to * the end of the result set. For example, calling the method *
absolute(-1)
positions the * cursor on the last row; calling the methodabsolute(-2)
* moves the cursor to the next-to-last row, and so on. * *An attempt to position the cursor beyond the first/last row in * the result set leaves the cursor before the first row or after * the last row. * *
Note: Calling
absolute(1)
is the same * as callingfirst()
. Callingabsolute(-1)
* is the same as callinglast()
. * * @returntrue
if the cursor is on the result set; *false
otherwise * @exception SQLException if a database access error * occurs, the row is0
, or the result set type is *TYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean absolute( int row ) throws SQLException { checkCursorMove(); boolean result = fbFetcher.absolute(row); if (result) notifyRowUpdater(); return result; } /** * Moves the cursor a relative number of rows, either positive or negative. * Attempting to move beyond the first/last row in the * result set positions the cursor before/after the * the first/last row. Callingrelative(0)
is valid, but does * not change the cursor position. * *Note: Calling the method
relative(1)
* is different from calling the methodnext()
* because is makes sense to callnext()
when there * is no current row, * for example, when the cursor is positioned before the first row * or after the last row of the result set. * * @returntrue
if the cursor is on a row; *false
otherwise * @exception SQLException if a database access error occurs, * there is no current row, or the result set type is *TYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean relative( int rows ) throws SQLException { checkCursorMove(); boolean result = fbFetcher.relative(rows); if (result) notifyRowUpdater(); return result; } /** * Moves the cursor to the previous row in this *ResultSet
object. * *Note: Calling the method
previous()
is not the same as * calling the methodrelative(-1)
because it * makes sense to calltrue
if the cursor is on a valid row; *false
if it is off the result set * @exception SQLException if a database access error * occurs or the result set type isTYPE_FORWARD_ONLY
* @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean previous() throws SQLException { checkCursorMove(); boolean result = fbFetcher.previous(); if (result) notifyRowUpdater(); return result; } //--------------------------------------------------------------------- // Properties //--------------------------------------------------------------------- /** * Gives a hint as to the direction in which the rows in this *ResultSet
object will be processed. * The initial value is determined by the *Statement
object * that produced thisResultSet
object. * The fetch direction may be changed at any time. * * @exception SQLException if a database access error occurs or * the result set type isTYPE_FORWARD_ONLY
and the fetch * direction is notFETCH_FORWARD
* @since 1.2 * @see What Is in the JDBC * 2.0 API * @see Statement#setFetchDirection */ public void setFetchDirection(int direction) throws SQLException { if (direction != ResultSet.FETCH_FORWARD) throw new FBDriverNotCapableException("Can't set fetch direction"); } /** * Returns the fetch direction for this *ResultSet
object. * * @return the current fetch direction for thisResultSet
object * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public int getFetchDirection() throws SQLException { return ResultSet.FETCH_FORWARD; } /** * Gives the JDBC driver a hint as to the number of rows that should * be fetched from the database when more rows are needed for this *ResultSet
object. * If the fetch size specified is zero, the JDBC driver * ignores the value and is free to make its own best guess as to what * the fetch size should be. The default value is set by the *Statement
object * that created the result set. The fetch size may be changed at any time. * * @param rows the number of rows to fetch * @exception SQLException if a database access error occurs or the * condition0 <= rows <= this.getMaxRows()
is not satisfied * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void setFetchSize(int rows) throws SQLException { if (rows < 0) throw new FBSQLException("Can't set negative fetch size.", FBSQLException.SQL_STATE_INVALID_ARG_VALUE); else if (maxRows > 0 && rows > maxRows) throw new FBSQLException("Can't set fetch size > maxRows.", FBSQLException.SQL_STATE_INVALID_ARG_VALUE); else fbFetcher.setFetchSize(rows); } /** * * Returns the fetch size for this *ResultSet
object. * * @return the current fetch size for thisResultSet
object * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public int getFetchSize() throws SQLException { return fbFetcher.getFetchSize(); } /** * Returns the type of thisResultSet
object. * The type is determined by theStatement
object * that created the result set. * * @returnTYPE_FORWARD_ONLY
, *TYPE_SCROLL_INSENSITIVE
, * orTYPE_SCROLL_SENSITIVE
* @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public int getType() throws SQLException { return rsType; } /** * Returns the concurrency mode of thisResultSet
object. * The concurrency used is determined by the *Statement
object that created the result set. * * @return the concurrency type, eitherCONCUR_READ_ONLY
* orCONCUR_UPDATABLE
* @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public int getConcurrency() throws SQLException { return rsConcurrency; } /** * Retrieves the holdability of thisResultSet
object * * @return eitherResultSet.HOLD_CURSORS_OVER_COMMIT
or *ResultSet.CLOSE_CURSORS_AT_COMMIT
* * @throws SQLException if a database access error occurs * or this method is called on a closed result set * * @since 1.6 */ public int getHoldability() throws SQLException { return rsHoldability; } //--------------------------------------------------------------------- // Updates //--------------------------------------------------------------------- /** * Indicates whether the current row has been updated. The value returned * depends on whether or not the result set can detect updates. * * @returntrue
if the row has been visibly updated * by the owner or another, and updates are detected * @exception SQLException if a database access error occurs * * @see DatabaseMetaData#updatesAreDetected * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean rowUpdated() throws SQLException { if (rowUpdater != null) return rowUpdater.rowUpdated(); else throw new FBResultSetNotUpdatableException(); } /** * Indicates whether the current row has had an insertion. * The value returned depends on whether or not this *ResultSet
object can detect visible inserts. * * @returntrue
if a row has had an insertion * and insertions are detected;false
otherwise * @exception SQLException if a database access error occurs * * @see DatabaseMetaData#insertsAreDetected * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean rowInserted() throws SQLException { if (rowUpdater != null) return rowUpdater.rowUpdated(); else throw new FBResultSetNotUpdatableException(); } /** * Indicates whether a row has been deleted. A deleted row may leave * a visible "hole" in a result set. This method can be used to * detect holes in a result set. The value returned depends on whether * or not thisResultSet
object can detect deletions. * * @returntrue
if a row was deleted and deletions are detected; *false
otherwise * @exception SQLException if a database access error occurs * * @see DatabaseMetaData#deletesAreDetected * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public boolean rowDeleted() throws SQLException { if (rowUpdater != null) return rowUpdater.rowUpdated(); else throw new FBResultSetNotUpdatableException(); } /** * Gives a nullable column a null value. * * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
* orinsertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateNull(int columnIndex) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setNull(); } /** * Updates the designated column with aboolean
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBoolean(int columnIndex, boolean x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setBoolean(x); } /** * Updates the designated column with abyte
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateByte(int columnIndex, byte x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setByte(x); } /** * Updates the designated column with ashort
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateShort(int columnIndex, short x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setShort(x); } /** * Updates the designated column with anint
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateInt(int columnIndex, int x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setInteger(x); } /** * Updates the designated column with along
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateLong(int columnIndex, long x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setLong(x); } /** * Updates the designated column with afloat
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateFloat(int columnIndex, float x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setFloat(x); } /** * Updates the designated column with adouble
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateDouble(int columnIndex, double x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setDouble(x); } /** * Updates the designated column with ajava.math.BigDecimal
* value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setBigDecimal(x); } /** * Updates the designated column with aString
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateString(int columnIndex, String x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setString(x); } /** * Updates the designated column with abyte
array value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBytes(int columnIndex, byte x[]) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setBytes(x); } /** * Updates the designated column with ajava.sql.Date
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateDate(int columnIndex, Date x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setDate(x); } /** * Updates the designated column with ajava.sql.Time
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateTime(int columnIndex, Time x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setTime(x); } /** * Updates the designated column with ajava.sql.Timestamp
* value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setTimestamp(x); } /** * Updates the designated column with an ascii stream value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @param length the length of the stream * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setAsciiStream(x, length); } /** * Updates the designated column with a binary stream value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @param length the length of the stream * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setBinaryStream(x, length); } public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { throw new FBDriverNotCapableException(); } /** * Updates the designated column with a character stream value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @param length the length of the stream * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setCharacterStream(x, length); } /** * Updates the designated column with anObject
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @param scale forjava.sql.Types.DECIMA
* orjava.sql.Types.NUMERIC
types, * this is the number of digits after the decimal point. For all other * types this value will be ignored. * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateObject(int columnIndex, Object x, int scale) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setObject(x); } /** * Updates the designated column with anObject
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnIndex the first column is 1, the second is 2, ... * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateObject(int columnIndex, Object x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnIndex).setObject(x); } /** * Updates the designated column with anull
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateNull(String columnName) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setNull(); } /** * Updates the designated column with aboolean
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBoolean(String columnName, boolean x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setBoolean(x); } /** * Updates the designated column with abyte
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateByte(String columnName, byte x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setByte(x); } /** * Updates the designated column with ashort
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateShort(String columnName, short x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setShort(x); } /** * Updates the designated column with anint
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateInt(String columnName, int x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setInteger(x); } /** * Updates the designated column with along
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateLong(String columnName, long x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setLong(x); } /** * Updates the designated column with afloat
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateFloat(String columnName, float x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setFloat(x); } /** * Updates the designated column with adouble
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateDouble(String columnName, double x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setDouble(x); } /** * Updates the designated column with ajava.sql.BigDecimal
* value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setBigDecimal(x); } /** * Updates the designated column with aString
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateString(String columnName, String x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setString(x); } public void updateNString(int columnIndex, String string) throws SQLException { throw new FBDriverNotCapableException(); } public void updateNString(String columnLabel, String string) throws SQLException { throw new FBDriverNotCapableException(); } /** * Updates the designated column with aboolean
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * JDBC 2.0 * * Updates a column with a byte array value. * * TheupdateXXX
methods are used to update column values in the * current row, or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
orinsertRow
* methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBytes(String columnName, byte x[]) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setBytes(x); } /** * Updates the designated column with ajava.sql.Date
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateDate(String columnName, Date x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setDate(x); } /** * Updates the designated column with ajava.sql.Time
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateTime(String columnName, Time x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setTime(x); } /** * Updates the designated column with ajava.sql.Timestamp
* value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateTimestamp(String columnName, Timestamp x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setTimestamp(x); } /** * Updates the designated column with an ascii stream value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @param length the length of the stream * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setAsciiStream(x, length); } public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { throw new FBDriverNotCapableException(); } public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { throw new FBDriverNotCapableException(); } /** * Updates the designated column with a binary stream value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @param length the length of the stream * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setBinaryStream(x, length); } /** * Updates the designated column with a character stream value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param reader the new column value * @param length the length of the stream * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setCharacterStream(reader, length); } public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { throw new FBDriverNotCapableException(); } public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { throw new FBDriverNotCapableException(); } public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { throw new FBDriverNotCapableException(); } public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { throw new FBDriverNotCapableException(); } /** * Updates the designated column with anObject
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @param scale forjava.sql.Types.DECIMA
* orjava.sql.Types.NUMERIC
types, * this is the number of digits after the decimal point. For all other * types this value will be ignored. * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateObject(String columnName, Object x, int scale) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setObject(x); } /** * Updates the designated column with anObject
value. * TheupdateXXX
methods are used to update column values in the * current row or the insert row. TheupdateXXX
methods do not * update the underlying database; instead theupdateRow
or *insertRow
methods are called to update the database. * * @param columnName the name of the column * @param x the new column value * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateObject(String columnName, Object x) throws SQLException { if (rowUpdater == null) throw new FBResultSetNotUpdatableException(); getField(columnName).setObject(x); } /** * Inserts the contents of the insert row into this *ResultSet
objaect and into the database. * The cursor must be on the insert row when this method is called. * * @exception SQLException if a database access error occurs, * if this method is called when the cursor is not on the insert row, * or if not all of non-nullable columns in * the insert row have been given a value * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void insertRow() throws SQLException { if (rowUpdater != null) { rowUpdater.insertRow(); fbFetcher.insertRow(rowUpdater.getInsertRow()); notifyRowUpdater(); } else throw new FBResultSetNotUpdatableException(); } /** * Updates the underlying database with the new contents of the * current row of thisResultSet
object. * This method cannot be called when the cursor is on the insert row. * * @exception SQLException if a database access error occurs or * if this method is called when the cursor is on the insert row * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void updateRow() throws SQLException { if (rowUpdater != null) { rowUpdater.updateRow(); fbFetcher.updateRow(rowUpdater.getNewRow()); notifyRowUpdater(); } else throw new FBResultSetNotUpdatableException(); } /** * Deletes the current row from thisResultSet
object * and from the underlying database. This method cannot be called when * the cursor is on the insert row. * * @exception SQLException if a database access error occurs * or if this method is called when the cursor is on the insert row * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void deleteRow() throws SQLException { if (rowUpdater != null) { rowUpdater.deleteRow(); fbFetcher.deleteRow(); notifyRowUpdater(); } else throw new FBResultSetNotUpdatableException(); } /** * Refreshes the current row with its most recent value in * the database. This method cannot be called when * the cursor is on the insert row. * *The
refreshRow
method provides a way for an * application to * explicitly tell the JDBC driver to refetch a row(s) from the * database. An application may want to callrefreshRow
when * caching or prefetching is being done by the JDBC driver to * fetch the latest value of a row from the database. The JDBC driver * may actually refresh multiple rows at once if the fetch size is * greater than one. * *All values are refetched subject to the transaction isolation * level and cursor sensitivity. If
refreshRow
is called after * calling anupdateXXX
method, but before calling * the methodupdateRow
, then the * updates made to the row are lost. Calling the method *refreshRow
frequently will likely slow performance. * * @exception SQLException if a database access error * occurs or if this method is called when the cursor is on the insert row * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void refreshRow() throws SQLException { if (rowUpdater != null) { rowUpdater.refreshRow(); fbFetcher.updateRow(rowUpdater.getOldRow()); // this is excessive, but we do this to keep the code uniform notifyRowUpdater(); } else throw new FBResultSetNotUpdatableException(); } /** * Cancels the updates made to the current row in this *ResultSet
object. * This method may be called after calling an *updateXXX
method(s) and before calling * the methodupdateRow
to roll back * the updates made to a row. If no updates have been made or *updateRow
has already been called, this method has no * effect. * * @exception SQLException if a database access error * occurs or if this method is called when the cursor is on the insert row * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void cancelRowUpdates() throws SQLException { if (rowUpdater != null) rowUpdater.cancelRowUpdates(); else throw new FBResultSetNotUpdatableException(); } /** * Moves the cursor to the insert row. The current cursor position is * remembered while the cursor is positioned on the insert row. * * The insert row is a special row associated with an updatable * result set. It is essentially a buffer where a new row may * be constructed by calling theupdateXXX
methods prior to * inserting the row into the result set. * * Only theupdateXXX
,getXXX
, * andinsertRow
methods may be * called when the cursor is on the insert row. All of the columns in * a result set must be given a value each time this method is * called before callinginsertRow
. * AnupdateXXX
method must be called before a *getXXX
method can be called on a column value. * * @exception SQLException if a database access error occurs * or the result set is not updatable * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void moveToInsertRow() throws SQLException { if (rowUpdater != null) rowUpdater.moveToInsertRow(); else throw new FBResultSetNotUpdatableException(); } /** * Moves the cursor to the remembered cursor position, usually the * current row. This method has no effect if the cursor is not on * the insert row. * * @exception SQLException if a database access error occurs * or the result set is not updatable * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public void moveToCurrentRow() throws SQLException { if (rowUpdater != null) rowUpdater.moveToCurrentRow(); else throw new FBResultSetNotUpdatableException(); } /** * Returns theStatement
object that produced this *ResultSet
object. * If the result set was generated some other way, such as by a *DatabaseMetaData
method, this method returns *null
. * * @return theStatment
object that produced * thisResultSet
object ornull
* if the result set was produced some other way */ public Statement getStatement() { return fbStatement; } /** * Returns the value of the designated column in the current row * of thisResultSet
object as anObject
* in the Java programming language. * This method uses the givenMap
object * for the custom mapping of the * SQL structured or distinct type that is being retrieved. * * @param i the first column is 1, the second is 2, ... * @param map ajava.util.Map
object that contains the mapping * from SQL type names to classes in the Java programming language * @return anObject
in the Java programming language * representing the SQL value * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Object getObject(int i, Map map) throws SQLException { return getField(i).getObject(map); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as aRef
object * in the Java programming language. * * @param i the first column is 1, the second is 2, ... * @return aRef
object representing an SQLREF
value * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Ref getRef(int i) throws SQLException { return getField(i).getRef(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as aClob
object * in the Java programming language. * * @param i the first column is 1, the second is 2, ... * @return aClob
object representing the SQLCLOB
value in * the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Clob getClob(int i) throws SQLException { return getField(i).getClob(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as anArray
object * in the Java programming language. * * @param i the first column is 1, the second is 2, ... * @return anArray
object representing the SQLARRAY
value in * the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Array getArray(int i) throws SQLException { return getField(i).getArray(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as anObject
* in the Java programming language. * This method uses the specifiedMap
object for * custom mapping if appropriate. * * @param columnName the name of the column from which to retrieve the value * @param map ajava.util.Map
object that contains the mapping * from SQL type names to classes in the Java programming language * @return anObject
representing the SQL value in the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Object getObject(String columnName, Map map) throws SQLException { return getField(columnName).getObject(map); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as aRef
object * in the Java programming language. * * @param columnName the column name * @return aRef
object representing the SQLREF
value in * the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Ref getRef(String columnName) throws SQLException { return getField(columnName).getRef(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as aBlob
object * in the Java programming language. * * @param columnName the name of the column from which to retrieve the value * @return aBlob
object representing the SQLBLOB
value in * the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Blob getBlob(String columnName) throws SQLException { return getField(columnName).getBlob(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as aClob
object * in the Java programming language. * * @param columnName the name of the column from which to retrieve the value * @return aClob
object representing the SQLCLOB
* value in the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Clob getClob(String columnName) throws SQLException { return getField(columnName).getClob(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as anArray
object * in the Java programming language. * * @param columnName the name of the column from which to retrieve the value * @return anArray
object representing the SQLARRAY
value in * the specified column * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Array getArray(String columnName) throws SQLException { return getField(columnName).getArray(); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as ajava.sql.Date
object * in the Java programming language. * This method uses the given calendar to construct an appropriate millisecond * value for the date if the underlying database does not store * timezone information. * * @param columnIndex the first column is 1, the second is 2, ... * @param cal thejava.util.Calendar
object * to use in constructing the date * @return the column value as ajava.sql.Date
object; * if the value is SQLNULL
, * the value returned isnull
in the Java programming language * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Date getDate(int columnIndex, Calendar cal) throws SQLException { return getField(columnIndex).getDate(cal); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as ajava.sql.Date
object * in the Java programming language. * This method uses the given calendar to construct an appropriate millisecond * value for the date if the underlying database does not store * timezone information. * * @param columnName the SQL name of the column from which to retrieve the value * @param cal thejava.util.Calendar
object * to use in constructing the date * @return the column value as ajava.sql.Date
object; * if the value is SQLNULL
, * the value returned isnull
in the Java programming language * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Date getDate(String columnName, Calendar cal) throws SQLException { return getField(columnName).getDate(cal); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as ajava.sql.Time
object * in the Java programming language. * This method uses the given calendar to construct an appropriate millisecond * value for the time if the underlying database does not store * timezone information. * * @param columnIndex the first column is 1, the second is 2, ... * @param cal thejava.util.Calendar
object * to use in constructing the time * @return the column value as ajava.sql.Time
object; * if the value is SQLNULL
, * the value returned isnull
in the Java programming language * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Time getTime(int columnIndex, Calendar cal) throws SQLException { return getField(columnIndex).getTime(cal); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as ajava.sql.Time
object * in the Java programming language. * This method uses the given calendar to construct an appropriate millisecond * value for the time if the underlying database does not store * timezone information. * * @param columnName the SQL name of the column * @param cal thejava.util.Calendar
object * to use in constructing the time * @return the column value as ajava.sql.Time
object; * if the value is SQLNULL
, * the value returned isnull
in the Java programming language * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Time getTime(String columnName, Calendar cal) throws SQLException { return getField(columnName).getTime(cal); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as ajava.sql.Timestamp
object * in the Java programming language. * This method uses the given calendar to construct an appropriate millisecond * value for the timestamp if the underlying database does not store * timezone information. * * @param columnIndex the first column is 1, the second is 2, ... * @param cal thejava.util.Calendar
object * to use in constructing the timestamp * @return the column value as ajava.sql.Timestamp
object; * if the value is SQLNULL
, * the value returned isnull
in the Java programming language * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { return getField(columnIndex).getTimestamp(cal); } /** * Returns the value of the designated column in the current row * of thisResultSet
object as ajava.sql.Timestamp
object * in the Java programming language. * This method uses the given calendar to construct an appropriate millisecond * value for the timestamp if the underlying database does not store * timezone information. * * @param columnName the SQL name of the column * @param cal thejava.util.Calendar
object * to use in constructing the date * @return the column value as ajava.sql.Timestamp
object; * if the value is SQLNULL
, * the value returned isnull
in the Java programming language * @exception SQLException if a database access error occurs * @since 1.2 * @see What Is in the JDBC * 2.0 API */ public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { return getField(columnName).getTimestamp(cal); } //jdbc 3 methods /** * This operation is not supported * * @param param1* @return * @exception java.sql.SQLException */ public URL getURL(int param1) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @return * @exception java.sql.SQLException */ public URL getURL(String param1) throws SQLException { throw new FBDriverNotCapableException(); } public T getObject(int columnIndex, Class type) throws SQLException { // TODO Write implementation throw new FBDriverNotCapableException(); } public T getObject(String columnLabel, Class type) throws SQLException { // TODO Write implementation throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateRef(int param1, Ref param2) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateRef(String param1, Ref param2) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateBlob(int param1, Blob param2) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateBlob(String param1, Blob param2) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateClob(int param1, Clob param2) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateClob(String param1, Clob param2) throws SQLException { throw new FBDriverNotCapableException(); } public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateClob(int columnIndex, Reader reader) throws SQLException { throw new FBDriverNotCapableException(); } public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { throw new FBDriverNotCapableException(); } public void updateClob(String columnLabel, Reader reader) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateArray(int param1, Array param2) throws SQLException { throw new FBDriverNotCapableException(); } /** * This operation is not supported * * @param param1 * @param param2 * @exception java.sql.SQLException */ public void updateArray(String param1, Array param2) throws SQLException { throw new FBDriverNotCapableException(); } public String getExecutionPlan() throws SQLException { checkCursorMove(); if (fbStatement == null) return ""; return fbStatement.getExecutionPlan(); } // java.sql.Wrapper interface public boolean isWrapperFor(Class> iface) throws SQLException { return iface != null && iface.isAssignableFrom(this.getClass()); } public T unwrap(Class iface) throws SQLException { if (!isWrapperFor(iface)) throw new FBDriverNotCapableException(); return iface.cast(this); } //-------------------------------------------------------------------- protected void addWarning(SQLWarning warning){ if (firstWarning == null) firstWarning = warning; else{ SQLWarning lastWarning = firstWarning; while (lastWarning.getNextWarning() != null){ lastWarning = lastWarning.getNextWarning(); } lastWarning.setNextWarning(warning); } } }