Simone
02/25/2022, 10:15 PM<cffunction name="getRealSQL" returntype="string">
<cfargument name="qryResult" type="any">
<cfset realSQL = QueryExecute("#arguments.qryResult#",{},{datasource="#Application.DSN#"})>
<cfloop array="#arguments.qryResult.sqlParameters#" index="a">
<cfscript>
if (NOT isNumeric(a)) a = "'#a#'";
realSQL = Replace(realSQL, "?", a);
</cfscript>
</cfloop>
<cfreturn realSQL>
</cffunction>
if the function is right, what should i pass an argument, a query object or query results or what?Myka Forrest
02/25/2022, 10:18 PMqryResult
argument?result
returns and what the QueryExecute
function takes in as its SQL
argument.Simone
02/25/2022, 10:30 PMMyka Forrest
02/25/2022, 10:31 PMSimone
02/25/2022, 10:33 PMMyka Forrest
02/25/2022, 10:34 PMSimone
02/25/2022, 10:37 PMMyka Forrest
02/25/2022, 10:40 PMSimone
02/25/2022, 10:41 PMMyka Forrest
02/25/2022, 10:53 PMdanmurphy
02/25/2022, 10:54 PMMichael Schmidt
02/25/2022, 11:03 PMSimone
02/26/2022, 12:07 AMMyka Forrest
02/26/2022, 12:09 AMSimone
02/26/2022, 12:36 AMMyka Forrest
02/26/2022, 12:42 AMSimone
02/26/2022, 12:50 AMMyka Forrest
02/26/2022, 12:52 AMSimone
02/26/2022, 1:35 AMMyka Forrest
02/26/2022, 1:43 AMtonyjunkes
02/27/2022, 5:24 AMarguments.qryResult
that's different from what you're trying to extract after the fact?
But… Looking away from that, what you're doing to fill in the parameters to the sql string returned from queryExecute doesn't appear to be correct. Calling replace on realSql
, if it is in fact a query object, won't give you the desired result as you need to access the sql
key in the object: realSql.sql
.
Here’s an SO question I answered a while back with code demonstrating what could be done. It’s very similar to the SO post already shared. https://stackoverflow.com/q/64767251/985709