problem with Blobs

Posted on 1999-12-03
Medium Priority
Last Modified: 2010-05-18
I have a problem with Blobs (D5, Interbase). I have a table like this:
create table test(
    id                integer primary key,
    content       varchar(512));
All works fine when TQuery likes "select id from test", but when i try to run
"select id, content from test" statement i get "RecordCount = -1" and
message "The logical BLOB handle in the record buffer is invalid."
I added the parameter "Blobs To Cache=-1", but  it doesn't fix the problem.

anyone have any ideas?
Question by:Vittt
  • 4
  • 2
LVL 27

Expert Comment

ID: 2254684
hi vittt,

from borland (a bit older), but maybe actuell enough for your problem

---- paste begin

Question and Answer Database

      FAQ387B.txt   'Invalid BLOb handle' error
      Category   :Database (Miscellaneous)
      Platform    :All
      Product    :BDE 4.0  

      "Invalid BLOb handle" error: What is the cause and
      how do I fix this error?


      If the error occurs on a non-live (dead, canned) query or a
      table with no indexes, then increasing the new BDE 4.x
      configuration parameter 'BLOBS TO CACHE' will fix the problem.
      This setting determines how many BLObs will be cached on the
      client. Applications that deal with fetching dead BLObs using
      dead table opens or queries can set a limit on the number of
      BLObs to cache depending on the resource available on the
      client. Setting a value 100 means the application can work with
      a maximum of 100 BLOb records cached. Fetching more than 100,
      then scrolling back 100 records results in an "Invalid BLOb
      handle in record buffer" error message.

      NOTE:This parameter does not apply to live table opens.

      Default Value: 64
      Range: 64 to 65536

      7/15/98 3:23:06 PM

---- paste end

therefore raise the cache to blob entry or force that your resultset is live - by a query set the requestlive-property to true


Expert Comment

ID: 2255247

i agree with meikl on setting the cache size.

just want to point out another issue which may help you.

by using:
create table test(
  id        integer primary key,
  content   varchar(512)

Interbase stores the variable length data on disk as fixed length by adding spaces until the size defined is reached. So if you add a record with 100 chars in content then Interbase will pad the rest of the column with spaces until 512 is reached. This is an inefficient use of disk space. When reading the data Interbase removes the spaces.

create table test(
  id        integer primary key,
  content   BLOB

Content is now a pointer to a segment of data stored on disk. The default segment size is 80 (which can be changed), also you are not limited to 512 chars. Now when adding a record of 100 chars as in the previous example Interbase will store the data in 2 segments.(First 80 chars in the first segment next 20 in the second segment)

Blobs datatype were added to the IB functionallity specifically for your type of need.


Author Comment

ID: 2255349
Great thanks to meikl and Ben...
But there is "TQuery.RecordCount=-1" problem. It's so important for my project... Can i get real RecordCount in this way?
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 27

Accepted Solution

kretzschmar earned 400 total points
ID: 2255387
hi vittt,
you can get a properly recordcound, if you use the method tquery1.last or the method tquery.fetchall, because the recordcount-property can only set if are known how much records are retrieved.

but this will slow down your database-perfomance, depending on the amount of records, which will retrieved.

another solution could be to fire a second query, which counts the records with a sql-statement.

why is this so important for you?

LVL 27

Expert Comment

ID: 2257731
hi vittt,
whats going on?

Author Comment

ID: 2259227
Hi kretzschmar!
I make it as you advised. It works properly, but slow (.Last and .FetchAll). Unfortunately I cannot use the second query with count because of primary query has CachedUpdates=true.

Thnx and best wishes vittt.
LVL 27

Expert Comment

ID: 2259293
glad to helped you ;-)

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question