From 5f0bd73decc02ab568d5a51b6859d53c68c4393a Mon Sep 17 00:00:00 2001 From: joost Date: Mon, 12 Mar 2007 09:41:43 +0000 Subject: [PATCH] * Fixed bug #8477 git-svn-id: trunk@6801 - --- packages/fcl-db/src/fields.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/fcl-db/src/fields.inc b/packages/fcl-db/src/fields.inc index d7759e7b94..a06910ca37 100644 --- a/packages/fcl-db/src/fields.inc +++ b/packages/fcl-db/src/fields.inc @@ -1052,20 +1052,26 @@ end; procedure TStringField.SetAsString(const AValue: string); -Const NullByte : char = #0; - var Buf : TStringFieldBuffer; begin IF Length(AValue)=0 then - SetData(@NullByte) + begin + Buf := #0; + SetData(@buf); + end else if FTransliterate then begin DataSet.Translate(@AValue[1],Buf,True); SetData(@buf); end else - SetData(@AValue[1]); + begin + // The data is copied into the buffer, since some TDataset descendents copy + // the whole buffer-length in SetData. (See bug 8477) + Buf := AValue; + SetData(@Buf); + end; end; procedure TStringField.SetVarValue(const AValue: Variant);