Mailing List webobjects-dev@wocommunity.org Message #314
From: Jesse Tayler <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] How would you create such an EOQualifier representing Postgresql date_trunc(...)?
Date: Wed, 3 Nov 2021 12:35:37 -0400
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
I’d bet you can call your function, but I’d guess you’d be in raw rows I’m not sure

I’m fairly certain that I create a date-range with a start at 12:00 or whatever and end where I need, knowing if an event has ended, knowing if an event is all-day

I’m not certain about lowest level performance issues, but Timestamps seem to lend themselves reasonably well to this after x but before y query method, if I recall...

On Nov 3, 2021, at 12:21 PM, Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org> wrote:


On 3 Nov 2021, at 14:25, Jesse Tayler <webobjects-dev@wocommunity.org> wrote:

I generally use ERXKeys and fancy methods called dot() and these good ideas let you code into the compiler the structure of whatever query you like to do.

I don’t see anything unusual about your qualifier? Want an example?

I know about ERXKey and friends and use these often. The issue here is that date_trunc() is a function that is executed on the db server. In my case with the ‘day’ parameter it truncates the value to a granularity of ‘day’ by stripping off every detail that is smaller than a day. Thus the comparison selects all entries where the CHECK_IN_TIME (which is a date/time field) is on or after the REQUESTED date/time or any time on the same day. The trunc function makes the comparison independent of anything hour/minute.

To do this with ERXKey etc I would have to select ALL objects and filter in memory. This would kill my app as there are waaay to many requests.


On Nov 3, 2021, at 8:48 AM, Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org> wrote:

No one?
I can live with raw rows but would have been great if anyone knows

---markus---

On 1 Nov 2021, at 12:54, Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org> wrote:

Need to find objects satisfying the following condition:

CHECK_IN_TIME must be at least on the same day or later than REQUESTED. Both values are stored as NSTimestamp with a 15 minutes precision.

In Postgres I would write

...where date_trunc('day', CHECK_IN_TIME) >= date_trunc('day', REQUESTED)

How can I create a qualifier for this? Is this possible at all or do I have to resort to raw rows for SQL?

Thanks
---markus---



Markus Ruggiero

rucotec GmbH                        web https://rucotec.ch
Steinenvorstadt 79                email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701














Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster