Mailing List webobjects-dev@wocommunity.org Message #320
From: Hugi Thordarson <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] How would you create such an EOQualifier representing Postgresql date_trunc(...)?
Date: Thu, 4 Nov 2021 10:12:40 +0000
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Could also use a read format. Just tested this and seems to work:

https://gist.github.com/hugith/c97ec7b15b29db8912506db75af9f412

Then there's good old EOSQLQualifier. It's deprecated, but what isn't these days :)

new EOSQLQualifier( EOUtilities.entityNamed( ec, "SomeEntityName" ), "date_trunc('day', CHECK_IN_TIME) >= date_trunc('day', REQUESTED)", null );

- hugi



> On 3 Nov 2021, at 22:15, Ramsey Gurley <webobjects-dev@wocommunity.org> wrote:
>
> Hi Markus,
>
> You could create a derived attribute in your model for the truncated value, but it would calculate that every time you fetch rows as well.
>
> Ramsey
>
>> On Nov 3, 2021, at 9:48 PM, 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
> Confidentiality Notice: This email, including all attachments and replies thereto, are covered by the Electronic Communications Privacy Act, 18 U.S.C. Sections 2510-2521 and are legally privileged. This information is confidential, and intended only for the use of the individuals or entities named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this transmitted information is strictly prohibited. Please notify us if you have received this transmission in error. Thank you.

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