Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 10 of 16 total |
MemoryStream into Table |
Wed, Oct 24 2007 10:32 AM | Permanent Link |
Aage Johansen | I'm pumping data from a Firebird database into a dbISAM database and ran
into a problem: I have a picture (jpg/tif/...) in a MemoryStream and I need to put it into a new record in a table. Will I have to use a query like QRY.ParamByName(GRAPHICFIELD).LoadFromStream(STRM,ftGraphix); I could not see such a method with TBL.FieldByName(GRAPHICFIELD).xxx Is there a way using Assign ? I have defined the field type as "Graphic" - is this ok? Should I use Blob (and ftBlob) or Bytes (and ft????) or something else? dbISAM 4.22 Build 6 Delphi/2006-Pro TiA Aage J. |
Wed, Oct 24 2007 11:00 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Aage
TMEMOFIELD( TBL.FieldByName(GRAPHICFIELD)).Assign Roy Lambert |
Wed, Oct 24 2007 11:44 AM | Permanent Link |
Aage Johansen | Roy Lambert wrote:
> > TMEMOFIELD( TBL.FieldByName(GRAPHICFIELD)).Assign > I cannot assign a MemoryStream here, something TPersistent is required. I tried: TMemoField(TBL.FieldByName('Bilde')).Assign(BILDE); This resulted in: Incompatible types: 'TPersistent' and "TMemoryStream' I had already tried: TBL.FieldByName('Bilde').Assign(BILDE); with the same result. What will I need to change? Also, any comment on using the fieldtypes Graphic _or_ Blob? -- Aage J. |
Wed, Oct 24 2007 12:01 PM | Permanent Link |
Eryk Bottomley | Aage,
> QRY.ParamByName(GRAPHICFIELD).LoadFromStream(STRM,ftGraphix); > I could not see such a method with > TBL.FieldByName(GRAPHICFIELD).xxx TBlobField(Table.FieldByName('Photo')).LoadFromStream(AStream); > I have defined the field type as "Graphic" - is this ok? Should I use > Blob (and ftBlob) or Bytes (and ft????) or something else? I would use ftBlob. ftGraphic is really just an alias for ftBlob to support TDBImage, but that component only supports BMPs so it is no use to you in this case anyway. Eryk |
Wed, Oct 24 2007 12:09 PM | Permanent Link |
Aage Johansen | Eryk Bottomley wrote:
> Aage, > >> QRY.ParamByName(GRAPHICFIELD).LoadFromStream(STRM,ftGraphix); >> I could not see such a method with >> TBL.FieldByName(GRAPHICFIELD).xxx > > TBlobField(Table.FieldByName('Photo')).LoadFromStream(AStream); > >> I have defined the field type as "Graphic" - is this ok? Should I use >> Blob (and ftBlob) or Bytes (and ft????) or something else? > > I would use ftBlob. ftGraphic is really just an alias for ftBlob to > support TDBImage, but that component only supports BMPs so it is no use > to you in this case anyway. > > Eryk Thank you! -- Aage J. |
Wed, Oct 24 2007 12:12 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Aage
OK - that was me just picking up on assign in your post and going off memory TMemoField(TBL.FieldByName('Bilde')).LoadFromStream(BILDE); You might have to use TGRPAHICFIELD or whatever it is - never used them always just used memo. Roy Lambert |
Wed, Oct 24 2007 2:58 PM | Permanent Link |
Aage Johansen | Aage Johansen wrote:
> Eryk Bottomley wrote: >> >> TBlobField(Table.FieldByName('Photo')).LoadFromStream(AStream); >> >> >> I would use ftBlob. ftGraphic is really just an alias for ftBlob to >> support TDBImage, but that component only supports BMPs so it is no >> use to you in this case anyway. Well. It did work fine, BUT I ran into something else: The table has default BLOB Block Size (512). The pictures have an average size of approx. 32KB. After slightly more than 7000 records (one picture per record) the table tried to exceed 4GB - not successful. My test database holds 12000+ pictures, but the real one has 60.000 (and growing). The Firebird (test) db is about 500MB. The pictures that got into the dbISAM table shows just fine - no evident problems (like duplicated pictures). I emptied the table and imported about 1000 pictures - the table was about 280MB. There must be something that I miss. What? -- Aage J. |
Wed, Oct 24 2007 5:23 PM | Permanent Link |
Aage Johansen | > ...
> There must be something that I miss. What? > I failed on using the MemoryStream correctly. Sigh. But things are looking brighter now. -- Aage J. |
Wed, Oct 24 2007 5:43 PM | Permanent Link |
Eryk Bottomley | Aage
> Well. It did work fine, BUT I ran into something else: > The table has default BLOB Block Size (512). The pictures have an <snip> > I emptied the table and imported about 1000 pictures - the table was > about 280MB. > > There must be something that I miss. What? The only thing that comes to mind is that the stream is a LOT bigger than you think it is ...as would happen if you were decoding the JPG and accidentally ended up grabbing it as a BMP from a TBitmap or something. Eryk |
Fri, Oct 26 2007 3:52 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Aage,
<< There must be something that I miss. What? >> Did you verify that the images were saved as JPGs in the database ? If so, then you should try bumping up the BLOB block size for the table to at least 1-2k. -- Tim Young Elevate Software www.elevatesoft.com |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |