getQueryColumns(theQuery)
Last updated January 11, 2011
Version: 1 | Requires: ColdFusion MX | Library: DatabaseLib
Description:
Retrieve a list of column names in the order as defined by SQL for use with CFSpreadsheet (generating a header row) and other loop functions.
Return Values:
Returns a list.
Example:
SELECT orderid, customerfirstname, customerlastname, total
FROM orders
ORDER BY orderid
</cfquery>
<CFSET ColumnList = getQueryColumns(GetOrders)>
Parameters:
| Name | Description | Required |
|---|---|---|
| theQuery | Query object to examine. | Yes |
Full UDF Source:
<cfscript>
/**
* Returns list of query columns in order as defined by SQL query.
*
* @param theQuery Query object to examine. (Required)
* @return Returns a list.
* @author James Moberg (james@ssmedia.com)
* @version 1, January 11, 2011
*/
function getQueryColumns(theQuery){
if(isQuery(theQuery)) return arraytoList(theQuery.getMeta().getColumnLabels());
else return '';
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)