I'm thinking about placing many of my sql queries into xml files (which I'll
cache in a persitent scope) . For example
<query permissions="admin">
SELECT
*
FROM
users
WHERE
state = <param name="state" datatype="string" default="" maxlength="10"
/>
and country = <param name="country" datatype="string" />
and active = 1
</query>
I have some code that can render an adhoc query interface (gui with inputs
for all parameters etc) .
I have also written a function to invoke the query(by name) with an array of
parameters, (could be named but at moment by ordinal - for ease). I have
functions to use both t <cfquery> with either <cfqueryparam> or a pure
dynamic string. The time taken to parse xml and generate approriate cfquery
is neglible. Use, is like the following
<cfset DBUtils = applications.DBUtils>
<cfset qResults = DBUtils.parameterisedQuery("getStatesByStateCountry",
DBUtils.makeParameters("NSW", "Australia"))>
What do my learned List members think about such an approach? It is a
database independent way of implementing parameterised queries, and all
sorts of other things can be added like type checking, permissions etc
Regards,
Elliot
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/