Created
October 24, 2014 12:55
-
-
Save Macagare/871715b57502deafefec to your computer and use it in GitHub Desktop.
remove query columns via regex match
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> | |
private query function reduceQueryColumns(required query source, required string columns) { | |
var qReduced = ""; | |
query name="qReduced" dbtype="query" { writeOutput("select #arguments.columns# from arguments.source") }; | |
return qReduced; | |
} | |
private query function reRemoveColumns(required query source, required string regex) { | |
var columns = listToArray(arguments.source.columnlist); | |
for (var i = arrayLen(columns); i >= 1 ; i = i - 1) { | |
if ( rEFindNoCase(arguments.regex,columns[i]) ) arrayDeleteAt(columns,i); | |
} | |
return reduceQueryColumns(arguments.source, arrayToList(columns)); | |
} | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment