hi,
i’m upgrading from
RODA 9.4.107.1363 to
RODA 9.5.111.1399
i wasn’t expection any problem but i get stream errors when i want to save data
also, i’m still depending on DA3 (this fails on startup app btw)
it crashes in
:004d067c TWriter.WriteVariant + $54
uDABinAdapter.Writer_WriteVariant(???,Variant array of Byte)
uDABinAdapter.VariantToWriter(???,Variant array of Byte,$ACB3110)
uDABinAdapter.TDABinDataStreamer.DoWriteDelta(TDADelta($A36F030) as IDADelta)
uDADataStreamer.TDADataStreamer.WriteDelta(???)
uDADataStreamer.TDADataStreamer.WriteDelta(???,TDACDSDataTable($6EEA490) as IDADataset)
calling code:
FStream := Binary.Create;
LocalAdapter.WriteDelta(FStream,LocalDataTable);
localdatatable is a TDACDSDataTable
// Old values
for x := 0 to (Source.LoggedFieldCount - 1) do begin
//fWriter.WriteVariant(Source.Changes[i].OldValues[x]);
VariantToWriter(Source.LoggedFieldTypes[x], Source.Changes[i].OldValues[x], fWriter);
end;
=>
procedure VariantToWriter(aDataType : TDADataType; const aSourceVariant : Variant; aWriter : TWriter);
var
p: pointer;
lSize: cardinal;
begin
case aDataType of
=> datatype is DatMemo
=>
procedure Writer_WriteVariant(AWriter: TWriter; AValue: Variant);
begin
{$IFNDEF FPC}
AWriter.WriteVariant(AValue);
avariant is variant array of byte…
here it crashes
in sql server the field is ‘text’
the schema table is datMemo
now i debugged the LocalAdapter.ReadDataset
and the values i see in the TDACDSDatatable are correct (the datmemo field)
but when modifying a value the value i ‘see’ in the delta is not a string, i see chinese characters
so probably something gets converted from string to another format…?
ok went through all changes between my old version and the latest one
this is the cause of the problem, in the latest a datMemo also is considered as a variant array of bytes
so is this intentional?
As a workaround you can use events of the bin1 streamer to convert such array of byte to a string:
procedure TMyForm.DataStreamerBeforeFieldValueSerialization(
const aField: TDAField; var Value: Variant);
begin
if aField.DataType in [datWideMemo] then
Value := AnsiBytesToString(Value);
end;
it’s rather undoable to define that event for all binadapters that are being created on the fly (threaded)
so why the change in code?
it breaks existing code…
isn’t there a way to modify the uDaBinadapter to cope with that change?
procedure VariantToWriterAsStr(aDataType : TDADataType; const aSourceVariant : Variant; aWriter : TWriter);
var
p: pointer;
s: string;
lVt: TValueType;
lSize: cardinal;
begin
case aDataType of
datBlob,datMemo: begin
procedure VariantToWriter(aDataType : TDADataType; const aSourceVariant : Variant; aWriter : TWriter);
var
p: pointer;
lSize: cardinal;
begin
case aDataType of
datBlob,datMemo: begin
function ReaderToVariant(aDataType : TDADataType; aReader : TReader): Variant;
var
p: pointer;
sze : cardinal;
begin
case aDataType of
datBlob,datMemo : begin
that seems to do the trick, can you confirm the validity of these changes?
are there any other changes needed?
ps: this is a major showstopper for us, 80% is still using TDaBinDatastreamer/DA3 so i either need to get this resolved asap or i’m forced to downgrade and thus can’t migrate to delphi RIO…