An abstract class that represents a query used or created by a ColdFusion Extension (CFX). Queries contain one or more columns of data that extend over a varying number of rows.
virtual int AddRow() |
:AddRow adds a row to a query. |
virtual CCFXStringSet* GetColumns |
:GetColumns retrieves a list of a query's column names. |
virtual LPCSTR GetData( int iRow, int iColumn ) |
:GetData retrieves a data element from a row and column of a query. |
virtual LPCSTR GetName() |
:GetName retrieves the name of a query. |
virtual int GetRowCount() |
:GetRowCount retrieves the number of rows in a query. |
virtual void SetData( int iRow, int iColumn, LPCSTR lpszData ) |
:SetData sets a data element within a row and column of a query. |
virtual void SetQueryString( LPCSTR lpszQuery ) |
This function is deprecated. It might not work, and might cause an error, in later releases. |
virtual void SetTotalTime( DWORD dwMilliseconds ) |
This function is deprecated. It might not work, and might cause an error, in later releases. |
int CCFXQuery::AddRow(void) |
Add a row to the query. Call this function to append a row to a query.
Returns the index of the row that was appended to a query.
The following example shows the addition of two rows to a three-column ('City', 'State', and 'Zip') query:
// First row |
CCFXStringSet* CCFXQuery::GetColumns(void) |
Retrieves a list of the column names contained in a query.
Returns an object of CCFXStringSet class that contains a list of the columns in the query. ColdFusion automatically frees the memory that is allocated for the returned string set, after the request is completed.
The following example gets the list of columns, then iterates over the list, writing each column name back to the user:
// Get the list of columns from the query |
LPCSTR CCFXQuery::GetData(int iRow, int iColumn) |
Gets a data element from a row and column of a query. Row and column indexes begin with 1. You can determine the number of rows in a query by calling :GetRowCount. You can determine the number of columns in a query by retrieving the list of columns using :GetColumns, and then calling :GetCount on the returned string set.
Returns the value of the requested data element.
Parameter |
Description |
|---|---|
iRow |
Row to retrieve data from (1-based) |
iColumn |
Column to retrieve data from (1-based) |
The following example iterates over the elements of a query and writes the data in the query back to the user in a simple, space-delimited format:
int iRow, iCol ; |
LPCSTR CCFXQuery::GetName(void) |
Returns the name of a query.
The following example retrieves the name of a query and writes it back to the user:
CCFXQuery* pQuery = pRequest->GetQuery() ; |
int CCFXQuery::GetRowCount(void) |
Returns the number of rows contained in a query.
The following example retrieves the number of rows in a query and writes it back to the user:
CCFXQuery* pQuery = pRequest->GetQuery() ; |
void CCFXQuery::SetData(int iRow, int iColumn, LPCSTR lpszData) |
Sets a data element within a row and column of a query. Row and column indexes begin with 1. Before calling SetData for a given row, call :AddRow and use the return value as the row index for your call to SetData.
Parameter |
Description |
|---|---|
iRow |
Row of data element to set (1-based) |
iColumn |
Column of data element to set (1-based) |
lpszData |
New value for data element |
The following example shows the addition of two rows to a three-column ('City', 'State', and 'Zip') query:
// First row |
Sign in to your account