"Denver Braughler" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Muzaffer Dogru wrote:
> > "SELECT * FROM table WHERE table.Date BETWEEN :dateStart AND :dateEnd"
> > :dateStart and :dateEnd are variables I put as parameters into the
> > ClassMethod. They are from the type java.sql.date.
>
> Somewhere they need to be converted to Cache' horolog dates.
>
> > In the database I have 2004-08-13
> 2004-08-13 = 59760.
>
> > How can I compare the java.sql.date with the dates in the database?
> Please post the formal parameters of your classmethod.

 [simplified]:

 ClassMethod matchSameStart(dateRangeStart As %Date, dateRangeEnd As %Date,
timeRangeStart As %Time, timeRangeEnd As %Time) As %ListOfObjects
{
    set result = ##class(%ListOfObjects).%New()

    &SQL(DECLARE cur1 CURSOR FOR SELECT Distinct Offer.ID,
RouteAddress.element_key into :id, :elementKey
            FROM Address As A, Offer As Offer
            WHERE ((A.DateRangeStart BETWEEN :dateRangeStart AND
:dateRangeEnd) AND ((A.TimeRangeStart BETWEEN :timeRangeStart AND
:timeRangeEnd) OR (A.TimeRangeEnd     BETWEEN :timeRangeStart AND
:timeRangeEnd)))
    )

    &SQL(OPEN cur1)
    &SQL(FETCH cur1)
    WHILE (SQLCODE = 0) {
        set offer = ##class(Offer).%OpenId(id)
        Do result.Insert(offer)
        &SQL(FETCH cur1)
    }
    &SQL(CLOSE cur1)
    quit result
}

but even leaving %Time out, it does not work. There must be some error with
the type...




Reply via email to