Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * $Id: AbstractCallableStatement.java 57463 2012-12-08 14:28:10Z 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.Reader;
  import java.net.URL;
  import java.sql.*;
  import java.sql.Date;
  import java.util.*;
  
The interface used to execute SQL stored procedures. JDBC provides a stored procedure SQL escape syntax that allows stored procedures to be called in a standard way for all RDBMSs. This escape syntax has one form that includes a result parameter and one that does not. If used, the result parameter must be registered as an OUT parameter. The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number, with the first parameter being 1.

   {?= call <procedure-name>[<arg1>,<arg2>, ...]}
   {call <procedure-name>[<arg1>,<arg2>, ...]}
 

IN parameter values are set using the set methods inherited from java.sql.PreparedStatement. The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here.

A CallableStatement can return one java.sql.ResultSet or multiple ResultSet objects. Multiple ResultSet objects are handled using operations inherited from java.sql.Statement.

For maximum portability, a call's ResultSet objects and update counts should be processed prior to getting the values of output parameters.

Methods that are new in the JDBC 2.0 API are marked "Since 1.2." Note: Escape syntax currently is not supported. Please use native Firebird procedure call syntax:

 EXECUTE PROCEDURE <proc_name>(param1, ...);
 

Author(s):
David Jencks
Roman Rokytskyy
Steven Jardine
Mark Rotteveel
See also:
java.sql.Connection.prepareCall(java.lang.String)
java.sql.ResultSet
  
  public abstract class AbstractCallableStatement extends FBPreparedStatement implements CallableStatementFirebirdCallableStatement {
      
      static final String NATIVE_CALL_COMMAND = "EXECUTE PROCEDURE";
      static final String NATIVE_SELECT_COMMAND = "SELECT * FROM";
  
      private ResultSet currentRs;
  
      protected boolean selectableProcedure;
  
      protected FBProcedureCall procedureCall;
  
      protected AbstractCallableStatement(GDSHelper cString sqlint rsType
              int rsConcurrencyint rsHoldability
              StoredProcedureMetaData storedProcMetaData,
              FBObjectListener.StatementListener statementListener
              FBObjectListener.BlobListener blobListener
      throws SQLException {
         super(crsTypersConcurrencyrsHoldabilitystatementListenerblobListener);
 
 
         int mode = .;
 
             mode = .;
 
         FBEscapedCallParser parser = new FBEscapedCallParser(mode);
 
         // here statement is parsed twice, once in c.nativeSQL(...)
         // and second time in parser.parseCall(...)... not nice, maybe
         // in the future should be fixed by calling FBEscapedParser for
         // each parameter in FBEscapedCallParser class
          = parser.parseCall(nativeSQL(sql));
 
         if (storedProcMetaData.canGetSelectableInformation()) {
             setSelectabilityAutomatically(storedProcMetaData);
         }
     }
 
     public ParameterMetaData getParameterMetaData() throws SQLException {
         .executionStarted(this);
         Object syncObject = getSynchronizationObject();
         synchronized (syncObject) {
             try {
                 prepareFixedStatement(.getSQL(isSelectableProcedure()), true);
             } catch (GDSException ge) {
                 throw new FBSQLException(ge);
             }
         }
 
         return new FBParameterMetaData(.getInSqlda().);
     }
 
     public void addBatch() throws SQLException {
         .add(.clone());
     }
 
     public int[] executeBatch() throws SQLException {
         Object syncObject = getSynchronizationObject();
         synchronized (syncObject) {
             boolean success = false;
             try {
                 notifyStatementStarted();
 
                 List results = new ArrayList(.size());
                 Iterator iterator = .iterator();
 
                 try {
                     while (iterator.hasNext()) {
                          = (FBProcedureCalliterator.next();
                         executeSingleForBatch(results);
                     }
 
                     success = true;
                     return toArray(results);
                 } finally {
                     clearBatch();
                 }
             } finally {
                 notifyStatementCompleted(success);
             }
         }
     }
     
     private void executeSingleForBatch(List resultsthrows SQLException {
         /*
          * TODO: array given to BatchUpdateException might not be JDBC-compliant
          * (should set Statement.EXECUTE_FAILED and throwing it right away
          * instead of continuing may fail intention)
          */
         try {
 
             if (internalExecute(!isSelectableProcedure()))
                 throw new BatchUpdateException(toArray(results));
 
             results.add(new Integer(getUpdateCount()));
         } catch (GDSException ex) {
             throw new BatchUpdateException(ex.getMessage(), ""ex.getFbErrorCode(),
                     toArray(results));
         }
     }
 
     /* (non-Javadoc)
      * @see org.firebirdsql.jdbc.FirebirdCallableStatement#setSelectableProcedure(boolean)
      */
     public void setSelectableProcedure(boolean selectableProcedure) {
         this. = selectableProcedure;
     }
 
     public boolean isSelectableProcedure() {
         return ;
     }

    
Set required types for output parameters.

Throws:
java.sql.SQLException if something went wrong.
 
     protected void setRequiredTypes() throws SQLException {
 
         FBResultSet resultSet = (FBResultSetgetCurrentResultSet();
 
         Iterator iter = .getOutputParams().iterator();
         while (iter.hasNext()) {
             FBProcedureParam param = (FBProcedureParamiter.next();
 
             if (param == null)
                 continue;
 
             FBField field = resultSet.getField(
                     .mapOutParamIndexToPosition(param.getIndex()),
                     false);
 
             field.setRequiredType(param.getType());
         }
     }

    
We allow multiple calls to this method without re-preparing the statement. This is an workaround to the issue that the statement is actually prepared only after all OUT parameters are registered.
 
     protected void prepareFixedStatement(String sqlboolean describeBind)
             throws GDSExceptionSQLException {
 
         if ( != null)
             return;
 
         super.prepareFixedStatement(sqldescribeBind);
     }

    
Since we deferred the statement preparation until all OUT params are registered, we ensure that the statement is prepared before the meta data for the callable statement is obtained.
 
     public ResultSetMetaData getMetaData() throws SQLException {
 
         .executionStarted(this);
 
         Object syncObject = getSynchronizationObject();
         synchronized (syncObject) {
             try {
                 prepareFixedStatement(.getSQL(isSelectableProcedure()), true);
             } catch (GDSException ge) {
                 throw new FBSQLException(ge);
             }
         }
 
         return super.getMetaData();
     }

    
Executes an execute stored procedure. Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by the methods executeQuery and executeUpdate.

Throws:
java.sql.SQLException if a database access error occurs
See also:
java.sql.Statement.execute(java.lang.String)
 
     public boolean execute() throws SQLException {
         boolean hasResultSet = false;
         Object syncObject = getSynchronizationObject();
         synchronized (syncObject) {
             notifyStatementStarted();
 
             try {
                  = null;
 
                 prepareFixedStatement(.getSQL(isSelectableProcedure()), true);
                 hasResultSet = internalExecute(!isSelectableProcedure());
 
                 if (hasResultSet)
                     setRequiredTypes();
             }catch (GDSException ge) {
                 throw new FBSQLException(ge);
             } finally {
             	if (!hasResultSetnotifyStatementCompleted();
             }
 
             return hasResultSet;
         }
 
     }

    
Execute query. This method prepares statement before execution. Rest of the processing is done by superclass.
 
     public ResultSet executeQuery() throws SQLException {
 
         Object syncObject = getSynchronizationObject();
         synchronized (syncObject) {
             notifyStatementStarted();
 
             try {
                  = null;
 
                 prepareFixedStatement(.getSQL(isSelectableProcedure()), true);
 
                 if (!internalExecute(!isSelectableProcedure()))
                 	throw new FBSQLException(
                             "No resultset for sql",
                             .);
 
                 getResultSet();
 
                 setRequiredTypes();
 
                 return getCurrentResultSet();
 
             } catch (GDSException ex) {
                 throw new FBSQLException(ex);
             }
         }
     }

    
Execute query. This method prepares statement before execution. Rest of the processing is done by superclass.
 
     public int executeUpdate() throws SQLException {
         Object syncObject = getSynchronizationObject();
         synchronized (syncObject) {
             try {
                 notifyStatementStarted();
 
                  = null;
 
                 prepareFixedStatement(.getSQL(isSelectableProcedure()), true);
 
                 /*
                  * // R.Rokytskyy: JDBC CTS suite uses executeUpdate() //
                  * together with output parameters, therefore we cannot //
                  * throw exception if we want to pass the test suite
                  * 
                  * if (internalExecute(true)) throw new FBSQLException(
                  * "Update statement returned results.");
                  */
 
                 boolean hasResults = internalExecute(!isSelectableProcedure());
 
                 if (hasResults) {
                     setRequiredTypes();
                 }
 
                 return getUpdateCount();
             } catch (GDSException ex) {
                 throw new FBSQLException(ex);
             } finally {
                 notifyStatementCompleted();
             }
         }
     }

    
Execute statement internally. This method sets cached parameters. Rest of the processing is done by superclass.
 
     protected boolean internalExecute(boolean sendOutParamsthrows SQLException {
 
         int counter = 0;
 
         List inputParams = .getInputParams();
         Iterator iter = inputParams.iterator();
         while (iter.hasNext()) {
             FBProcedureParam param = (FBProcedureParamiter.next();
 
             if (param != null && param.isParam()) {
 
                 counter++;
 
                 Object value = param.getValue();
                 FBField field = getField(counter);
 
                 if (value == null)
                     field.setNull();
                 else if (value instanceof WrapperWithCalendar) {
                     setField(field, (WrapperWithCalendar)value);
                 } else if (value instanceof WrapperWithInt) {
                     setField(field, (WrapperWithInt)value);
                 } else
                     field.setObject(value);
 
                 [counter - 1] = true;
             }
         }
 
         return super.internalExecute(sendOutParams);
     }
 
     private void setField(FBField fieldWrapperWithInt valuethrows SQLException {
         Object obj = value.getValue();
 
         if (obj == null) {
             field.setNull();
         } else {
             int intValue = value.getIntValue();
 
             if (obj instanceof InputStream)
                 field.setBinaryStream((InputStreamobjintValue);
             else if (obj instanceof Reader)
                 field.setCharacterStream((ReaderobjintValue);
             else
                 throw new TypeConversionException("Cannot convert type " + obj.getClass().getName());
         }
     }
 
     private void setField(FBField fieldWrapperWithCalendar valuethrows SQLException {
         Object obj = value.getValue();
 
         if (obj == null) {
             field.setNull();
         } else {
             Calendar cal = value.getCalendar();
 
             if (obj instanceof Timestamp)
                 field.setTimestamp((Timestampobjcal);
             else if (obj instanceof java.sql.Date)
                 field.setDate((java.sql.Dateobjcal);
             else if (obj instanceof Time)
                 field.setTime((Timeobjcal);
             else
                 throw new TypeConversionException("Cannot convert type " + obj.getClass().getName());
         }
     }

    
Registers the OUT parameter in ordinal position parameterIndex to the JDBC type sqlType. All OUT parameters must be registered before a stored procedure is executed.

The JDBC type specified by sqlType for an OUT parameter determines the Java type that must be used in the get method to read the value of that parameter.

If the JDBC type expected to be returned to this output parameter is specific to this particular database, sqlType should be java.sql.Types.OTHER. The method getObject(int) retrieves the value.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
sqlType the JDBC type code defined by java.sql.Types. If the parameter is of JDBC type NUMERIC or DECIMAL, the version of registerOutParameter that accepts a scale value should be used.
Throws:
java.sql.SQLException if a database access error occurs
See also:
java.sql.Types
 
     public void registerOutParameter(int parameterIndexint sqlType)
             throws SQLException
     {
         .registerOutParam(parameterIndexsqlType);
     }

    
Registers the parameter in ordinal position parameterIndex to be of JDBC type sqlType. This method must be called before a stored procedure is executed.

The JDBC type specified by sqlType for an OUT parameter determines the Java type that must be used in the get method to read the value of that parameter.

This version of registerOutParameter should be used when the parameter is of JDBC type NUMERIC or DECIMAL.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
sqlType SQL type code defined by java.sql.Types.
scale the desired number of digits to the right of the decimal point. It must be greater than or equal to zero.
Throws:
java.sql.SQLException if a database access error occurs
See also:
java.sql.Types
 
     public void registerOutParameter(int parameterIndexint sqlTypeint scale)
         throws SQLException
     {
         .registerOutParam(parameterIndexsqlType);
     }

    
Indicates whether or not the last OUT parameter read had the value of SQL NULL. Note that this method should be called only after calling a getXXX method; otherwise, there is no value to use in determining whether it is null or not.

Returns:
true if the last parameter read was SQL NULL; false otherwise
Throws:
java.sql.SQLException if a database access error occurs
 
     public boolean wasNull() throws SQLException {
         return getCurrentResultSet().wasNull();
     }

    
Retrieves the value of a JDBC CHAR, VARCHAR, or LONGVARCHAR parameter as a String in the Java programming language.

For the fixed-length type JDBC CHAR, the String object returned has exactly the same value the JDBC CHAR value had in the database, including any padding added by the database.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public String getString(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getString(parameterIndex);
     }

    
Gets the value of a JDBC BIT parameter as a boolean in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is false.
Throws:
java.sql.SQLException if a database access error occurs
 
     public boolean getBoolean(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getBoolean(parameterIndex);
     }

    
Gets the value of a JDBC TINYINT parameter as a byte in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is 0.
Throws:
java.sql.SQLException if a database access error occurs
 
     public byte getByte(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getByte(parameterIndex);
     }

    
Gets the value of a JDBC SMALLINT parameter as a short in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is 0.
Throws:
java.sql.SQLException if a database access error occurs
 
     public short getShort(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getShort(parameterIndex);
     }

    
Gets the value of a JDBC INTEGER parameter as an int in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is 0.
Throws:
java.sql.SQLException if a database access error occurs
 
     public int getInt(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getInt(parameterIndex);
     }

    
Gets the value of a JDBC BIGINT parameter as a long in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is 0.
Throws:
java.sql.SQLException if a database access error occurs
 
     public long getLong(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getLong(parameterIndex);
     }

    
Gets the value of a JDBC FLOAT parameter as a float in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is 0.
Throws:
java.sql.SQLException if a database access error occurs
 
     public float getFloat(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getFloat(parameterIndex);
     }

    
Gets the value of a JDBC DOUBLE parameter as a double in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is 0.
Throws:
java.sql.SQLException if a database access error occurs
 
     public double getDouble(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getDouble(parameterIndex);
     }

    
Gets the value of a JDBC NUMERIC parameter as a java.math.BigDecimal object with scale digits to the right of the decimal point.

Deprecated:
Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
scale the number of digits to the right of the decimal point
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public BigDecimal getBigDecimal(int parameterIndexint scale)
         throws SQLException
     {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getBigDecimal(parameterIndexscale);
     }

    
Gets the value of a JDBC BINARY or VARBINARY parameter as an array of byte values in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public byte[] getBytes(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getBytes(parameterIndex);
     }

    
Gets the value of a JDBC DATE parameter as a java.sql.Date object.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public java.sql.Date getDate(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getDate(parameterIndex);
     }

    
Get the value of a JDBC TIME parameter as a java.sql.Time object.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public Time getTime(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getTime(parameterIndex);
     }

    
Gets the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public Timestamp getTimestamp(int parameterIndex)
         throws SQLException
     {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getTimestamp(parameterIndex);
     }

    
Gets the value of a parameter as an Object in the Java programming language.

This method returns a Java object whose type corresponds to the JDBC type that was registered for this parameter using the method registerOutParameter. By registering the target JDBC type as java.sql.Types.OTHER, this method can be used to read database-specific abstract data types.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
A java.lang.Object holding the OUT parameter value.
Throws:
java.sql.SQLException if a database access error occurs
See also:
java.sql.Types
 
     public Object getObject(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getObject(parameterIndex);
     }
     
     public Object getObject(String colNamethrows SQLException {
         return getObject(findOutParameter(colName));
     }
    
   
Returns an object representing the value of OUT parameter i and uses map for the custom mapping of the parameter value.

This method returns a Java object whose type corresponds to the JDBC type that was registered for this parameter using the method registerOutParameter. By registering the target JDBC type as java.sql.Types.OTHER, this method can be used to read database-specific abstract data types.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
map the mapping from SQL type names to Java classes
Returns:
a java.lang.Object holding the OUT parameter value
Throws:
java.sql.SQLException if a database access error occurs
Since:
1.2
See also:
What Is in the JDBC 2.0 API
 
     public Object getObject(int parameterIndexMap mapthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getObject(parameterIndexmap);
     }
     
     public Object getObject(String colNameMap mapthrows SQLException {
         return getObject(findOutParameter(colName), map);
     }
     
     public <T> T getObject(int parameterIndexClass<T> typethrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return ((FBResultSet)getCurrentResultSet()).getObject(parameterIndextype);
     }
 
     public <T> T getObject(String parameterNameClass<T> typethrows SQLException {
         return getObject(findOutParameter(parameterName), type);
     }

    
Gets the value of a JDBC NUMERIC parameter as a java.math.BigDecimal object with as many digits to the right of the decimal point as the value contains.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value in full precision. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
Since:
1.2
See also:
What Is in the JDBC 2.0 API
 
     public BigDecimal getBigDecimal(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getBigDecimal(parameterIndex);
     }
    
   
Gets the value of a JDBC REF(<structured-type>) parameter as a java.sql.Ref object in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value as a Ref object in the Java programming language. If the value was SQL NULL, the value null is returned.
Throws:
java.sql.SQLException if a database access error occurs
Since:
1.2
See also:
What Is in the JDBC 2.0 API
 
     public Ref getRef(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getRef(parameterIndex);
     }

    
Gets the value of a JDBC BLOB parameter as a java.sql.Blob object in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value as a Blob object in the Java programming language. If the value was SQL NULL, the value null is returned.
Throws:
java.sql.SQLException if a database access error occurs
Since:
1.2
See also:
What Is in the JDBC 2.0 API
 
     public Blob getBlob(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getBlob(parameterIndex);
     }

    
Gets the value of a JDBC CLOB parameter as a Clob object in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value as a Clob object in the Java programming language. If the value was SQL NULL, the value null is returned.
Throws:
java.sql.SQLException if a database access error occurs
Since:
1.2
See also:
What Is in the JDBC 2.0 API
 
     public Clob getClob(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getClob(parameterIndex);
     }

    
Gets the value of a JDBC ARRAY parameter as an java.sql.Array object in the Java programming language.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
Returns:
the parameter value as an Array object in the Java programming language. If the value was SQL NULL, the value null is returned.
Throws:
java.sql.SQLException if a database access error occurs
Since:
1.2
See also:
What Is in the JDBC 2.0 API
 
     public Array getArray(int parameterIndexthrows SQLException {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getArray(parameterIndex);
     }

    
Gets the value of a JDBC DATE parameter as a java.sql.Date object, using the given Calendar object to construct the date. With a Calendar object, the driver can calculate the date taking into account a custom timezone and locale. If no Calendar object is specified, the driver uses the default timezone and locale.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
cal the Calendar object the driver will use to construct the date
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public java.sql.Date getDate(int parameterIndexCalendar cal)
         throws SQLException
     {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getDate(parameterIndexcal);
     }

    
Gets the value of a JDBC TIME parameter as a java.sql.Time object, using the given Calendar object to construct the time. With a Calendar object, the driver can calculate the time taking into account a custom timezone and locale. If no Calendar object is specified, the driver uses the default timezone and locale.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
cal the Calendar object the driver will use to construct the time
Returns:
the parameter value; if the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public Time getTime(int parameterIndexCalendar cal)
         throws SQLException
     {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getTime(parameterIndexcal);
     }

    
Gets the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object, using the given Calendar object to construct the Timestamp object. With a Calendar object, the driver can calculate the timestamp taking into account a custom timezone and locale. If no Calendar object is specified, the driver uses the default timezone and locale.

Parameters:
parameterIndex the first parameter is 1, the second is 2, and so on
cal the Calendar object the driver will use to construct the timestamp
Returns:
the parameter value. If the value is SQL NULL, the result is null.
Throws:
java.sql.SQLException if a database access error occurs
 
     public Timestamp getTimestamp(int parameterIndexCalendar cal)
         throws SQLException
     {
         parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
         return getCurrentResultSet().getTimestamp(parameterIndexcal);
     }
 
     public URL getURL(int colIndexthrows SQLException {
         return getCurrentResultSet().getURL(colIndex);
     }
 
     public String getString(String colNamethrows SQLException {
         return getString(findOutParameter(colName));
     }
 
     public boolean getBoolean(String colNamethrows SQLException {
         return getBoolean(findOutParameter(colName));
     }
 
     public byte getByte(String colNamethrows SQLException {
         return getByte(findOutParameter(colName));
     }
 
     public short getShort(String colNamethrows SQLException {
         return getShort(findOutParameter(colName));
     }
 
     public int getInt(String colNamethrows SQLException {
         return getInt(findOutParameter(colName));
     }
 
     public long getLong(String colNamethrows SQLException {
         return getLong(findOutParameter(colName));
     }
 
     public float getFloat(String colNamethrows SQLException {
         return getFloat(findOutParameter(colName));
     }
 
     public double getDouble(String colNamethrows SQLException {
         return getDouble(findOutParameter(colName));
     }
 
     public byte[] getBytes(String colNamethrows SQLException {
         return getBytes(findOutParameter(colName));
     }
 
     public Date getDate(String colNamethrows SQLException {
         return getDate(findOutParameter(colName));
     }
 
     public Time getTime(String colNamethrows SQLException {
         return getTime(findOutParameter(colName));
     }
 
     public Timestamp getTimestamp(String colNamethrows SQLException {
        return getTimestamp(findOutParameter(colName));
    }
    public BigDecimal getBigDecimal(String colNamethrows SQLException {
        return getBigDecimal(findOutParameter(colName));
    }
    public Ref getRef(String colNamethrows SQLException {
        return getRef(findOutParameter(colName));
    }
    public Blob getBlob(String colNamethrows SQLException {
        return getBlob(findOutParameter(colName));
    }
    public Clob getClob(String colNamethrows SQLException {
        return getClob(findOutParameter(colName));
    }
    public Array getArray(String colNamethrows SQLException {
        return getArray(findOutParameter(colName));
    }
    public Date getDate(String colNameCalendar calthrows SQLException {
        return getDate(findOutParameter(colName), cal);
    }
    public Time getTime(String colNameCalendar calthrows SQLException {
        return getTime(findOutParameter(colName), cal);
    }
    public Timestamp getTimestamp(String colNameCalendar calthrows SQLException {
        return getTimestamp(findOutParameter(colName), cal);
    }
    public URL getURL(String colNamethrows SQLException {
        return getURL(findOutParameter(colName));
    }
    public Reader getCharacterStream(int parameterIndexthrows SQLException {
        parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
        return getCurrentResultSet().getCharacterStream(parameterIndex);
    }
    public Reader getCharacterStream(String parameterNamethrows SQLException {
        return getCharacterStream(findOutParameter(parameterName));
    }
    public Reader getNCharacterStream(int parameterIndexthrows SQLException {
        parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
        return ((FBResultSet)getCurrentResultSet()).getNCharacterStream(parameterIndex);
    }
    public Reader getNCharacterStream(String parameterNamethrows SQLException {
        return getNCharacterStream(findOutParameter(parameterName));
    }
    public String getNString(int parameterIndexthrows SQLException {
        parameterIndex = .mapOutParamIndexToPosition(parameterIndex);
        return ((FBResultSet)getCurrentResultSet()).getNString(parameterIndex);
    }
    public String getNString(String parameterNamethrows SQLException {
        return getNString(findOutParameter(parameterName));
    }
    public void setAsciiStream(String parameterNameInputStream xlong length)
            throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setAsciiStream(String parameterNameInputStream xthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBinaryStream(String parameterNameInputStream xlong length)
            throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBinaryStream(String parameterNameInputStream xthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBlob(String parameterNameBlob xthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBlob(String parameterNameInputStream inputStreamlong length)
            throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBlob(String parameterNameInputStream inputStreamthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setCharacterStream(String parameterNameReader readerlong length)
            throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setCharacterStream(String parameterNameReader readerthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setClob(String parameterNameClob xthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setClob(String parameterNameReader readerlong lengththrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setClob(String parameterNameReader readerthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNCharacterStream(String parameterNameReader valuelong length)
            throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNCharacterStream(String parameterNameReader valuethrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNClob(String parameterNameReader readerlong lengththrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNClob(String parameterNameReader readerthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNString(String parameterNameString valuethrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void registerOutParameter(String param1int param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void registerOutParameter(String param1int param2int param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void registerOutParameter(String param1int param2String param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setURL(String param1URL param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNull(String param1int param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBoolean(String param1boolean param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setByte(String param1byte param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setShort(String param1short param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setInt(String param1int param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setLong(String param1long param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setFloat(String param1float param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setDouble(String param1double param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBigDecimal(String param1BigDecimal param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setString(String param1String param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBytes(String param1byte[] param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setDate(String param1Date param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setTime(String param1Time param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setTimestamp(String param1Timestamp param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setAsciiStream(String param1InputStream param2int param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setBinaryStream(String param1InputStream param2int param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setObject(String param1Object param2int param3int param4throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setObject(String param1Object param2int param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setObject(String param1Object param2throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setCharacterStream(String param1Reader param2int param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setDate(String param1Date param2Calendar param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setTime(String param1Time param2Calendar param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setTimestamp(String param1Timestamp param2Calendar param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setNull(String param1int param2String param3throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public void setURL(int parameterIndexURL xthrows SQLException {
        throw new FBDriverNotCapableException();
    }
    public void registerOutParameter(int parameterIndexint sqlTypeString typeName)
            throws SQLException {
        throw new FBDriverNotCapableException();
    }
    public ResultSet getGeneratedKeys() throws SQLException {
        throw new FBDriverNotCapableException();
    }

    
Asserts if the current statement has data to return. It checks if the result set has a row with data.

Parameters:
rs result set to test
Throws:
java.sql.SQLException when the result set has no data.
    protected void assertHasData(ResultSet rsthrows SQLException {
        // check if we have a row, and try to move to the first position.
        if (rs.getRow() == 0)
            rs.next();
        else
            return;
        // check if we still have no row and throw an exception in this case.
        if (rs.getRow() == 0)
        	throw new FBSQLException(
                    "Current statement has not data to return.",
                        .);
    }
    // this method doesn't give an exception if it is called twice.
    public ResultSet getCurrentResultSet() throws SQLException {
        if ( == null)
             = super.getResultSet();
        return ;
    }

    
Returns the current result as a ResultSet object. This method should be called only once per result. Calling this method twice with autocommit on and used will probably throw an inappropriate or uninformative exception.

Returns:
the current result as a ResultSet object; null if the result is an update count or there are no more results
Throws:
java.sql.SQLException if a database access error occurs
See also:
execute()
    public ResultSet getResultSet() throws SQLException {
        return getCurrentResultSet();
    }
    public void setArray(int iArray xthrows SQLException {
    }
    public void setBigDecimal(int parameterIndexBigDecimal xthrows SQLException {
        .getInputParam(parameterIndex).setValue(x);
    }
    public void setBinaryStream(int parameterIndexInputStream inputStreamint length)
            throws SQLException {
        .getInputParam(parameterIndex).setValue(
                new WrapperWithInt(inputStreamlength));
    }
    public void setBlob(int parameterIndexBlob blobthrows SQLException {
        .getInputParam(parameterIndex).setValue(blob);
    }
    public void setBoolean(int parameterIndexboolean xthrows SQLException {
        .getInputParam(parameterIndex).setValue(Boolean.valueOf(x));
    }
    public void