Cfquery Statements and when are they executed ?????
I have a series of cfquery statements at the top of the page as soon as that page is activated does the server take time to search for all those query results or rather does the cf server wait until the query is requested further down the page from that specific cfquery statement before the cfquery statement runs the query why am I asking I have a page that has multiple forms on the one page each separated by cfif statements to ensure the appropriate form is executed when specific conditions are met. Each of the forms have a series of unique cfquery statements and I am wondering should I place all the cf query statements for all the forms at the top of the page before I star running the cfif condition tags or should the appropriate cf query statements be placed directly after each opening cfif tag I look forward to your comments and advice thank you in advance for you assistance Kind Regards Claude Raiola (Director) AustralianAccommodation.com Pty. Ltd. Website: www.AustralianAccommodation.com Email: [EMAIL PROTECTED] -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Cfquery Statements and when are they executed ?????
Claude The template is parsed, then executed. The query (and any other) statements are issued as they are encountered. Any queries within a CFIF are only executed if the CFIF is true. You can prove this by constructing a syntactically correct (for CF) query, but one that generates an SQL error (e.g., Bad table name, etc). If the enclosing CFIF is not true, you will never see the SQL error. You have several choices of where to place the query statements: A) within the CFIF statement, just before any subordinate code that processes the query results B) at the top of the template within a duplicate set of CFIF statements C) Before and with the subordinate code in an included template ala Fusebox D) combinations of the above Where you place the Queries is a matter of style, readability, code reuse and what makes sense for the particular program. In simple programs I tend to use A. As complexity increases I will use C. Another consideration is whether you generate the form(s) and process the results with the same template. Also whether you use the same template/form for Inserts/Updates/detetes/Erroe Display/Completion Display In your specific case, I would include the query just before the form and probably use included templates for each form HTH Dick At 4:25 PM +1000 7/30/00, AustralianAccommodation.com Pty. Ltd. wrote: I have a series of cfquery statements at the top of the page as soon as that page is activated does the server take time to search for all those query results or rather does the cf server wait until the query is requested further down the page from that specific cfquery statement before the cfquery statement runs the query why am I asking I have a page that has multiple forms on the one page each separated by cfif statements to ensure the appropriate form is executed when specific conditions are met. Each of the forms have a series of unique cfquery statements and I am wondering should I place all the cf query statements for all the forms at the top of the page before I star running the cfif condition tags or should the appropriate cf query statements be placed directly after each opening cfif tag I look forward to your comments and advice thank you in advance for you assistance Kind Regards Claude Raiola (Director) AustralianAccommodation.com Pty. Ltd. Website: www.AustralianAccommodation.com Email: [EMAIL PROTECTED] -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Cfquery Statements and when are they executed ?????
Hi, as far as I know queries are executed, when they are encountered in the template. so if you put them on the top of the page, first all the queries are executed. You can verify this by looking at the debug output. I would recommend to break the template to small pieces and put each section in a separate file together with their queries; then using CFINCLUDE, inside each if statements call the appropriate template, somehow similar to FuseBox approach. Cheers Nader --- "AustralianAccommodation.com Pty. Ltd." [EMAIL PROTECTED] wrote: I have a series of cfquery statements at the top of the page as soon as that page is activated does the server take time to search for all those query results or rather does the cf server wait until the query is requested further down the page from that specific cfquery statement before the cfquery statement runs the query why am I asking I have a page that has multiple forms on the one page each separated by cfif statements to ensure the appropriate form is executed when specific conditions are met. Each of the forms have a series of unique cfquery statements and I am wondering should I place all the cf query statements for all the forms at the top of the page before I star running the cfif condition tags or should the appropriate cf query statements be placed directly after each opening cfif tag I look forward to your comments and advice thank you in advance for you assistance = SIGNATURE Nader Molavi Allaire Certified ColdFusion 4.5 Developer Palm, Inc. Email: [EMAIL PROTECTED] ICQ #: 3478405 /SIGNATURE __ Do You Yahoo!? Kick off your party with Yahoo! Invites. http://invites.yahoo.com/ -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.