Adobe ColdFusion 8

CCFXQuery::GetColumns

Syntax

CCFXStringSet* CCFXQuery::GetColumns(void)

Description

Retrieves a list of the column names contained in a query.

Returns

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.

Example

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
    CCFXStringSet* pColumns = pQuery->GetColumns() ;
    int nNumColumns = pColumns->GetCount() ;
     
    // Print the list of columns to the user
    pRequest->Write( "Columns in query: " ) ;
    for( int i=1; i<=nNumColumns; i++ )
    {
        pRequest->Write( pColumns->GetString( i ) ) ;
        pRequest->Write( " " ) ;
    }