Adam Cameron
https://i2.paste.pics/8c44dba63d3e573a17e9e4db1733d2d8.png▾
cached
value. getMetadata
only returns column info, not stuff about the query object itself.
Note: I am not asking about the result
option that one can pass to a queryExecute
call. I only have the query object; I am not in control of the initial call, so I cannot use the result
.
Cheers.Adam Cameron
isCached
on the object and that returns what I need. However I'm slightly hesitant to call something that might be considered "internal implementation" and not intended for use in CFML code..?
I see it is documented @ https://javadoc.lucee.org/lucee/runtime/type/Query.html, so perhaps it's OK.
(I'm coming from more exposure to CF, where Adobe advise not to use such methods, as they are not a documented / supported API; might be different with Lucee)neokoenig
02/18/2022, 11:56 AMfunction dumpCachedValue(q) {
var test = dumpStruct(q).comment;
test = listFirst(test, "SQL");
test = listLast(test, "Cached: ");
return test;
}
Adam Cameron
dumpStruct
you are using here?
(and yes, I checked it on trycf and it is a thing. My question still stands 😉neokoenig
02/18/2022, 12:06 PMneokoenig
02/18/2022, 12:06 PMneokoenig
02/18/2022, 12:07 PMneokoenig
02/18/2022, 12:10 PMthisOldDave
02/18/2022, 12:10 PMwriteDump(qryResult.getClass());
which should give you a nice list of methods but be warned not all are implemented. e.g. writeDump(qryResult.getSql().toString());
works,writeDump(qryResult.getMetaData());
doesntthisOldDave
02/18/2022, 12:27 PMwriteDump({
"Sql" = qryResult.getSql().getSQLString(),
"ExecutionTime" = qryResult.getExecutionTime(),
"CacheType" = qryResult.getCacheType(),
"isCached" = qryResult.isCached()
});