Icon View Thread

The following is the text of the current message along with any replies.
Messages 31 to 38 of 38 total
Thread huge blobs are slowing down paint in edb manager
Thu, Dec 10 2009 4:25 PMPermanent Link

"Lucian Radulescu"
> I understand, but again, we don't control this - it is controlled by
> the db.pas unit that comes with Delphi and the common TBlobField
> functionality.

Sure but what happens with the BLOB field space in the .DAT file? What
stops you from storing its size there and let db.pas do its crap inside
the .BLB file, if I'm not mistaken


Lucian
Fri, Dec 11 2009 2:42 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Lucian

>> I understand, but again, we don't control this - it is controlled by
>> the db.pas unit that comes with Delphi and the common TBlobField
>> functionality.
>
>Sure but what happens with the BLOB field space in the .DAT file? What
>stops you from storing its size there and let db.pas do its crap inside
>the .BLB file, if I'm not mistaken

The problem, unless I'm misunderstanding what Tim's saying, is that without some special field type which doesn't exist in Delphi you wouldn't be able to access the information; and if Tim starts implementing special field types he's go a m massive job on his hands.

A part way solution would be for you to create a real column in the table (integer) and create triggers to update that column with the blob's size when its inserted, updated or deleted.

Roy Lambert [Team Elevate]
Fri, Dec 11 2009 12:30 PMPermanent Link

"Lucian Radulescu"
> A part way solution would be for you to create a real column in the
> table (integer)

That's how I implememted it.

> and create triggers to update that column with the

No need for triggers, when I insert a new record I obviously know the
size of file I'm sending to the BLOB. Update/delete never happens.


But you got me curious: how can you find out the size of the BLOB from
inside a trigger?

regards,
Lucian
Fri, Dec 11 2009 4:13 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Lucian,

<< Sure but what happens with the BLOB field space in the .DAT file? What
stops you from storing its size there and let db.pas do its crap inside the
..BLB file, if I'm not mistaken >>

We *do* store it there, but there's no way in Delphi for us to get at it in
relation to the TBlobField component, because TBlobField is part of the
common db.pas code, and not something that they allow you to extend for
descendant datasets.  This is the code that they use to get the BLOB size:

function TBlobField.GetBlobSize: Integer;
begin
 with DataSet.CreateBlobStream(Self, bmRead) do
   try
     Result := Size;
   finally
     Free;
   end;
end;

As you can see, they don't call back into the TDataSet into a method that
would allow us to override this behavior, so we would have to create a
TBlobField descendant class in order to override the GetBlobSize method.
Unfortunately, this involves a few very dicey issues with how TFields are
created by the base TDataSet component.

That is why I said that I'll look into adding a new method or property that
allows you to retrieve it quickly and directly from the row buffer.  The
only downside is that it will involve setting up event handlers for the
TBlobField's OnGetText/OnSetText events in your application in order to
override the default behavior, which is how we change this behavior in the
EDB Manager.

--
Tim Young
Elevate Software
www.elevatesoft.com
Sat, Dec 12 2009 4:34 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Lucian

>No need for triggers, when I insert a new record I obviously know the
>size of file I'm sending to the BLOB. Update/delete never happens.

Intriguing, what sort of app is it with no update/deletes?

>But you got me curious: how can you find out the size of the BLOB from
>inside a trigger?

Easy - use a before update trigger

SET NEWROW.blobsizefield = LENGTH(NEWROW.blobfield);

Roy Lambert [Team Elevate]
Sat, Dec 12 2009 10:55 AMPermanent Link

"Lucian Radulescu"
> Intriguing, what sort of app is it with no update/deletes?

I thought we were talking about the BLOB. There are tons of apps that
store stuff in blobs fields, which are not meant for deleting/updating.
Yes you may delete/update records, but not the blob of a record.


> LENGTH(NEWROW.blobfield);

Nice, thanks
Lucian
Sun, Dec 13 2009 7:23 AMPermanent Link

Charalampos Michael
> << I am not intending to learn the fish to swim, >>
>
> That's a good saying - I'll have to remember it. Smiley(and no problem, I
> know that you meant teach).
>
> << but can BLOB size be changed without editing and posting it? If not,
> then, IMHO, there is no reason to determine BLOB size each time when
> reading the record. >>
>
> I understand, but again, we don't control this - it is controlled by the
> db.pas unit that comes with Delphi and the common TBlobField
> functionality. Internally, EDB only stores a new BLOB size when a BLOB
> is loaded, modified, and then saved.

Well, you can patch TBlobField at runtime as we do in Fastcode. Wink

--
Charalampos Michael - [Creation Power] - http://www.creationpower.gr
Sun, Dec 13 2009 7:55 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Charalampos


>Well, you can patch TBlobField at runtime as we do in Fastcode. Wink

Is there a link for that?

Roy Lambert
« Previous PagePage 4 of 4
Jump to Page:  1 2 3 4
Image