Page 1 of 1

Insert/Append and KeyGenerator

Posted: Mon 26 Jan 2015 13:31
by lrauti
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;

Re: Insert/Append and KeyGenerator

Posted: Tue 27 Jan 2015 08:16
by lrauti
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.

Re: Insert/Append and KeyGenerator

Posted: Tue 27 Jan 2015 11:56
by ViktorV
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.

Re: Insert/Append and KeyGenerator

Posted: Sun 01 Mar 2015 16:08
by davort
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.

Re: Insert/Append and KeyGenerator

Posted: Mon 02 Mar 2015 07:15
by ViktorV
We have already fixed this issue, the fix will be included in the next IBDAC build.