Browse Source

fcl-db: base:
- make TMemoField.CodePage public
- use RawByteString to avoid conversion from ACP to UTF8 before right TMemoField.CodePage is set

git-svn-id: trunk@35210 -

lacak 8 năm trước cách đây
mục cha
commit
5015e85140
2 tập tin đã thay đổi với 8 bổ sung5 xóa
  1. 2 1
      packages/fcl-db/src/base/db.pas
  2. 6 4
      packages/fcl-db/src/base/fields.inc

+ 2 - 1
packages/fcl-db/src/base/db.pas

@@ -949,6 +949,7 @@ type
     procedure SetAsUTF8String(const AValue: UTF8String); override;
   public
     constructor Create(AOwner: TComponent); override;
+    property CodePage : TSystemCodePage read FCodePage;
   published
     property Transliterate default True;
   end;
@@ -1246,7 +1247,7 @@ type
     Procedure SetBlobData(Buffer: Pointer; ASize: Integer);
     Procedure SetData(Buffer: Pointer);
     Property AsBCD : Currency read GetAsCurrency write SetAsBCD;
-    Property AsBlob : TBlobData read GetAsString write SetAsBlob;
+    Property AsBlob : TBlobData read GetAsAnsiString write SetAsBlob;
     Property AsBoolean : Boolean read GetAsBoolean write SetAsBoolean;
     Property AsBytes : TBytes read GetAsBytes write SetAsBytes;
     Property AsCurrency : Currency read GetAsCurrency write SetAsCurrency;

+ 6 - 4
packages/fcl-db/src/base/fields.inc

@@ -3232,10 +3232,12 @@ begin
 end;
 
 function TMemoField.GetAsUTF8String: UTF8String;
+var s: RawByteString;
 begin
-  Result := inherited GetAsAnsiString;
-  SetCodePage(RawByteString(Result), FCodePage, False);
-  SetCodePage(RawByteString(Result), CP_UTF8, True);
+  s := inherited GetAsAnsiString;
+  SetCodePage(s, FCodePage, False);
+  SetCodePage(s, CP_UTF8, True);
+  Result := s;
 end;
 
 procedure TMemoField.SetAsUTF8String(const AValue: UTF8String);
@@ -3483,7 +3485,7 @@ procedure TFields.Changed;
 
 begin
   // Removed FDataSet.Active check, needed for Persistent fields (see bug ID 30954)
-  if (FDataSet <> nil) and not (csDestroying in FDataSet.ComponentState)  then
+  if (FDataSet <> nil) and not (csDestroying in FDataSet.ComponentState) then
     FDataSet.DataEvent(deFieldListChange, 0);
   If Assigned(FOnChange) then
     FOnChange(Self);