Yes Samuel is right, a derived entity will help but it is only part of the 
answer.

When an EO is fetched, all of it is fetched. In this case the blob plus the 
derived attribute so it defeats the purpose. You haven’t avoided fetching the 
blob. 

I’m going to give your EO a name, let’s call it “DataAttachment.plist” with 
schema table “data_attachment”

Let’s say right now you have two attributes:
1) id (the PK)
2) data (the BLOB)

Let’s now make two EOs:
1) DataAttachment.plist
2) DataAttachmentFull.plist

They both map to the same schema table “data_attachment”

But now the original “DataAttachment.plist” will lose the blob and gain the 
derived plus have an optional FK to the “full” eo:
1) id - the PK
2) dataSize - derived attribute of octet_length(data)
3) optional toOneRelationship named “full” that uses the id (pk) but points to 
DataAttachmentFull.plist

And then “DataAttachmentFull.plist” will be:
1) id (the PK)
2) data (the BLOB)

So in this way, you’ll have minimal refactor of your code. Most places will 
still use and fetch “DataAttachment” but when you actually need the blob you’ll 
have to traverse the to-one relationship. Those are the places in code you’ll 
fix. Your app will be speedier since you aren’t fetching the blob until you 
need it. 

> On Jun 24, 2025, at 7:40 PM, Samuel Pelletier via Webobjects-dev 
> <webobjects-dev@lists.apple.com> wrote:
> 
> Hi OC,
> 
> Without more details about your schema and needs, the only thing I see is 
> maybe a derived attribute on an entity may be a starting point.
> 
> Regards,
> 
> Samuel
> 
>> Le 24 juin 2025 à 17:33, ocs--- via Webobjects-dev 
>> <webobjects-dev@lists.apple.com <mailto:webobjects-dev@lists.apple.com>> a 
>> écrit :
>> 
>> Great, thanks! Works like a charm :)
>> 
>> If there is a trick to do this at a higher EOF level, would be nice, but if 
>> there's none, this solves my problem all right. Thanks again!
>> 
>> All the best,
>> OC
>> 
>>> On 24. 6. 2025, at 23:25, Amedeo Mantica <amedeomant...@me.com> wrote:
>>> 
>>> try something like this...
>>> (raw SQL)
>>> 
>>> SELECT id, OCTET_LENGTH(blob_col) AS blob_size_bytes FROM my_table;
>>> 
>>>> Il giorno 24 giu 2025, alle ore 21:27, ocs--- via Webobjects-dev 
>>>> <webobjects-dev@lists.apple.com> ha scritto:
>>>> 
>>>> Hi there,
>>>> 
>>>> the subject says it all. I've got a FS which reads in some columns set up 
>>>> through setRawRowKeyPaths. The entity contains also a BLOB column which 
>>>> can be rather big. Is there a trick to get its size only in the result 
>>>> dictionaries, without actually fetching the data?
>>>> 
>>>> If db-specific, with FrontBase.
>>>> 
>>>> Thanks a lot!
>>>> OC
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/amedeomantica%40me.com
>>>> 
>>>> This email sent to amedeomant...@me.com
>>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com 
>> <https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com>
>> 
>> This email sent to sam...@samkar.com <mailto:sam...@samkar.com>
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com 
> <mailto:Webobjects-dev@lists.apple.com>)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com 
> <https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com>
> 
> This email sent to aa...@chatnbike.com <mailto:aa...@chatnbike.com>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to