I'm worse than that.....
 
I also like the column names and table names on lines by themselves (regardless of CFMX).
 
And I preserve CFMX indenting - either in WHERE clauses or anything that makes decisions about TABLE or COLUMN info.
 
Similarly with GROUP BY and ORDER BY (etc.) the keywords go on lines by themselves, followed by the necessary criteria (again preserving CFMX formatting as needed).
 
Regards,
Gary

 
On 8/17/05, Steve Onnis <[EMAIL PROTECTED]> wrote:
I prefer option 2

makes it more readable and easier to follow the code through.  I also prefer to indent the SQL inside the cfquery tag aswell like

<cfquery .....>
       SELECT *
       FROM table t
       WHERE 0=0
       <cfif isDefined("form.keyword") >
               AND title like '%#title#%'
       </cfif>

       <cfif listLen(form.categoryIds) >
               AND category_id IN (#form.categoryIDs#)
       </cfif>
</cfquery>

Just following code indenting consistantly

Steve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] ]On Behalf Of Pat
Branley
Sent: Wednesday, August 17, 2005 9:33 AM
To: CFAussie Mailing List
Subject: [cfaussie] CFQuery Style


Hi All

Just wondering what everyones opinion is about formatting SQL code
withing CFQuery ? Do you think its important to preserve the indentation
of the SQL or is it more important to see the flow of the CF code inside
the tag ?

Im way more in favour of preserving cold fusion indentation. I just
think its more important to follow the logic of the code, especially
when the query gets complex and there are more <CFIF calls in there.

Pat


eg. SQL indentation is Preseved

<cfquery .....>
SELECT *
FROM table t
WHERE 0=0 <cfif isDefined("form.keyword") >
AND title like '%#title#%'</cfif><cfif listLen(form.categoryIds) >
AND category_id IN (#form.categoryIDs#)</cfif>
</cfquery>

OR 2 cold fusion indentation is preserved

<cfquery .....>
SELECT *
FROM table t
WHERE 0=0
<cfif isDefined("form.keyword") >
       AND title like '%#title#%'
</cfif>

<cfif listLen(form.categoryIds) >
       AND category_id IN (#form.categoryIDs#)
</cfif>
</cfquery>

---
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/



---
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/

--- 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/

Reply via email to