Is it because the comparison is done on a numerical basis
and not using single-quotes where necessary?
In looking at base/abstractGateway.cfc the query is built
like:
<cfcase
value="isGteField">
#getFieldExpression(whereNode, Convention)# >= #getFieldExpression(whereNode, Convention, 1)#
</cfcase>
#getFieldExpression(whereNode, Convention)# >= #getFieldExpression(whereNode, Convention, 1)#
</cfcase>
I imagine that if you look at the query it would look
like:
WHERE ... document_d_displayDate >=
5/8/06
when that date value should really be enclosed in quotes. (
... >= '5/8/06')
Probably isGTE() is used to being used on numbers only:
e.g. WHERE ... myBeerCount >= 12
Maybe getFieldExpression() can be modified to return the
_expression_ in quotes if necessary...?
Maybe I am way off-base here...
/Cody
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom McNeer
Sent: Monday, May 08, 2006 11:42 AM
To: [email protected]
Subject: [Reactor For CF] isGTE problem?
Here's the situation: in a small test application, I am retrieving all Documents associated with a given Category. Because of a client's exceedingly weird database naming conventions, I have aliased both the tables and all the fields within.
The following code works great:
<cfset var query = variables.documentGateway.createQuery() />
<cfset var where = query.getWhere() />
<cfset where.setMode("and").addWhere(where.createWhere().isEqual("Document","CategoryID",CategoryID).isEqual("Document","inactive",0)) />
<cfset docList = variables.documentGateway.getByQuery(query) />
However, when I change it as follows, adding a GTE statement, I receive an error:
<cfset where.setMode("and").addWhere( where.createWhere().isEqual("Document","CategoryID",CategoryID).isEqual("Document","inactive",0).isGTE("Document","displayDate",Today)) />
The error is "The field 'document_d_displaydate' does not exist in the object 'tblLPWebDocs_Documents'." This is not correct. The field exists, there are no typos, and the aliasing must be working for Reactor to have pulled the real field and table names.
The same error occurs if I eliminate the isEqual statements:
<cfset where.setMode("and").addWhere(where.createWhere().isGTE("Document","displayDate",Today)) />
... and it occurs when I use a different field:
<cfset where.setMode("and").addWhere(where.createWhere().isGTE("Document","changeUserID",4)) />
But if I change the above to "isEqual":
<cfset where.setMode("and").addWhere(where.createWhere().isEqual("Document","changeUserID",4)) />
... it runs fine.
Has anyone else experienced something like this? Or am I doing something stupid?
--
Thanks,
Tom
Tom McNeer
MediumCool
http://www.mediumcool.com
530 Means St NW, Suite 110
Atlanta, GA 30318
404.589.0560 -- 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/

