org.eclipse.datatools.connectivity.oda.consumer.helper
Class OdaAdvancedQuery

java.lang.Object
  extended byorg.eclipse.datatools.connectivity.oda.consumer.helper.OdaObject
      extended byorg.eclipse.datatools.connectivity.oda.consumer.helper.OdaDriverObject
          extended byorg.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery
              extended byorg.eclipse.datatools.connectivity.oda.consumer.helper.OdaAdvancedQuery
All Implemented Interfaces:
IAdvancedQuery, IQuery

public class OdaAdvancedQuery
extends OdaQuery
implements IAdvancedQuery

OdaAdvancedQuery is the ODA wrapper for advanced query statements.


Method Summary
 boolean execute()
          Executes the query's prepared query that may return multiple result sets.
 int findOutParameter(java.lang.String parameterName)
          Returns the 1-based index of the specified scalar or structure output parameter.
 java.math.BigDecimal getBigDecimal(int parameterId)
          Returns the decimal value from the designated output parameter.
 java.math.BigDecimal getBigDecimal(java.lang.String parameterName)
          Returns the decimal value from the designated output parameter.
 java.lang.String getBigDecimalAsString(int parameterId)
           
 java.lang.String getBigDecimalAsString(java.lang.String parameterName)
           
 IBlob getBlob(int parameterId)
          Returns the IBlob value from the designated output parameter.
 IBlob getBlob(java.lang.String parameterName)
          Returns the IBlob value from the designated output parameter.
 IClob getClob(int parameterId)
          Returns the IClob value from the designated output parameter.
 IClob getClob(java.lang.String parameterName)
          Returns the IClob value from the designated output parameter.
 java.sql.Date getDate(int parameterId)
          Returns the java.sql.Date value from the designated output parameter.
 java.sql.Date getDate(java.lang.String parameterName)
          Returns the java.sql.Date value from the designated output parameter.
 java.lang.String getDateAsString(int parameterId)
           
 java.lang.String getDateAsString(java.lang.String parameterName)
           
 double getDouble(int parameterId)
          Returns the double value from the designated output parameter.
 double getDouble(java.lang.String parameterName)
          Returns the double value from the designated output parameter.
 int getInt(int parameterId)
          Returns the integer value from the designated output parameter.
 int getInt(java.lang.String parameterName)
          Returns the integer value from the designated output parameter.
 java.lang.String getInterfaceName()
           
 IResultSetMetaData getMetaDataOf(java.lang.String resultSetName)
          Returns the metadata of the expected named result.
 boolean getMoreResults()
          Moves to the query's next result set.
 IResultSet getResultSet()
          Returns the current result as an IResultSet object.
 IResultSet getResultSet(java.lang.String resultSetName)
          Returns the named result as an IResultSet object, or null if none is available.
 java.lang.String[] getResultSetNames()
          Returns the names of result sets that can be returned by this IAdvancedQuery.
 IParameterRowSet getRow(int parameterId)
          Returns the structure value from the designated output parameter.
 IParameterRowSet getRow(java.lang.String parameterName)
          Returns the structure value from the designated output parameter.
 SortSpec getSortSpec(java.lang.String resultSetName)
          Returns the sort specification associated with the named result set of this IAdvancedQuery.
 java.lang.String getString(int parameterId)
          Returns the String value from the designated output parameter.
 java.lang.String getString(java.lang.String parameterName)
          Returns the String value from the designated output parameter.
 java.sql.Time getTime(int parameterId)
          Returns the java.sql.Time value from the designated output parameter.
 java.sql.Time getTime(java.lang.String parameterName)
          Returns the java.sql.Time value from the designated output parameter.
 java.lang.String getTimeAsString(int parameterId)
           
 java.lang.String getTimeAsString(java.lang.String parameterName)
           
 java.sql.Timestamp getTimestamp(int parameterId)
          Returns the java.sql.Timestamp value from the designated output parameter.
 java.sql.Timestamp getTimestamp(java.lang.String parameterName)
          Returns the java.sql.Timestamp value from the designated output parameter.
 java.lang.String getTimestampAsString(int parameterId)
           
 java.lang.String getTimestampAsString(java.lang.String parameterName)
           
 IParameterRowSet setNewRow(int parameterId)
          Returns an IParameterRowSet object that contains a single row representing the specified structure input parameter.
 IParameterRowSet setNewRow(java.lang.String parameterName)
          Returns an IParameterRowSet object that contains a single row representing the named structure input parameter.
 IParameterRowSet setNewRowSet(int parameterId)
          Returns an empty IParameterRowSet object that represents the specified table input parameter.
 IParameterRowSet setNewRowSet(java.lang.String parameterName)
          Returns an empty IParameterRowSet object that represents the named table input parameter.
 void setSortSpec(java.lang.String resultSetName, SortSpec sortBy)
          Specifies the sort specification for the named result set of this IAdvancedQuery.
 boolean wasNull()
          Returns whether the value read from the previous get<type> method was null.
 
Methods inherited from class org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery
clearInParameters, close, executeQuery, findAndInvokeMethod, findInParameter, getMaxRows, getMetaData, getParameterMetaData, getSortSpec, prepare, setAppContext, setBigDecimal, setBigDecimal, setDate, setDate, setDouble, setDouble, setInt, setInt, setMaxRows, setProperty, setSortSpec, setString, setString, setThrowAndSetOdaException, setTime, setTime, setTimestamp, setTimestamp
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.datatools.connectivity.oda.IQuery
clearInParameters, close, executeQuery, findInParameter, getMaxRows, getMetaData, getParameterMetaData, getSortSpec, prepare, setAppContext, setBigDecimal, setBigDecimal, setDate, setDate, setDouble, setDouble, setInt, setInt, setMaxRows, setProperty, setSortSpec, setString, setString, setTime, setTime, setTimestamp, setTimestamp
 

Method Detail

execute

public boolean execute()
                throws OdaException
Description copied from interface: IAdvancedQuery
Executes the query's prepared query that may return multiple result sets. Note: This should only be called after prepare().

Specified by:
execute in interface IAdvancedQuery
Returns:
true if the next result is an IResultSet object; false if there are no result sets.
Throws:
OdaException - if data source error occurs.

getResultSet

public IResultSet getResultSet()
                        throws OdaException
Description copied from interface: IAdvancedQuery
Returns the current result as an IResultSet object. Note: This method should be called only once per result.

Specified by:
getResultSet in interface IAdvancedQuery
Returns:
an IResultSet object.
Throws:
OdaException - if data source error occurs.

getMoreResults

public boolean getMoreResults()
                       throws OdaException
Description copied from interface: IAdvancedQuery
Moves to the query's next result set. This method also implicitly closes the current IResultSet object obtained from the previous call to getResultSet().

Specified by:
getMoreResults in interface IAdvancedQuery
Returns:
true, if there are more results in this query object.
Throws:
OdaException - if data source error occurs.

getMetaDataOf

public IResultSetMetaData getMetaDataOf(java.lang.String resultSetName)
                                 throws OdaException
Description copied from interface: IAdvancedQuery
Returns the metadata of the expected named result.

Specified by:
getMetaDataOf in interface IAdvancedQuery
Parameters:
resultSetName - the name of the result.
Returns:
an IResultSetMetaData object.
Throws:
OdaException - if data source error occurs.

getResultSetNames

public java.lang.String[] getResultSetNames()
                                     throws OdaException
Description copied from interface: IAdvancedQuery
Returns the names of result sets that can be returned by this IAdvancedQuery.
An optional method; only applicable to a query that can retrieve multiple named result sets.

Specified by:
getResultSetNames in interface IAdvancedQuery
Returns:
an array of result set names.
Throws:
OdaException - if data source error occurs.

getResultSet

public IResultSet getResultSet(java.lang.String resultSetName)
                        throws OdaException
Description copied from interface: IAdvancedQuery
Returns the named result as an IResultSet object, or null if none is available. Note: This method should be called only once per result.

Specified by:
getResultSet in interface IAdvancedQuery
Parameters:
resultSetName - the name of the target result set.
Returns:
an IResultSet object.
Throws:
OdaException - if data source error occurs.

setNewRow

public IParameterRowSet setNewRow(java.lang.String parameterName)
                           throws OdaException
Description copied from interface: IAdvancedQuery
Returns an IParameterRowSet object that contains a single row representing the named structure input parameter. Client will then use the IParameterRowSet setter methods to populate the input parameter values. For example:

IParameterRowSet myStruct = myQuery.setNewRow( "MyStructureName" );
myStruct.next();
myStruct.setString( 1, "myValue" );


An optional method; applicable only if named structure input parameters are supported.

Specified by:
setNewRow in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
an IParameterRowSet object.
Throws:
OdaException - if data source error occurs.

setNewRow

public IParameterRowSet setNewRow(int parameterId)
                           throws OdaException
Description copied from interface: IAdvancedQuery
Returns an IParameterRowSet object that contains a single row representing the specified structure input parameter. Client will then use the IParameterRowSet setter methods to populate the input parameter values.
An optional method; applicable only if structure input parameters are supported.

Specified by:
setNewRow in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
an IParameterRowSet object.
Throws:
OdaException - if data source error occurs.

setNewRowSet

public IParameterRowSet setNewRowSet(java.lang.String parameterName)
                              throws OdaException
Description copied from interface: IAdvancedQuery
Returns an empty IParameterRowSet object that represents the named table input parameter. Client will then use the IParameterRowSet setter methods to populate each row of the input parameter values. For example:

IParameterRowSet myTable = myQuery.setNewRowSet( "MyTableName" );
myTable.add();
myTable.setString( 1, "myValue1" );
myTable.add();
myTable.setString( 1, "myValue2" );


An optional method; applicable only if named table input parameters are supported.

Specified by:
setNewRowSet in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
an IParameterRowSet object.
Throws:
OdaException - if data source error occurs.

setNewRowSet

public IParameterRowSet setNewRowSet(int parameterId)
                              throws OdaException
Description copied from interface: IAdvancedQuery
Returns an empty IParameterRowSet object that represents the specified table input parameter. Client will then use the IParameterRowSet setter methods to populate each row of the input parameter values.
An optional method; applicable only if table input parameters are supported.

Specified by:
setNewRowSet in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
an IParameterRowSet object.
Throws:
OdaException - if data source error occurs.

getInt

public int getInt(java.lang.String parameterName)
           throws OdaException
Description copied from interface: IAdvancedQuery
Returns the integer value from the designated output parameter.

Specified by:
getInt in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the integer value.
Throws:
OdaException - if data source error occurs.

getInt

public int getInt(int parameterId)
           throws OdaException
Description copied from interface: IAdvancedQuery
Returns the integer value from the designated output parameter.

Specified by:
getInt in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the integer value.
Throws:
OdaException - if data source error occurs.

getDouble

public double getDouble(java.lang.String parameterName)
                 throws OdaException
Description copied from interface: IAdvancedQuery
Returns the double value from the designated output parameter.

Specified by:
getDouble in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the double value.
Throws:
OdaException - if data source error occurs.

getDouble

public double getDouble(int parameterId)
                 throws OdaException
Description copied from interface: IAdvancedQuery
Returns the double value from the designated output parameter.

Specified by:
getDouble in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the double value.
Throws:
OdaException - if data source error occurs.

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String parameterName)
                                   throws OdaException
Description copied from interface: IAdvancedQuery
Returns the decimal value from the designated output parameter.

Specified by:
getBigDecimal in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the decimal value.
Throws:
OdaException - if data source error occurs.

getBigDecimal

public java.math.BigDecimal getBigDecimal(int parameterId)
                                   throws OdaException
Description copied from interface: IAdvancedQuery
Returns the decimal value from the designated output parameter.

Specified by:
getBigDecimal in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the decimal value.
Throws:
OdaException - if data source error occurs.

getString

public java.lang.String getString(java.lang.String parameterName)
                           throws OdaException
Description copied from interface: IAdvancedQuery
Returns the String value from the designated output parameter. An ODA runtime driver may or may not support getString() on a non-String type parameter. The format of the returned string is implementation- dependent.

Specified by:
getString in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the String value.
Throws:
OdaException - if data source error occurs.

getString

public java.lang.String getString(int parameterId)
                           throws OdaException
Description copied from interface: IAdvancedQuery
Returns the String value from the designated output parameter. An ODA runtime driver may or may not support getString() on a non-String type parameter. The format of the returned string is implementation- dependent.

Specified by:
getString in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the String value.
Throws:
OdaException - if data source error occurs.

getDate

public java.sql.Date getDate(java.lang.String parameterName)
                      throws OdaException
Description copied from interface: IAdvancedQuery
Returns the java.sql.Date value from the designated output parameter.

Specified by:
getDate in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the java.sql.Date value.
Throws:
OdaException - if data source error occurs.

getDate

public java.sql.Date getDate(int parameterId)
                      throws OdaException
Description copied from interface: IAdvancedQuery
Returns the java.sql.Date value from the designated output parameter.

Specified by:
getDate in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the java.sql.Date value.
Throws:
OdaException - if data source error occurs.

getTime

public java.sql.Time getTime(java.lang.String parameterName)
                      throws OdaException
Description copied from interface: IAdvancedQuery
Returns the java.sql.Time value from the designated output parameter.

Specified by:
getTime in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the java.sql.Time value.
Throws:
OdaException - if data source error occurs.

getTime

public java.sql.Time getTime(int parameterId)
                      throws OdaException
Description copied from interface: IAdvancedQuery
Returns the java.sql.Time value from the designated output parameter.

Specified by:
getTime in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the java.sql.Time value.
Throws:
OdaException - if data source error occurs.

getTimestamp

public java.sql.Timestamp getTimestamp(java.lang.String parameterName)
                                throws OdaException
Description copied from interface: IAdvancedQuery
Returns the java.sql.Timestamp value from the designated output parameter.

Specified by:
getTimestamp in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
the java.sql.Timestamp value.
Throws:
OdaException - if data source error occurs.

getTimestamp

public java.sql.Timestamp getTimestamp(int parameterId)
                                throws OdaException
Description copied from interface: IAdvancedQuery
Returns the java.sql.Timestamp value from the designated output parameter.

Specified by:
getTimestamp in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
the java.sql.Timestamp value.
Throws:
OdaException - if data source error occurs.

getBlob

public IBlob getBlob(java.lang.String parameterName)
              throws OdaException
Description copied from interface: IAdvancedQuery
Returns the IBlob value from the designated output parameter.

Note: The driver must guarantee that the returned IBlob object and its BLOB data would remain valid and accessible until this query instance is closed.

Specified by:
getBlob in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
an IBlob object that represents the BLOB value; or null if the specific parameter has null value.
Throws:
OdaException - if data source error occurs

getBlob

public IBlob getBlob(int parameterId)
              throws OdaException
Description copied from interface: IAdvancedQuery
Returns the IBlob value from the designated output parameter.

Note: The driver must guarantee that the returned IBlob object and its BLOB data would remain valid and accessible until this query instance is closed.

Specified by:
getBlob in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
an IBlob object that represents the BLOB value; or null if the specific parameter has null value.
Throws:
OdaException - if data source error occurs

getClob

public IClob getClob(java.lang.String parameterName)
              throws OdaException
Description copied from interface: IAdvancedQuery
Returns the IClob value from the designated output parameter.

Note: The driver must guarantee that the returned IClob object and its CLOB data would remain valid and accessible until this query instance is closed.

Specified by:
getClob in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
an IClob object that represents the CLOB value; or null if the specific parameter has null value.
Throws:
OdaException - if data source error occurs

getClob

public IClob getClob(int parameterId)
              throws OdaException
Description copied from interface: IAdvancedQuery
Returns the IClob value from the designated output parameter.

Note: The driver must guarantee that the returned IClob object and its CLOB data would remain valid and accessible until this query instance is closed.

Specified by:
getClob in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
an IClob object that represents the CLOB value; or null if the specific parameter has null value.
Throws:
OdaException - if data source error occurs

getRow

public IParameterRowSet getRow(java.lang.String parameterName)
                        throws OdaException
Description copied from interface: IAdvancedQuery
Returns the structure value from the designated output parameter. This is not intended to return table structures.
An optional method; applicable only if named structure output parameters are supported.

Specified by:
getRow in interface IAdvancedQuery
Parameters:
parameterName - name of the parameter.
Returns:
an IParameterRowSet object with a single row.
Throws:
OdaException - if data source error occurs.

getRow

public IParameterRowSet getRow(int parameterId)
                        throws OdaException
Description copied from interface: IAdvancedQuery
Returns the structure value from the designated output parameter.
An optional method; applicable only if structure output parameters are supported.

Specified by:
getRow in interface IAdvancedQuery
Parameters:
parameterId - id of the parameter (1-based).
Returns:
an IParameterRowSet object with a single row.
Throws:
OdaException - if data source error occurs.

findOutParameter

public int findOutParameter(java.lang.String parameterName)
                     throws OdaException
Description copied from interface: IAdvancedQuery
Returns the 1-based index of the specified scalar or structure output parameter.

Specified by:
findOutParameter in interface IAdvancedQuery
Parameters:
parameterName - name of the output parameter.
Returns:
index of the output parameter.
Throws:
OdaException - if data source error occurs.

wasNull

public boolean wasNull()
                throws OdaException
Description copied from interface: IAdvancedQuery
Returns whether the value read from the previous get<type> method was null.

Specified by:
wasNull in interface IAdvancedQuery
Returns:
true, if the last get<type> call was null.
Throws:
OdaException - if data source error occurs.

setSortSpec

public void setSortSpec(java.lang.String resultSetName,
                        SortSpec sortBy)
                 throws OdaException
Description copied from interface: IAdvancedQuery
Specifies the sort specification for the named result set of this IAdvancedQuery. This setter must be called before this is executed. More sort keys can be added to the SortSpec after it is associated with the query. The final sort specification is applied to the result set(s) at execution.

It is up to individual ODA runtime drivers to validate the type of sort specification that are acceptable to the provider, based on its level of dynamic sorting support. An OdaException should be thrown if the specified sort specification is not valid or not supported by the driver.

Specified by:
setSortSpec in interface IAdvancedQuery
Parameters:
resultSetName - name of the result set.
sortBy - the sort specification to apply to the specified result set.
Throws:
OdaException - if data source error occurs.

getSortSpec

public SortSpec getSortSpec(java.lang.String resultSetName)
                     throws OdaException
Description copied from interface: IAdvancedQuery
Returns the sort specification associated with the named result set of this IAdvancedQuery.

Specified by:
getSortSpec in interface IAdvancedQuery
Parameters:
resultSetName - name of the result set.
Returns:
the SortSpec associated with the specified result set; null if no SortSpec was explicitly set.
Throws:
OdaException - if data source error occurs.

getBigDecimalAsString

public java.lang.String getBigDecimalAsString(java.lang.String parameterName)
                                       throws OdaException
Throws:
OdaException

getBigDecimalAsString

public java.lang.String getBigDecimalAsString(int parameterId)
                                       throws OdaException
Throws:
OdaException

getDateAsString

public java.lang.String getDateAsString(java.lang.String parameterName)
                                 throws OdaException
Throws:
OdaException

getDateAsString

public java.lang.String getDateAsString(int parameterId)
                                 throws OdaException
Throws:
OdaException

getTimeAsString

public java.lang.String getTimeAsString(java.lang.String parameterName)
                                 throws OdaException
Throws:
OdaException

getTimeAsString

public java.lang.String getTimeAsString(int parameterId)
                                 throws OdaException
Throws:
OdaException

getTimestampAsString

public java.lang.String getTimestampAsString(java.lang.String parameterName)
                                      throws OdaException
Throws:
OdaException

getTimestampAsString

public java.lang.String getTimestampAsString(int parameterId)
                                      throws OdaException
Throws:
OdaException

getInterfaceName

public java.lang.String getInterfaceName()
Overrides:
getInterfaceName in class OdaQuery


Copyright © 2005 Actuate Corp. All rights reserved.