Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread 10030 error
Mon, Sep 1 2008 9:33 AMPermanent Link

"Erik"
Hi,

( Delphi 7 and DBIsam 4.25 build 7 )

I have the following problem:

I have saved reports in a blob field.
If I read a blobfield and import the stream in Fastreport with the blobfield
using CreateBlobFromStream(xfield,bmRead) and then
frxReport1.loadformstream.
I can alter the report and afterwards the report will be saved in the
blobfield using CreateBlobFromStream(xfield,bmReadWrite).

I can then alter a different record and alter that report.
After doing that I go back to the previous record I've altered and want to
change the report again, I'll get an 10030 Invalid Blob handle from table
....

The manual says that the error may never occur (eventually the table could
be corrupted: I did a repair : it is not corrupted)

What could be the solution to this?
I uses a TStream object wich I "finally free"

It looks to me if I never can do a CreateBlobFromStream twice (or more) to
the same record ???

who wil have an answer to me ?

regards

Erik

Mon, Sep 1 2008 7:09 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Erik,

Here is the code I use to do exactly the same you want to do.
Please note 2 important details in the "save" code:
You must create the Stream AFTER editing the record and destroy it
BEFORE post. If then you want to navigate to another record and edit it,
you must create another blob stream object.

1.Load from table
var
  Rpt: TDBISAMBlobStream;
  Report: TfrxReport;

  (...)
  Rpt:=TDBISAMBlobStream.Create(TRptFR3, bmRead);
  try
    Report.LoadFromStream(Rpt);
  finally
    Rpt.Free;
  end;

2.Save to table
var
  Rpt: TDBISAMBlobStream;
  Report: TfrxReport;

  (...)
  TblRpt.Edit;
  Rpt:=TDBISAMBlobStream.Create(TblRptFR3, bmWrite);
  try
    Report.SaveToStream(Rpt);
  finally
    Rpt.Free;
  end;
  TblRpt.Post;


Note:
  TblRpt is the table containing the reports.
  TblRptFR3 is the blob field containing the report.


--
Fernando Dias
[Team Elevate]
Mon, Sep 1 2008 8:22 PMPermanent Link

Pat
Hi all,

>I have saved reports in a blob field.

I am interested in the theory behind this Smile 

I just finished saving Invoices (so they can be reprinted) another
way. I just store the Master-Detail records in a separate set of
tables. I use Report Builder v7. I guess your Fastreport and Report
Builder work basically the same.

Question is, do you get the same report formatting by storing data in
a blodfield as you would by retrieving the data from the tables?

I have never used blobs and streaming.

Maybe I can have a 2 field InvoiceReportTable table ?
- field 1: Invoice Number
- field 2: blob field with Invoice data


Regards,
Pat
Tue, Sep 2 2008 1:35 AMPermanent Link

"Erik"
Pat,

I think you misunderstood it.
It is not the data I am saving in a Blobfield , but the reportcode itself:
Fastreports can be saved as a file, what one would normally do, but you can
save that file also in a Blobfield.

The reasing why:
We use two types of reports:
1 type is a report which can be changed / made by our customer
2 type is a "system"-report: only we can change it, it is not accessable
from the customers....

So, if we use a password protected table with a blobfield and a flag S for
System and U for User we are able to let our customers only the U types
alter.

regards,

Erik



"Pat" <pat@downunder.com> schreef in bericht
news:a80pb41mm621dtgefq8vp8aplq6abrohs9@4ax.com...
> Hi all,
>
>>I have saved reports in a blob field.
>
> I am interested in the theory behind this Smile
>
> I just finished saving Invoices (so they can be reprinted) another
> way. I just store the Master-Detail records in a separate set of
> tables. I use Report Builder v7. I guess your Fastreport and Report
> Builder work basically the same.
>
> Question is, do you get the same report formatting by storing data in
> a blodfield as you would by retrieving the data from the tables?
>
> I have never used blobs and streaming.
>
> Maybe I can have a 2 field InvoiceReportTable table ?
> - field 1: Invoice Number
> - field 2: blob field with Invoice data
>
>
> Regards,
> Pat
>

Tue, Sep 2 2008 1:37 AMPermanent Link

"Erik"
Hi Fernando,

Thanks for your quick response...
I'll try your coding !

regards,

Erik


"Fernando Dias" <fernandodias.removthis@easygate.com.pt> schreef in bericht
news:2F7BC402-0587-4F13-B11C-0BBA3B16050D@news.elevatesoft.com...
> Erik,
>
> Here is the code I use to do exactly the same you want to do.
> Please note 2 important details in the "save" code:
> You must create the Stream AFTER editing the record and destroy it BEFORE
> post. If then you want to navigate to another record and edit it, you must
> create another blob stream object.
>
> 1.Load from table
> var
>   Rpt: TDBISAMBlobStream;
>   Report: TfrxReport;
>
>   (...)
>   Rpt:=TDBISAMBlobStream.Create(TRptFR3, bmRead);
>   try
>     Report.LoadFromStream(Rpt);
>   finally
>     Rpt.Free;
>   end;
>
> 2.Save to table
> var
>   Rpt: TDBISAMBlobStream;
>   Report: TfrxReport;
>
>   (...)
>   TblRpt.Edit;
>   Rpt:=TDBISAMBlobStream.Create(TblRptFR3, bmWrite);
>   try
>     Report.SaveToStream(Rpt);
>   finally
>     Rpt.Free;
>   end;
>   TblRpt.Post;
>
>
> Note:
>   TblRpt is the table containing the reports.
>   TblRptFR3 is the blob field containing the report.
>
>
> --
> Fernando Dias
> [Team Elevate]
>

Tue, Sep 2 2008 11:00 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Pat,

As Erik said, it's not the data we are saving but the report "layout".
In some of my applications users are allowed to change some report
layouts, for example invoice layout, or in some cases to have more than
one possible layout for the invoice. These "editable" reports are all
saved in a database table using a blob column, along with some more
information about them like Title, ReportID, ReportType, Description,
UserEdiable, etc..

--
Fernando Dias
[Team Elevate]
Tue, Sep 2 2008 11:15 AMPermanent Link

"Erik"
Fernando

It Works !!!!

By yourself a beer, i'll pay you backup when we meet ..... Smile

very kind regards

Erik


"Erik" <bellaard@wega.nl> schreef in bericht
news:8650F4DD-EE33-4556-901A-4F2419774848@news.elevatesoft.com...
> Hi Fernando,
>
> Thanks for your quick response...
> I'll try your coding !
>
> regards,
>
> Erik
>
>
> "Fernando Dias" <fernandodias.removthis@easygate.com.pt> schreef in
> bericht news:2F7BC402-0587-4F13-B11C-0BBA3B16050D@news.elevatesoft.com...
>> Erik,
>>
>> Here is the code I use to do exactly the same you want to do.
>> Please note 2 important details in the "save" code:
>> You must create the Stream AFTER editing the record and destroy it BEFORE
>> post. If then you want to navigate to another record and edit it, you
>> must create another blob stream object.
>>
>> 1.Load from table
>> var
>>   Rpt: TDBISAMBlobStream;
>>   Report: TfrxReport;
>>
>>   (...)
>>   Rpt:=TDBISAMBlobStream.Create(TRptFR3, bmRead);
>>   try
>>     Report.LoadFromStream(Rpt);
>>   finally
>>     Rpt.Free;
>>   end;
>>
>> 2.Save to table
>> var
>>   Rpt: TDBISAMBlobStream;
>>   Report: TfrxReport;
>>
>>   (...)
>>   TblRpt.Edit;
>>   Rpt:=TDBISAMBlobStream.Create(TblRptFR3, bmWrite);
>>   try
>>     Report.SaveToStream(Rpt);
>>   finally
>>     Rpt.Free;
>>   end;
>>   TblRpt.Post;
>>
>>
>> Note:
>>   TblRpt is the table containing the reports.
>>   TblRptFR3 is the blob field containing the report.
>>
>>
>> --
>> Fernando Dias
>> [Team Elevate]
>>
>
>

Image