DataAbstract version 10.0.0.1605
Database Firebird 3.0,
Driver IBDAC 9.3.2
When compiling the application, I include the sources of the RemObjects SDK and DataAbstract frameworks.
If I try to edit a record that has a varchar field filled with an empty string (null’s work ok)
an exception of Exception class ERangeError with message ‘Range check error’ is raised in the line
unit uDaMemDataSet;
TDADBSupport.ExtractFieldData(ldata, fOffsets[i], lSize, fDataTypeArray[i], GetStoreStringsAsReference, lbuf);
This message appears on the DEBUG profile where the $RANGECHECK compilation option is on.
On older versions of DataAbstract this does not happen.
On the RELEASE profile with $RANGECHECK OFF the exception does not appear but I do not know if other problems can occur.
In DEBUG mode I prefer to use the $RANGECHECK ON option to be able to find other problems in my code.
It’s a bit annoying when the debug version behaves differently than the release version.
I have attached an example of editing for WideString fields with Empty value. It is not exactly the situation encountered initially but it also manifests itself on this type of fields.
Please compile with the library sources and compilation options from RemObjects_user.inc and DataAbstract_user.inc attached.
I am using Delphi 12.2 Patch 1 and RemObjects DataAbstract 10.0.0.1605 TestEditMemDataset.zip (2.8 MB)
function TDAMemoryDataset.GetNativeFieldData(Index: Integer; var Buffer: TBytes): Boolean;
..
if IsReferencedField(fDataTypeArray[index]) then begin
if fDataTypeArray[index] in ft_AnsiStringValues then begin
if Length(Buffer) > lsize then
Buffer[lsize] := 0;
end
else if fDataTypeArray[index] in ft_WideStringValues then begin
if Length(Buffer) > lsize * SizeOf(UnicodeChar) then
PUnicodeChar(@Buffer[lsize * SizeOf(UnicodeChar)])^ := #0;
end;
end;
end;
end;
launch C:\Program Files (x86)\RemObjects Software\Build\install_DA.cmd with admin rights for rebuilding .bpl and .dcu