Browse Source

* Call Translate for blobfields as well (bug ID 25083)

git-svn-id: trunk@30640 -
michael 10 years ago
parent
commit
1211149a29
1 changed files with 27 additions and 5 deletions
  1. 27 5
      packages/fcl-db/src/base/fields.inc

+ 27 - 5
packages/fcl-db/src/base/fields.inc

@@ -2815,17 +2815,28 @@ function TBlobField.GetAsString: string;
 var
 var
   Stream : TStream;
   Stream : TStream;
   Len    : Integer;
   Len    : Integer;
+  R : String;
+  
 begin
 begin
   Stream := GetBlobStream(bmRead);
   Stream := GetBlobStream(bmRead);
   if Stream <> nil then
   if Stream <> nil then
     with Stream do
     with Stream do
       try
       try
         Len := Size;
         Len := Size;
-        SetLength(Result, Len);
+        SetLength(R, Len);
         if Len > 0 then
         if Len > 0 then
-          ReadBuffer(Result[1], Len);
+          begin
+          ReadBuffer(R[1], Len);
+          if not Transliterate then
+            Result:=R
+          else  
+            begin
+            SetLength(Result,Len);
+            DataSet.Translate(@R[1],@Result[1],False);
+            end;
+          end;  
       finally
       finally
-        Free
+        Free;    
       end
       end
   else
   else
     Result := '';
     Result := '';
@@ -2920,12 +2931,23 @@ end;
 procedure TBlobField.SetAsString(const AValue: string);
 procedure TBlobField.SetAsString(const AValue: string);
 var
 var
   Len : Integer;
   Len : Integer;
+  R : String;
+  
 begin
 begin
   with GetBlobStream(bmWrite) do
   with GetBlobStream(bmWrite) do
     try
     try
       Len := Length(AValue);
       Len := Length(AValue);
-      if Len > 0 then
-        WriteBuffer(AValue[1], Len);
+      if (Len>0) then
+        begin
+        if Not Transliterate then
+          R:=AValue
+        else
+          begin
+          SetLength(R,Len);
+          Len:=Dataset.Translate(@AValue[1],@R[1],True);
+          end;  
+        WriteBuffer(R[1], Len);
+        end;
     finally
     finally
       Free;
       Free;
     end;
     end;