BuildSQLQuery

Description

Creates and returns a ResultSet object using a raw SQL string.

You use the BuildQuery method to define a query and filter(s), as opposed to writing a SQL query string and using it with the BuildSQLQuery method.

Like BuildResultSet, this method creates a ResultSet object that you can use to run a query. Unlike BuildResultSet, this method uses a raw SQL string instead of a QueryDef object to build the data structures of the ResultSet object. Do not call this method until you have completely constructed the SQL query string.

Like BuildResultSet, this method generates the data structures needed to store the query data but does not fetch the data. To run the query and fetch the resulting data, you must call the ResultSet object's Execute method.

Unlike BuildResultSet, BuildSQLQuery makes no use of a QueryDef object, so the query defined by the SQL string cannot be manipulated before constructing the ResultSet.

Syntax

VBScript


session.BuildSQLQuery(SQL_string) 

Perl


$session->BuildSQLQuery(SQL_string); 
Identifier
Description
session
The Session object that represents the current database-access session.
SQL_string
A String containing the raw SQL commands for the query.
Return value
A ResultSet Object suitable for running the query.

Examples

VBScript


set sessionObj = GetSession

' Create a SQL string to find all records and display their
' ID and headline fields

sqlString  = "select T1.id,T1.headline from defect T1 where
    T1.dbid <> 0"
set resultSetObj = sessionObj.BuildSQLQuery(sqlString) 

Perl


$sessionobj = $entity->GetSession();



# Create a SQL string to find all records and display their

# ID and headline fields



$sqlString = "select T1.id,T1.headline from defect T1 where
    T1.dbid <> 0";

$resultSetObj = $sessionobj->BuildSQLQuery($sqlString);