Hi all,
Does anyone know why I can't build an arbitrarily complex qualifier with EOF?
The following code
CCGGregorianCalendar now = new CCGGregorianCalendar(); now.setMonth(now.getMonth() + 3); args.addObject(now.timestamp()); args.addObject(new NSTimestamp()); String qualString = "(POW((69.1 * ( location.longitude - " + zipCode.longitude() + " ) * cos( " + zipCode.latitude() + " / 57.3)), 2) + " + "POW((69.1 * ( location.latitude - " + zipCode.latitude() + ")), 2)) < " + _selectedMileageOption.intValue() * _selectedMileageOption.intValue() + " and bidCloseDate <= %@ and bidCloseDate > %@"; EOQualifier qual = EOQualifier.qualifierWithQualifierFormat(qualString, args);
Produces
[2007-07-04 14:52:56 EDT] <WorkerThread6> com.webobjects.foundation.NSForwardException for com.webobjects.eocontrol._private.ParseException: Encountered "(" at line 1, column 5. Was expecting one of: <IDENTIFIER> ... <ARGUMENT_PATH> ... "=" ... ">=" ... "<=" ... "=<" ... "<>" ... "!=" ... "=>" ... ">" ... "<" ...
at com.webobjects.eocontrol._private._EOQualifierParser.generateParseException(_EOQualifierParser.java:1044) at com.webobjects.eocontrol._private._EOQualifierParser.jj_consume_token(_EOQualifierParser.java:980) at com.webobjects.eocontrol._private._EOQualifierParser.parseOperatorList(_EOQualifierParser.java:562) at com.webobjects.eocontrol._private._EOQualifierParser.RelOpExpression(_EOQualifierParser.java:638) at com.webobjects.eocontrol._private._EOQualifierParser._expression_(_EOQualifierParser.java:594) at com.webobjects.eocontrol._private._EOQualifierParser.parseLogicalExpression(_EOQualifierParser.java:872) at com.webobjects.eocontrol._private._EOQualifierParser.ParenExpression(_EOQualifierParser.java:616) at com.webobjects.eocontrol._private._EOQualifierParser._expression_(_EOQualifierParser.java:598) at com.webobjects.eocontrol._private._EOQualifierParser.parseLogicalExpression(_EOQualifierParser.java:872) at com.webobjects.eocontrol.EOQualifier.qualifierWithQualifierFormat(EOQualifier.java:941) ...
Do I just give up here and fetch raw rows with a pre-build SQL string, and then use the PK to fetch in the EO when I need it? It's seems super lame to me that EOQualifier can't parse something with parentheses, but maybe I'm missing something obvious.
Mark
|