What about setting the mode and then having and addWhere function?
setMode("and")
addWhere(createWhere())
addWhere(createWhere())
setMode("or")
addWhere(createWhere())
setMode("and")
addWhere(createWhere())
I have some grouping Ideas as well, I just have to think them out a little further... But for now, what are your thoughts on the above?
On 4/25/06, Doug Hughes <[EMAIL PROTECTED]> wrote:
" This is a very strange method... why does it take two where clauses
rather than just adding to the current where clause?"
That's where the "inelegant" part comes in. :)
I'm thinking about adding a createWhere() function in the where object. I
could also add an andWhere() and an orWhere() which would allow for:
<cfset where = query.getWhere() />
<cfset
where.andWhere(where.createWhere().isEqual(...).setMode("or").isEqual(...)).
isEqual(...).isEqual() />
Food for thought.
Doug
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf
Of Sean Corfield
Sent: Tuesday, April 25, 2006 5:49 PM
To: [email protected]
Subject: Re: [Reactor For CF] grouping of where clauses
On 4/25/06, Doug Hughes < [EMAIL PROTECTED]> wrote:
> <!--- we want where 1 and where 2 to be true -->
> <cfset where.andWhere(where1, where2) />
This is a very strange method... why does it take two where clauses
rather than just adding to the current where clause?
If it took just one where clause to add, you could do this:
<cfset query = createQuery() />
<cfset where = query.getWhere()
.andWhere(createQuery().getWhere().setMode("or")
.isLike("object","fieldA","xxx")
.isLike("object","fieldB","xxx")
.isLike("object","fieldC","xxx"))
.isEqual("object", "regionId", "yyy")
.isEqual("object", " filetype", "zzz") />
<!--- we've configured the oo query, run it --->
<cfset results = getByQuery(query) />
--
Sean A Corfield -- http://corfield.org/
Got frameworks?
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
-- 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/

