Using Options.DisconnectedMode in TUniConnection

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bero
Posts: 4
Joined: Fri 30 Mar 2012 10:25

Using Options.DisconnectedMode in TUniConnection

Post by bero » Tue 03 Apr 2012 13:43

I have a problem with DisconnectedMode option in TUniConnection.
UniDAC version is 4.1.5. and provider is Interbase (actually, we are using Firebird database).

Situation is as follows:
1. There is database component, named DB1. Property Options.DisconnectedMode is set to True, all other properties are set to default values.
2. A query Q1 is connected to the database DB1. In its SpecificOptions property Interbase.DeferredBlobRead is set to True. All other values are defaults. SQL is something like:
"SELECT * FROM Partners WHERE PartnerID = 11491".
Partners table has a BLOB field, let's say it's called "Note".

Steps to reproduce this problem (Delphi code):

Code: Select all

DB1.Connect;
Q1.Open;
NoteValue := Q1.FieldByName('Note').AsString; // exception is raised here
Q1.Close;
In third line an exception is raised which says: "Invalid database handle (no active connection)".

The problem does NOT arise in following situations:
1. Interbase.DeferredBlobRead is set to False - then everything is OK
2. when WHERE clause is removed from a query so it looks like this: "SELECT ? FROM Partners" - this could indicate that there is some bug in TUniQuery component while fetching a BLOB value. However, this is not acceptable solution.

I'm interested if this is a bug. If it is not, is there any other solution to make this work?
I would like to keep DeferredBlobRead and DisconnectedMode properties set to True.


Thanks in advance,
Bero

AndreyZ

Post by AndreyZ » Wed 04 Apr 2012 09:55

Hello,

You cannot use DisconnectedMode=True with DeferredBlobRead=True. When DisconnectedMode is True, a connection and its transactions are closed when they are not required. To make the DeferredBlobRead property work, UniDAC reads BLOB handles from the server that are used for reading BLOB data when it is explicitly requested. Because connection and its transactions are closed, these handles become invalid. To solve the problem you should not set both DisconnectedMode and DeferredBlobRead to True.

Post Reply