I had fixed the BOOLEANCHAR problem in the trunk, but just added it to
the 2.1 branch as well.
Scott Eade wrote:
>
> John,
>
> I haven't seen any replies to my posting of a few days
> ago. I know you fixed a different problem to do with
> BOOLEANCHAR a few weeks back so I thought
> it might be a good idea to double check that you
> caught this one too.
>
> Cheers,
>
> Scott
>
> ----- Original Message -----
> From: "Scott Eade" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, July 15, 2001 11:27 AM
> Subject: Criteria problems
>
> > I think I have found a couple of problems with Criteria.
> >
> > 1. Booleans when using BOOLEANCHAR.
> >
> > My schema includes:
> > <column name="ACTIVE" required="true" type="BOOLEANCHAR"/>
> > If my criteria includes:
> > criteria.add(SubscriptionPeer.ACTIVE, true);
> > The criteria produces:
> > AND (SUBSCRIPTION.ACTIVE=1)
> > where as it should produce:
> > AND (SUBSCRIPTION.ACTIVE='Y')
> >
> > Currently to make it work I need to code the criteria as:
> > criteria.add(SubscriptionPeer.ACTIVE, "Y");
> > which won't be any good if I decide later to change to BOOLEANINT.
> >
> > 2. Using addDate(column, year, month day, comparison).
> >
> > This produces some really wacky criteria output. For
> > example:
> > criteria.addDate(SubscriptionPeer.END_DATE, 2001, 7, 15,
>Criteria.GREATER_THAN);
> > produces:
> > AND
> >
>
>(SUBSCRIPTION.END_DATE>java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=jav
> >
>
>a.util.SimpleTimeZone[id=Australia/Sydney,offset=36000000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,st
> >
>
>artMonth=7,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=2,endMonth=2,endDay=-1,endDayOfWeek=1,
> >
>
>endTime=7200000,endTimeMode=1],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2001,MONTH=7,WEEK_OF_YEAR=?,WEEK_OF_
> >
>
>MONTH=?,DAY_OF_MONTH=15,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=?,HOUR=?,HOUR_OF_DAY=?,MINUTE=?,SECOND=
> > ?,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?])
> >
> > I'm using MySql so I would have expected:
> > AND (SUBSCRIPTION.END_DATE>'2001-07-15')
> >
> > Instead I am using the trick provided by Howard Lin where
> > I define an inner class that returns "CURRENT_DATE" when
> > toString() is invoked (the example provided was based on
> > Oracle's "sysdate".
> >
> > This work around is pretty good, but it would be better if
> > Criteria provided a set of constants that could be used in
> > order to access some of the more commonly used ANSI SQL
> > no-arg functions such as CURRENT_DATE, CURRENT_TIME,
> > and CURRENT_TIMESTAMP. All they need to do is
> > provide an object that will return the appropriate string when
> > toString() is invoked.
> >
> > Of course this is only useful if I want to compare to today's
> > date. With the problem above I have two other options
> > available for comparing dates:
> >
> > A. Use a non-portable date wrapper that will produce a
> > date string in MySql format.
> >
> > B. Use prepared statements as discussed recently on the
> > mailing list. As it stands I don't like the fact that this
> > work around required me to edit the base peer classes
> > produced by torque - if I change my schema and regenerate
> > my peer classes I will have to go and make the changes
> > again.
> >
> > I am not sure what the long term solution is. Being able
> > to pass a standard java.util.Date to the various Criteria
> > methods would be ideal, but I assume there are unresolved
> > database portability issues with the torque code providing
> > for this and/or that there are performance implications in using
> > using prepared statements for all queries in order to cater for
> > this.
> >
> > Cheers,
> >
> > Scott
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]