Welcome!

Simon Horwith

Subscribe to Simon Horwith: eMailAlertsEmail Alerts
Get Simon Horwith via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: ColdFusion on Ulitzer

CFDJ: Article

ColdFusion CFC Query in Dreamweaver

An Overlooked Great New Feature

Simon Horwith (pictured), editor-in-chief of ColdFusion Developer's Journal, writes: As a developer I tend to focus my attention on learning the tools that best meet my immediate project needs. As a Macromedia Certified Instructor I am in the position of having to learn all of the new features and tools, even those that I may not personally use very often in development, in order to teach them to my students. My role as a developer is unique in that I spend the majority of my time dealing with application architecture and business objects, whereas the average developer focuses more on the presentation tier on a day-to-day basis. It's very important that I am able to teach Flash forms, PDF and FlashPaper generation, the report builder IDE, and new Dreamweaver features to name a few to people who really need and rely on them to get the job done when they leave the classroom and go back to the office.

I've spent a lot of time recently focusing on these new features, and have been pleasantly surprised to find that I really enjoy many of them much more than I thought I would. In this month's editorial I thought I'd share my insights regarding a new tool that seems to have received little attention even though it's terribly useful and reflects Macromedia's efforts to step in the right direction. It only takes 5 minutes for a developer to explore and learn how to use, so there's no excuse not to be aware of this little gem.

The feature I'm talking about is the new ColdFusion Component Query functionality in Dreamweaver. If you haven't already installed the CFMX 7 Dreamweaver extensions, you have to install those in order to use this new functionality. Once the extensions are installed, you're ready to use the new CFC Query functionality.

Dreamweaver MX has a query builder - you access it by going to the "Application" panel, clicking on the "bindings" tab, and then clicking the plus sign button and selecting recordset. The CFMX 7 Dreamweaver extensions add an enhancement to this recordset builder. If you launch the recordset builder while a CFC is the active file in Dreamweaver, the recordset builder allows you to select a function from the current CFC and have the query code written into that function. There's also a "New Function" button there that allows you to specify a name for a new function to create. If you click this button and assign a name, then finish creating your query and submit it, the recordset builder will create a function with the name you specified. This function will default to not allowing output and to having a "query" return type. The function body will declare a private variable to hold your result set, contain the query you defined, and return that variable. This makes the recordset builder much more useful than it used to be - for the first time we can have the IDE create a query inside a method, which has been written the "right" way, rather than just writing a <CFQUERY> block at the top of our file. It's a major step in the right direction in that it encourages developers to put their queries in CFC methods rather than browsable .cfm files. The code itself also encourages proper use of component variable scoping. Macromedia deserves a round of applause for extending the existing functionality in a way that encourages best practices.

The July issue went out fairly late due to the timing of the CFUnited Conference and the CF 10th birthday party in Newton - both of which I felt deserved a write-up. So, for this month's issue I played catch-up and am happy to say we're getting back on schedule - my apologies to any of you who were inconvenienced by the delay in getting the July issue into your hands. Our focus this month is on debugging and we've got many great articles focused on debugging techniques. Expect to see a few more debugging related articles that didn't make it into this issue in next month's issue of CFDJ. In addition to the debugging articles we also have some great articles on other topics in this issue including, among other things, an insightful article on programming models by Simeon Simeonov - the lead engineer on many versions of ColdFusion. Enjoy!

More Stories By Simon Horwith

Simon Horwith is the CIO at AboutWeb, LLC, a Washington, DC based company specializing in staff augmentation, consulting, and training. Simon is a Macromedia Certified Master Instructor and is a member of Team Macromedia. He has been using ColdFusion since version 1.5 and specializes in ColdFusion application architecture, including architecting applications that integrate with Java, Flash, Flex, and a myriad of other technologies. In addition to presenting at CFUGs and conferences around the world, he has also been a contributing author of several books and technical papers.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
CFDJ News Desk 10/21/05 09:40:33 PM EDT

ColdFusion CFC Query in Dreamweaver. As a developer I tend to focus my attention on learning the tools that best meet my immediate project needs. As a Macromedia Certified Instructor I am in the position of having to learn all of the new features and tools, even those that I may not personally use very often in development, in order to teach them to my students. My role as a developer is unique in that I spend the majority of my time dealing with application architecture and business objects, whereas the average developer focuses more on the presentation tier on a day-to-day basis. It's very important that I am able to teach Flash forms, PDF and FlashPaper generation, the report builder IDE, and new Dreamweaver features to name a few to people who really need and rely on them to get the job done when they leave the classroom and go back to the office.

BReese 09/15/05 10:38:23 AM EDT

Good article, I wonder why the generated code does not use CFQueryParam or offer the choice of which format to output.