Discussion:
Loading and Retrieving BLOB Fields
(too old to reply)
Phillip Flores
2008-02-18 13:05:52 UTC
Permalink
Hi,

I have an application that stores into a firebird database table a file
that the user selects. I am using a TClientDataset. The file's contents
are stored in a blob field. There is also an option to allow the user to
select the record and extract the contents of the blob field and write
it onto a file.

Why is it that the size of the extracted file does not match the size of
the original stored file? For example, I load a word document that is
about 203K is size. When I extract and save the field contents for this
file, the size is 45K. The manner of storing and retrieving does not
seem to fix it e.g. LoadFromFile/SaveToFile methods or using TBlobstream
and TFileStream.

Any ideas?
--
Cheers,
Phillip Flores
"VeriTime - Helping you manage your time better."
http://www.pcfworks.com
Karol Bieniaszewski
2008-02-21 11:22:08 UTC
Permalink
Post by Phillip Flores
Hi,
I have an application that stores into a firebird database table a file
that the user selects. I am using a TClientDataset. The file's contents
are stored in a blob field. There is also an option to allow the user to
select the record and extract the contents of the blob field and write it
onto a file.
Why is it that the size of the extracted file does not match the size of
the original stored file? For example, I load a word document that is
about 203K is size. When I extract and save the field contents for this
file, the size is 45K. The manner of storing and retrieving does not seem
to fix it e.g. LoadFromFile/SaveToFile methods or using TBlobstream and
TFileStream.
Any ideas?
1. First question is what database?

2 is this file corrupt after save or is workable?
if is workable may be you use NTFS and file have many extra data (but this
difference is to big form me)

3. how you store this file in blob field
and how you write it to disc
attache this code

Karol Bieniaszewski
Phillip Flores
2008-02-21 13:21:51 UTC
Permalink
Post by Karol Bieniaszewski
1. First question is what database?
I'm using Firebird together the dbexpress component of JvUIB.
Post by Karol Bieniaszewski
2 is this file corrupt after save or is workable?
The file is corrupted.
Post by Karol Bieniaszewski
if is workable may be you use NTFS and file have many extra data (but this
difference is to big form me)
3. how you store this file in blob field
and how you write it to disc
attache this code
The code for writing it to the disk is

ABlobField := ListDataset.FieldByName('FS_FILE') as TBlobField;
ABlobField.SaveToFile(NameOfFile);

The code for storing it to the database is:
ABlobField := ListDataset.FieldByName('FS_FILE') as TBlobField;
ABlobField.LoadFromFile(NameOfFile);

Thanks.
--
Cheers,
Phillip Flores
"VeriTime - Helping you manage your time better."
http://www.pcfworks.com
Phillip Flores
2008-02-21 13:54:32 UTC
Permalink
What version of Firebird have you?
What versjon of UIB have you - 2.1?
if not then update it
if yes then
do sample aplication with standard Delphi components like TSimpleDataSet
and try store and read data to/from blob
Karol Bieniaszewski
Hi,

I have UIB 2.1. I'm storing and retrieving from a clientdataset. Thanks
--
Cheers,
Phillip Flores
"VeriTime - Helping you manage your time better."
http://www.pcfworks.com
Karol Bieniaszewski
2008-02-21 13:53:11 UTC
Permalink
What version of Firebird have you?

What versjon of UIB have you - 2.1?
if not then update it
if yes then
do sample aplication with standard Delphi components like TSimpleDataSet
and try store and read data to/from blob

Karol Bieniaszewski
Post by Phillip Flores
Post by Karol Bieniaszewski
1. First question is what database?
I'm using Firebird together the dbexpress component of JvUIB.
Post by Karol Bieniaszewski
2 is this file corrupt after save or is workable?
The file is corrupted.
Post by Karol Bieniaszewski
if is workable may be you use NTFS and file have many extra data (but
this difference is to big form me)
3. how you store this file in blob field
and how you write it to disc
attache this code
The code for writing it to the disk is
ABlobField := ListDataset.FieldByName('FS_FILE') as TBlobField;
ABlobField.SaveToFile(NameOfFile);
ABlobField := ListDataset.FieldByName('FS_FILE') as TBlobField;
ABlobField.LoadFromFile(NameOfFile);
Thanks.
--
Cheers,
Phillip Flores
"VeriTime - Helping you manage your time better."
http://www.pcfworks.com
Phillip Flores
2008-02-21 18:43:05 UTC
Permalink
What is ur Delphi build? its was a problem in Rad studio 2007 RTM
version, and was fixed already, if you are using Delphi 2007, please
make sure you have all updates.
I'm using D7.
--
Cheers,
Phillip Flores
"VeriTime - Helping you manage your time better."
http://www.pcfworks.com
Cesar Romero
2008-02-21 18:43:36 UTC
Permalink
Post by Phillip Flores
What is ur Delphi build? its was a problem in Rad studio 2007 RTM
version, and was fixed already, if you are using Delphi 2007, please
make sure you have all updates.
I'm using D7.
_________________________________________

Phillip Flores,

had you installed any new app that maybe, did install another version
of midas.dll?

Whats happen if you add midaslib.dcu to your project uses?

[]s


Cesar Romero

Cesar Romero
2008-02-21 17:05:11 UTC
Permalink
Post by Phillip Flores
Hi,
I have an application that stores into a firebird database table a
file that the user selects. I am using a TClientDataset. The file's
contents are stored in a blob field. There is also an option to allow
the user to select the record and extract the contents of the blob
field and write it onto a file.
Why is it that the size of the extracted file does not match the size
of the original stored file? For example, I load a word document that
is about 203K is size. When I extract and save the field contents for
this file, the size is 45K. The manner of storing and retrieving does
not seem to fix it e.g. LoadFromFile/SaveToFile methods or using
TBlobstream and TFileStream.
Any ideas?
_________________________________________

Phillip Flores,

What is ur Delphi build? its was a problem in Rad studio 2007 RTM
version, and was fixed already, if you are using Delphi 2007, please
make sure you have all updates.


[]s


Cesar Romero

--
Loading...