Insert/Append and KeyGenerator

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lrauti
Posts: 18
Joined: Fri 03 Jan 2014 16:22

Insert/Append and KeyGenerator

Post by lrauti » Mon 26 Jan 2015 13:31

For some reason the following Result check gives True (-1) with the query Insert and False (0) with the query Append. The Insert will get KeyGenerator value and the Append doesn't.

Any known reason for this behaviour?

GeneratorMode is gmInsert and I am doing the Insert and Append for the same TIBCQuery.

function TGDSRecordSet.GetNull(Field: TFieldDesc; RecBuf: IntPtr): boolean;
var
DBObject: IntPtr;
begin
...
if Field.FieldDescKind <> fdkCalculated then
Result := Marshal.ReadInt16(RecBuf, FDataSize + (Field.FieldNo - 1) * SizeOf(Short)) = -1
...
end;

lrauti
Posts: 18
Joined: Fri 03 Jan 2014 16:22

Re: Insert/Append and KeyGenerator

Post by lrauti » Tue 27 Jan 2015 08:16

This works in version 5.4.12! We have also noticed a few other very serious problems. Don't have time to figure out those.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Insert/Append and KeyGenerator

Post by ViktorV » Tue 27 Jan 2015 11:56

Unfortunately, we could not reproduce the issue, the auto-incremental field value is correctly generated after calling both TIBCQuery.Insert and TIBCQuery.Append. Please send a small sample to demonstrate the issue to viktorv*devart*com, including a script to create and fill in the test database object.

davort
Posts: 25
Joined: Sat 20 Jan 2007 14:37

Re: Insert/Append and KeyGenerator

Post by davort » Sun 01 Mar 2015 16:08

I have the same problems. First and second append correctly returns the key from the generator, after that, generator is not called at all. I've checked with dbMonitor, but could not figure it out, what conditions are that cause the call to the generator to be skipped.

I also tried switching from gmPost to gmInsert mode, and it's the same.

Unfortunatelly, I do not have the source code, so I cannot debug it myself.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Insert/Append and KeyGenerator

Post by ViktorV » Mon 02 Mar 2015 07:15

We have already fixed this issue, the fix will be included in the next IBDAC build.

Post Reply