I'm using unidac to connect to a Firebird3 Database, when inserting a row on a table with a Identity ID field I get a "List Index out of bound error" on procedure "TInserter.Insert" on Line "NewId := ResultSet.GetFieldValue(0);"
I have tested using FireDac and it works ok.
Is this a Unidac bug or should I have to set some adittional param or setting on the unidac connection component to make it work ok with firebird3?
Indeed, Unidac plus Firebird 3 is not a valid combination with Aurelius due to that Unidac behavior. Maybe you can contact Devart asking them if there is a configuration that returns such values as fields instead of params?
This is a standard behavior of our components, which our users have been
using for many years and its change will affect them all. And that's
why we cannot change this behavior.
As TMS Aurelius specifies UniDac support:https://tmssoftware.com/site/aurelius.asp, then to solve your task, it's better to contact TMS Aurelius technical support, in order for them to fix this incompatibility. As UniDAC always automatically creates parameters with RET_ prefix for the fields specified after RETURNING
There is a quick and dirty workaround you can use. You can replace the following code in Aurelius.Drivers.Unidac.pas (or just copy that unit and create your own Aurelius.Drivers.MyUnidac.pas:
TUniDacResultSetAdapter = class(TDriverResultSetAdapter<TCustomDADataset>)
public
function GetFieldValue(FieldIndex: Integer): Variant; override;
end;
and then the implementation:
function TUniDacResultSetAdapter.GetFieldValue(FieldIndex: Integer): Variant;
begin
if Dataset.FieldCount > 0 then
Result := inherited GetFieldValue(FieldIndex)
else
Result := Dataset.ParamByName('RET_ID').Value;
end;