I'll give this some thought.  Thanks for the input.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David A.
Cheslow PhD
Sent: Thursday, March 09, 2006 3:19 PM
To: [email protected]
Subject: Re: [Reactor For CF] why is there no "deleteByQuery" in
abstractgateway?


Actually, I've been tinkering around with just those thoughts.  I  
have concluded that 'deleteByFields()' implemented in reactor/ 
projects/MYOBJECTGateway.cfc would do exactly what I want, is a bit  
more guarded and be VERY easy to implement.  Right now I am just  
copying it to the necessary classes in my local reactor directory and  
changing them manually.

NOTE: this code is only useful when the object has been identified as  
a 'link' table in a many-to-many relationship, where the two (or  
more) optional arguments are the two (or more) foreign keys from the  
link table.  I use this a lot when implementing a "delete-all and re- 
insert" save pattern for the many-to-many relationship.  documentrole  
is a table containing only two attributes, documentid and roleid  
which are foreign keys to documents and roles, respectively.  For  
clarity, I took out all the try-catch/transaction code.

        <cffunction name="deleteByFields" access="public" hint="I delete all

matching rows from the documentrole table." output="false"  
returntype="void">
                
                        <cfargument name="documentid" hint="If provided, I
match the  
provided value to the documentid field in the documentrole object."  
required="no" type="string" />
                
                        <cfargument name="roleid" hint="If provided, I match
the provided  
value to the roleid field in the documentrole object." required="no"  
type="string" />
                
                
                <cfquery datasource="#_getConfig().getDsn()#"
username="#_getConfig 
().getUsername()#" password="#_getConfig().getPassword()#">
                        DELETE FROM
                         documentrole
                        WHERE
                        <cfif IsDefined('arguments.documentid')>
                                documentrole.documentid = <cfqueryparam  
cfsqltype="cf_sql_varchar" maxlength="35"  
value="#arguments.documentid#" />
                        </cfif>
                        <cfif IsDefined('arguments.roleid')>
                                documentrole.roleid = <cfqueryparam
cfsqltype="cf_sql_varchar"  
maxlength="35" value="#arguments.roleid#" />
                        </cfif>
                </cfquery>
        </cffunction>




On Mar 9, 2006, at 11:45 AM, Doug Hughes wrote:

> Sorry, I was looking for something using reactor objects.  IE:
>
> I'd like the syntax for this to look like this:
>
> *code Example*
>
> And this means....
>
> Etc, etc.
>
> Doug
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of  
> Peter
> Bell
> Sent: Thursday, March 09, 2006 2:19 PM
> To: [email protected]
> Subject: RE: [Reactor For CF] why is there no "deleteByQuery" in
> abstractgateway?
>
> Delete from #table# Where #Filter# is how we do it. Table is known by
> object, so you just pass filter. It does require knowledge of the  
> object
> properties, but we store that in the #EntityName#Service, so it's OK.
>
> We also have a deletebyqueryimplications() which will return the  
> captions
> for any cascading deletes if you implement that (for composition to  
> avoid
> orphans) so you can tell people what you'll be doing before they do  
> it.
>
> Best Wishes,
> Peter
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of  
> Doug
> Hughes
> Sent: Thursday, March 09, 2006 2:13 PM
> To: [email protected]
> Subject: RE: [Reactor For CF] why is there no "deleteByQuery" in
> abstractgateway?
>
>
> How would this function?  Can you provide some pseudocode?
>
> Doug
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of  
> David A.
> Cheslow PhD
> Sent: Thursday, March 09, 2006 1:40 PM
> To: [email protected]
> Subject: [Reactor For CF] why is there no "deleteByQuery" in
> abstractgateway?
>
> The subject says it all.  Seems to me that a deleteByQuery() would be
> pretty handy (and easy to add) right there.  Or have I missed
> something very obvious?
>
> =dave=
>
>
>
> -- Reactor for ColdFusion Mailing List -- [email protected]
> -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/
>
>
>
>
>
> -- Reactor for ColdFusion Mailing List -- [email protected]
> -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/
>
>
>
>
>
>
> -- Reactor for ColdFusion Mailing List -- [email protected]
> -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/
>
>
>
>
>
> -- Reactor for ColdFusion Mailing List -- [email protected]
> -- Archives at http://www.mail-archive.com/reactor%40doughughes.net/
>
>
>
>


 

-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/



 

-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/


Reply via email to