Firebird BLOB retrieval

Posts   
 
    
danh
User
Posts: 70
Joined: 16-Jul-2007
# Posted on: 16-Jul-2007 15:19:10   

Hi,

I am using Firebird 2.0.1 with LLBLGen 2.0 (June 15th 2007, runtime v2.0.50727).

My application saves a BLOB value (around 900 bytes) in the DB, and later reads the row back using FetchEntityUsingUniqueConstraint. When read back, it returns only a 15-byte array of zeroes. The code is straightforward:


                PredicateExpression filter = new PredicateExpression(
                    AdviceSheetFields.ClientId == m_CurrentUser.WatchedUser.Id);
                AdviceSheetEntity adviceSheet = new AdviceSheetEntity(id);
                
                using (DataAccessAdapter adapter = new DataAccessAdapter())
                {
                    bool fetched = adapter.FetchEntityUsingUniqueConstraint(adviceSheet, filter);
                    byte[] data = adviceSheet.PdfData;          <------- 15 zeroes
                    ...
                    ...
                }

When I alter the fetch line to:


                    bool fetched = adapter.FetchEntity(adviceSheet);

...I get the full BLOB data back correctly.

As far as I can tell this looks like a bug? It's not bothering me since I can easily work around it, but I thought I'd report it for you to look into.

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 16-Jul-2007 15:55:56   

Hi,

what is the aim of using FetchEntityUsingUniqueConstraint if you build your entity with the PK ? the PK is already an unique constraint, no ?

When adviceSheet.PdfData contains 15 zeroes, did you check adviceSheet.Fields.State ? If that property is OutOfSync, there was a problen during the fetch.

danh
User
Posts: 70
Joined: 16-Jul-2007
# Posted on: 16-Jul-2007 16:04:21   

Ok....I see it now.....I've been a dumbass!

I misunderstood how FetchEntityUsingUniqueConstraint works and was getting back a different entity to the one I expected.

Thanks for your help and sorry for the time-wasting!

Dan