> Patrick,
> 
> That's interesting. Do you do it within the query file or with a 
> custom tag or somewhere else?

Here's an example of one of my qry_ files. It seems tedious, but
it's really worthwhile. It accomplishes two things:

1) Allows me to reuse files that expect those attributes a lot
more easily. For example, I can use the same form for data entry,
display/updates, and errors.

2) Decouples the database from the fusebox. If my database 
changes, or if I move to a completely different backend (such
as servlets, LDAP, WDDX, etc.) I only have to change one file,
and the fusedoc doesn't even have to change.

BTW, this is a big part of why I include qry_ files in the 
index.cfm.



Patrick


<!--- 
  ||BEGIN FUSEDOC||
  
  || Properties ||      
  Author: Patrick McElhaney ([EMAIL PROTECTED])
  Created: 2001.03.29
  
  || Responsibilities ||
  I get the profile for the specified user.
  
  || History ||
  
  || Attributes ||
  ==> username : STRING
  <== fistname : STRING
  <== lastname : STRING
  <== email : EMAIL 
  <== phone : STRING
  <== address : STRING
  <== spousename : STRING
  <== comments : STRING
  ||END FUSEDOC||
--->


<cfquery datasource="#request.dsn#" name="temp">
  SELECT * FROM users
  WHERE username = '#attributes.username#'
</cfquery>

<cfscript>
attributes.firstname = temp.firstname;
attributes.lastname = temp.lastname;
attributes.email = temp.email;
attributes.phone = temp.phone;
attributes.address = temp.address;
attributes.spousename = temp.spousename;
attributes.comments = temp.comments;
</cfscript>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to