Please send questions regarding the usage of torque to the users list.
There are more people around which can help you with your problems than on
the dev list, you will get quicker answers.
Thanks a lot,
Thomas
P.S. look at the bottom of the peers howto, there is a code sample of how
to use the and and or methods.
"Shekhar" <[EMAIL PROTECTED]> schrieb am 30.04.2005 02:14:31:
> Dear sir,
>
> i don't know where to submit my query ?????.
>
> this is my sql query, if i execute the below query in sql prompt it
> is working successfully. i'm using MySQL database.
>
> SELECT *
> FROM `schedule` where (startdate>= '20050428100000') and (startdate
> <= '20050428155959' ) or (enddate>= '20050428100000') and (enddate
> <= '20050428155959' ) ;
>
> i'm facing big problem with Torque OR criteria. how do i implement
> the above sql query into OR criteria pls send your sample code to me
> [EMAIL PROTECTED]
> advance thangs to you.
> =======================================
> public boolean checkRangelist(String startdate,String enddate)
> boolean bresult= false;
> Criteria cr1 = new Criteria();
>
> //schedule start date
> if(startdate.length()>0){
> cr1.or(ChannelSchedulePeer.STARTDATE,new
> StringBuffer("'"+startdate+"'"),Criteria.GREATER_EQUAL);
> Criteria.Criterion cre1 = cr1.
> getCriterion(ChannelSchedulePeer.STARTDATE);
> cre1.and(cr1.getNewCriterion(
> cre1.getTable(),
> cre1.getColumn(),
> new StringBuffer("'"+enddate+"'"),
> Criteria.LESS_EQUAL)
> );
>
> }
> //schedule end date
> if(enddate.length()>0){
> cr1.or(ChannelSchedulePeer.ENDDATE,new
> StringBuffer("'"+startdate+"'"),Criteria.GREATER_EQUAL);
> Criteria.Criterion cre2 = cr1.
> getCriterion(ChannelSchedulePeer.ENDDATE);
> cre2.and(cr1.getNewCriterion(
> cre2.getTable(),
> cre2.getColumn(),
> new StringBuffer("'"+enddate+"'"),
> Criteria.LESS_EQUAL)
> );
> }
> cr1.addAscendingOrderByColumn(ChannelSchedulePeer.STARTDATE);
>
> lst = ChannelSchedulePeer.doSelect(cr1);
>
> System.out.println(cr1.toString());
>
> if(lst.size()>0)
> bresult=true;
>
> }
> catch(Exception ex){
> sError="Error="+ex.getMessage();
>
> }
>
> return bresult;
> }
> ======================================
> this is the error i get when i try to execute the code
> Current Query SQL (may not be complete or applicable): SELECT
> Channel_Schedule.SCHEDULE_ID, Channel_Schedule.DESCRIPTION,
> Channel_Schedule.COURSEXLET_ID, Channel_Schedule.STARTDATE,
> Channel_Schedule.ENDDATE FROM Channel_Schedule WHERE
> (Channel_Schedule.STARTDATE>='20050428100000' AND Channel_Schedul
> e.STARTDATE<='20050428155959') AND (Channel_Schedule.
> ENDDATE>='20050428100000' AND Channel_Schedule.
> ENDDATE<='20050428155959') ORDER BY Channel_Schedule.STARTDATE ASC
>
> every thing fine execpt AND pls send your sample code as soon as
> you can....very urgent
>
> thanks in advance
> Shekhar
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]