BUG type OID

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
Claudio
Posts: 25
Joined: Tue 17 Mar 2009 12:47

BUG type OID

Post by Claudio » Tue 28 Jun 2011 14:38

Hello,

OID type - BUG ????

I use Delphi 2010 - Postgres 9.0 - driver 1.14.0.13

test:

Open your demo project BLOBPics.

Changing the type byte for OID. (procedure TfmMain.btCreateClick(Sender: TObject);

-------------------(as README)

OIDAsLargeObject
If True, fields with OID data type are treated as fields with large objects IDs. The driver will map such field on TBlobField, and read data from the corresponding large object automatically. If OIDAsLargeObject is set to False (default), OID data type is mapped on TIntegerField.
const
coOIDAsLargeObject = TSQLConnectionOption(501); //boolean
. . .
SQLConnection1.SQLConnection.SetOption(coOIDAsLargeObject, Integer(True));
Note 1: you should start a transaction before opening a query with large objects.
Note 2: if you need to edit TBlobField that corresponds a large object, set DetectParamTypes option to True. When you update TBlobField, the driver creates new large object and writes its OID to the field. An old large object that was referenced by this field becomes an orphan large object (an object that exist but is not referenced by any rows, wasting disk space). So do not update such fields, or create a trigger that unlinks old large object on update.

----------------------------------------------------------------

Add the SQLConnection property BEFORECONNECT

SQLConnection.Params.Values ​​['OIDAsLargeObject'] = 'True';
SQLConnection.Params.Values ​​['DetectParamTypes'] = 'True';

Change procedure TfmMain.btOpenClick

procedure TfmMain.btOpenClick(Sender: TObject);
var
Transacao: TDBXTransaction;
begin
Transacao := SQLConnection.BeginTransaction;
ClientDataSet.Open;
SQLConnection.RollbackFreeAndNil(Transacao);
end;

--------------------------------------------------------------------------

1) Run

2) Insert records (more than one) - works

3) ApplyUpdates - works

4) Refresh - will not work - Pictures are not show

Thank you.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 29 Jun 2011 11:20

Hello,

Thank you for the information.
We have reproduced the problem.
We will notify you as soon as we have any results.

Post Reply