I'm trying to set up a data gateway object as part of a new project I'm
working on, but I don't really know what its methods should look like.

I have a getAll() method that returns all rows from the database and a
getById() method that accepts one or more ID values and returns the
corresponding rows. This works fine for simple tables, but I also have a
large search form where users fill in their criteria for running ad-hoc
queries.  How should I implement this in the DG object?

The approach I'm exploring uses a method called getByCriteria() which
accepts a GatewayCriteria object.  This object contains all of the
ad-hoc criteria definitions including the data member to match (i.e.
fieldname), search type (exact match, pattern match, etc) and value(s)
look for.  The data gateway object loops through the criteria and
creates the dynamic SQL for running that query.

Is there a better way?  

Thanks in advance for any suggestions,
Seth


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

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


Reply via email to