Tyler,

I was the one who originally posted the code.  I've got to say that it
really depends on the implementation as to whether the code would be
efficient.  I designed the generic DAO based on a current application that
allows the user to fill in any form field at any time.  The only required
fields in the table are the primary key id, and a text field.  They have 30
other fields that they can eventually, or never fill in.  Given this
example, I think my code would be more efficient than yours since if they
update 1 field, the DAO would loop only 2 times.  If I had <cfif>'s coded
for each optional field, it would still need to go through 29 more.  

I still have work to do on my code, and one of the other features I thought
about is to dynamically create the table structure on instantiation.  This
would make the DAO something that you'd want to persist in a shared scope.
The benefit would be that if the table changed, the change would
automatically be realized in the DAO.  You would only have to change your
business logic layer.

Marlon


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Fitch, Tyler
> Sent: Thursday, April 29, 2004 4:34 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] the DAO of CFMX
> 
> I agree with Barney 100%.  I'm much more comfortable in not having any
> loops for each and every INSERT or UPDATE call.  Publishing a file with
> the table structure defining the CRUD statements is much easier to
> account for this like required and non-required fields.  You can hard
> code in a dtLast_update = Now() in your UPDATE statement if the table
> has a field for that.  There are still cfif statements around
> non-required fields, so some conditional logic occurs, but I'd much
> rather have some if statements than loops running.
> 
> We've been using a DAO system since CF 5 or 4.5 w/ cfmodule and when we
> upgraded to components with CFMX it was suggested that we have a single
> SQL broker and store table definitions in a struct like the code example
> previously posted.  There wasn't a very good sense it would scale at all
> with all loops to define the insert/update statements.  We can make very
> specific modifications for each table if needed and not have to worry
> about it breaking the usage of the base component with the other 20
> tables in our system.  We publish a separate component for each
> table/view in the system that we want and know that it can be
> independently modified for enhancements without bringing down all the
> others.
> 
> I've got the tool available here - http://smartermx.com/code - it's
> called Build Services.  I think it's pretty slick - but that's me being
> a proud parent.  If you want to play with it, note the restiction on
> being able to run it on CFMX 6.1.
> 
> That's that.
> 
> t
> 
> **********************************************************************
> Tyler M. Fitch
> Certified Advanced ColdFusion MX Developer
> Portland ColdFusion User Group Manager http://www.pdxcfug.org
> 
> http://isitedesign.com
> **********************************************************************
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Barney Boisvert
> Sent: Thursday, April 29, 2004 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] the DAO of CFMX
> 
> Building a generator that will take a table schema and create a custom
> DAO is only marginally more work than a generic DAO, and it'll be much
> more efficient at runtime, so I suspect that's the way people are going.
> I know of at least a handful of tools that'll do generation like that,
> and I'm sure there are numerous more that are private.
> 
> Cheers,
> barneyb
> 
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at www.mail-
> archive.com/[EMAIL PROTECTED]



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to