Best of Talk (5/16/03)

 
May 09, 2003
by Dina Hess

Title: Help with CFC Design?
Date: 05/16/03      23 Posts
Summary: When a CFC is used to create a data access abstraction layer, what is the best way to make the DSN available and how would you catch any errors? Rather than having a stateless DAO extend a DSN component, it is probably best to create a stateless DSN component that is invoked at the time of construction. As for CFC error handling, just use CFTHROW inside a CFTRY/CFCATCH. For more information about CFCs, visit CFCZone.
 
Title: StructSort question...I'm Racking My Brain Here!!!
Date: 05/16/03      10 Posts
Summary: To "economize" a query that is called often, set an application variable to the query's name and copy it to the request scope. Beyond that, you can sort a structure of structures using the StructSort() function, however, you may want to consider using an array of structures instead.
 
Title: SQL Delete Question
Date: 05/16/03      9 Posts
Summary: How can you delete only two matching records? Suggestions include using a cursor or a subquery, like this:

   DELETE FROM rh_invlevels
   WHERE id IN ( 
      SELECT TOP 2 ID 
      FROM rh_invlevels 
      WHERE id = #form.id# AND Radio_id = #i# )
As a bonus, this thread also includes standard SQL for deleting duplicates.
 
Title: CFC Structure Return Problem
Date: 05/16/03      7 Posts
Summary: When using StructAppend(), remember that it will return a boolean if your syntax looks like this:

   <cfset ReturnStruct =
      StructAppend(ReturnStruct, ErrorStruct)>
If you are not testing the success of the process, your syntax should look like this instead:

   <cfset StructAppend(ReturnStruct, ErrorStruct)>
 

Privacy | FAQ | Site Map | About | Guidelines | Contact | Advertising | What is ColdFusion?
House of Fusion | ColdFusion Jobs | Blog of Fusion | AHP Hosting