Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Blob size mismatch in BLOB file for physical record
Thu, Jun 18 2009 12:08 AMPermanent Link

"Adam H."
Hi Tim,

In one of my application I use the DevExpress Spreadsheet components to load
and save spreadsheets to a stream, and then into a DBISam table (and back
again).

I have hit a snag where when I go and edit some spreadsheets, and then
attempt to save the changes into DBISam the DBISam table becomes corrupted.

I use the following script to save my spreadsheet:

-----------------------------------------------------------
   Stream := TMemoryStream.Create;
   cxspreadsheet1.SaveToStream(Stream);
   Stream.Position := 0;
   SSTemplateT.open;

   if SSTemplateT.locate('Name', TemplateName, []) then
     SSTemplateT.edit
   else
     SSTemplateT.insert;

   SSTemplateTName.value := TemplateName;
   TBlobField(SSTemplateTSettings).loadfromstream(stream);

   SSTemplateT.Post;
   NowSaved := True;
   Stream.Free;
   exit;
-----------------------------------------------------------

The problem doesn't seem to happen all the time, but does quite frequently.
I can verify that prior to the editing / inserting of the record the dbisam
table is fine, but after it becomes corrupt.

If I perform a repair on the table, then I also have problems reading the
stream back into the spreadsheet. (The stream information appears to be
corrupted by the repair process), but strangely enough if I 'ignore' the
fact that DBISam verifies the table as having errors and don't repair the
table but continue to use the (corrupt) table - I can load and save the
spreadsheet as many times as I wish without problems.

The two verification errors I get are:

Invalid intra-block pointers in BLOB file for physical record #31
and
BLOB size mismatch in BLOB file for physical record #31

I am able to replicate the problem by creating an application with the
following code in it (using the 1.str file saved in the binary forum).

const
templatename = 'CorruptRecord';
var
stream : TMemoryStream;
begin
   Stream := TMemoryStream.Create;
   Stream.LoadFromFile('c:\temp\1.str');  //THE STREAM IN THE BINARY FORUM
   Stream.Position := 0;
   SSTemplateT.open;
   if SSTemplateT.locate('Name', TemplateName, []) then
     SSTemplateT.edit
   else
     SSTemplateT.insert;
   SSTemplateTName.value := TemplateName;
   TBlobField(SSTemplateTSettings).loadfromstream(stream);
   SSTemplateT.Post;
   Stream.Free;
   exit;
end;

I have placed the file 1.str in the binaries forum under the topic titled
"Stream that causes corruption in DBISam", along with the SQL to create the
SSTemplateT DBISam table.

Can you please take a look and see if I'm doing anything wrong with my code
above, or whether there is a problem with DBISam not storing the stream
correctly?

Thanks & Regards

Adam.
Thu, Jun 18 2009 12:11 AMPermanent Link

"Adam H."
Hi Tim,

Sorry - should have stated I'm using DBISam 4.28 Build 2 in RAD 2007 on a
Windows Vista machine.

Cheers

Adam.
Thu, Jun 18 2009 11:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< The problem doesn't seem to happen all the time, but does quite
frequently. I can verify that prior to the editing / inserting of the record
the dbisam table is fine, but after it becomes corrupt. >>

Is this a multi-user or single-user application ?  If multi-user, did you
get my recent email regarding mixing 4.27 and 4.28 versions ?

<< I have placed the file 1.str in the binaries forum under the topic titled
"Stream that causes corruption in DBISam", along with the SQL to create the
SSTemplateT DBISam table.

Can you please take a look and see if I'm doing anything wrong with my code
above, or whether there is a problem with DBISam not storing the stream
correctly? >>

It works every time just fine for me with 4.28.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jun 18 2009 6:47 PMPermanent Link

"Adam H."
Hi Tim,

The application is a multi-user application however the problem I am having
is on my own development machine running locally. Maybe I've got some old
component references in there somewhere - I will go back and double-check.

Best Regards

Adam.

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:ACF14B45-CC0B-457C-AADA-EA1FBBB99F04@news.elevatesoft.com...
> Adam,
>
> << The problem doesn't seem to happen all the time, but does quite
> frequently. I can verify that prior to the editing / inserting of the
> record the dbisam table is fine, but after it becomes corrupt. >>
>
> Is this a multi-user or single-user application ?  If multi-user, did you
> get my recent email regarding mixing 4.27 and 4.28 versions ?
>
> << I have placed the file 1.str in the binaries forum under the topic
> titled "Stream that causes corruption in DBISam", along with the SQL to
> create the SSTemplateT DBISam table.
>
> Can you please take a look and see if I'm doing anything wrong with my
> code above, or whether there is a problem with DBISam not storing the
> stream correctly? >>
>
> It works every time just fine for me with 4.28.
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>
Thu, Jun 18 2009 7:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< The application is a multi-user application however the problem I am
having is on my own development machine running locally. Maybe I've got some
old component references in there somewhere - I will go back and
double-check. >>

Make sure that you're not updating the table with 4.28 and then trying to
repair it with 4.27.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jun 19 2009 10:38 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

Never mind - there appears to be an issue with the repair and BLOBs in 4.28
that is reporting false information about corruption.  I'll relay more
information when I find it out.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Jun 22 2009 6:22 PMPermanent Link

"Adam H."
Hi Tim,

Thanks for your reply and sorry for taking so long to get back to you. Got
stuck on other issues...

I notice their's a new update available for DBISam that looks like it
addresses this issue, so I'll give this a shot.

Thanks again for your help!

Best Regards

Adam.

> Never mind - there appears to be an issue with the repair and BLOBs in
> 4.28 that is reporting false information about corruption.  I'll relay
> more information when I find it out.
Image