Class allaire.dcf.recordset.Query
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class allaire.dcf.recordset.Query

java.lang.Object
   |
   +----allaire.dcf.recordset.Query

public class Query
extends Object
A class that executes Cold Fusion templates on remote servers. The templates typically contain one or more SQL queries which are returned in text format and then parsed into Recordset objects for use by the client object.
See Also:
Recordset

Constructor Index

 o Query(String)
Create a new query object which is linked to a template on a remote server.

Method Index

 o addParam(String, String)
Add a named parameter to the query (the parameter will be URL encoded and appended to the URL submitted to the remote server).
 o execute()
Execute the template on the remote server using the specified parameters.
 o getRecordset()
Gets the recordset fetched by the query from the remote template.
 o getRecordset(String)
Gets a named recordset fetched by the query from the remote template.
 o getRecordsets()
Gets all of the Recordsets fetched by the query from the remote server.
 o resetParams()
Reset the parameter list to empty.

Constructors

 o Query
  public Query(String strTemplateURL)
Create a new query object which is linked to a template on a remote server. Constructing a Query object does not cause the Query to be executed (this is accomplished using the execute() method).

Parameters:
strTemplateURL - The fully qualified URL of the template be used by the Query.

Methods

 o addParam
  public void addParam(String strName,
                       String strValue)
Add a named parameter to the query (the parameter will be URL encoded and appended to the URL submitted to the remote server).

Parameters:
strName - The name of the parameter.
strValue - The value of the parameter.
 o resetParams
  public void resetParams()
Reset the parameter list to empty. This erases all parameters previously added using the addParam() method.
 o execute
  public void execute() throws Exception
Execute the template on the remote server using the specified parameters. All Recordsets returned by the template will be parsed and made available using the getRecordset member functions.
Throws: Exception
Throws an exception if one of several types of error occurs including:
  1. A malformed URL was used to construct the Query.
  2. A network I/O error occurs.
  3. A database or syntax error occurs in the template.
  4. The Recordset syntax in the template is invalid.
 o getRecordset
  public Recordset getRecordset() throws Exception
Gets the recordset fetched by the query from the remote template. Use this version of getRecordset when the template returns a single (typically unnamed) Recordset.
Returns:
The Recordset fetched by the query.
Throws: Exception
Throws an exception if no Recordset was returned by the query.
 o getRecordset
  public Recordset getRecordset(String strName) throws Exception
Gets a named recordset fetched by the query from the remote template. Use this version of getRecordset when the template returns multiple, named Recordsets. Note that Recordset names are case-sensitive.
Parameters:
strName - The name of the Recordset to retreive.
Returns:
The Recordset with the specified name.
Throws: Exception
Throws an exception if no Recordset with the passed name was returned by the Query.
 o getRecordsets
  public Dictionary getRecordsets()
Gets all of the Recordsets fetched by the query from the remote server.
Returns:
A Dictionary (keyed by Recordset name) containing all of the Recordsets returned by the Query.

All Packages  Class Hierarchy  This Package  Previous  Next  Index