I showed you one way in the previous example. The DatabaseBlocks component is loaded as an Application scoped object in the Global.cfm template in the root project directory. As a result you can call methods in dot notation using cfscript below. Here I am calling the SelectRecords method and passing the attributes as the clauses.
<cfscript>
qryResult = Application.DatabaseBlocks.SelectRecords(
selectClause:"FirstName, LastName",
fromClause:"PlumUser",
whereClause:"ID < 10",
orderByClause:"ID");
</cfscript>
You could also call the same method as:
<cfset qryResult = Application.DatabaseBlocks.SelectRecords(blah, blah) />
or use the CFINVOKE tag
I personally like the cfscript syntax because it feels cleaner. Just personal preference.
Spend a few minutes looking at the methods in the DatabaseBlocks.cfc in the components directory to get a feel for the methods. What I have done is create a series of snippets that I can just dump into a page really quickly with a couple keystrokes.
Hope this helps,
Jeff
On 11/2/05, Anne Girardeau <[EMAIL PROTECTED]> wrote:
How would you use the DatabaseBlocks component in conjunction with a custom query? If I can, I would prefer to stick with best practices, especially since I'm still fairly new to CFCs and OOP practices.Thanks,--Anne
