Created
June 27, 2014 18:40
-
-
Save stevewithington/fe0dcd53b18b340f8ffa to your computer and use it in GitHub Desktop.
ColdFusion / CFML : get a query containing the desired row data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
/** | |
* @param qry The query containing the desired data (required) | |
* @param row The desired row number (optional) | |
* @return Returns a query containing the desired row data | |
*/ | |
public query function getQueryRow(required query qry, numeric row) { | |
var requestedRow = StructKeyExists(arguments, 'row') ? arguments.row : arguments.qry.currentrow; | |
var rs = QueryNew(arguments.qry.columnList); | |
QueryAddRow(rs); | |
for ( var col in ListToArray(arguments.qry.columnList) ) { | |
QuerySetCell(rs, col, arguments.qry[col][requestedRow]); | |
} | |
return rs; | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment