Browse Source

fcl-db: base: avoid code page conversion to CP_NONE as this kind of conversion is for now undefined (see bug #30622)

git-svn-id: trunk@35268 -
lacak 8 years ago
parent
commit
f05acbed7a
2 changed files with 4 additions and 4 deletions
  1. 2 2
      packages/fcl-db/src/base/fields.inc
  2. 2 2
      packages/fcl-db/src/sqldb/sqldb.pp

+ 2 - 2
packages/fcl-db/src/base/fields.inc

@@ -1315,7 +1315,7 @@ begin
   else
   else
     begin
     begin
     if StringCodePage(AValue) <> FCodePage then
     if StringCodePage(AValue) <> FCodePage then
-      SetCodePage(AValue, FCodePage, True);
+      SetCodePage(AValue, FCodePage, FCodePage<>CP_NONE);
     if DataSize <= dsMaxStringSize then
     if DataSize <= dsMaxStringSize then
       begin
       begin
       if FTransliterate then
       if FTransliterate then
@@ -3217,7 +3217,7 @@ procedure TMemoField.SetAsAnsiString(const AValue: AnsiString);
 var s: RawByteString;
 var s: RawByteString;
 begin
 begin
   s := AValue;
   s := AValue;
-  SetCodePage(s, FCodePage, True);
+  SetCodePage(s, FCodePage, FCodePage<>CP_NONE);
   inherited SetAsAnsiString(s);
   inherited SetAsAnsiString(s);
 end;
 end;
 
 

+ 2 - 2
packages/fcl-db/src/sqldb/sqldb.pp

@@ -1687,7 +1687,7 @@ begin
   // converts parameter value to connection charset
   // converts parameter value to connection charset
   if FCodePage = CP_UTF8 then
   if FCodePage = CP_UTF8 then
     Result := Param.AsUTF8String
     Result := Param.AsUTF8String
-  else if FCodePage in [DefaultSystemCodePage, CP_ACP] then
+  else if FCodePage in [DefaultSystemCodePage, CP_ACP, CP_NONE] then
     Result := Param.AsAnsiString
     Result := Param.AsAnsiString
   else
   else
   begin
   begin
@@ -1699,7 +1699,7 @@ end;
 function TSQLConnection.GetAsSQLText(Field : TField) : string;
 function TSQLConnection.GetAsSQLText(Field : TField) : string;
 begin
 begin
   if (not assigned(Field)) or Field.IsNull then Result := 'Null'
   if (not assigned(Field)) or Field.IsNull then Result := 'Null'
-  else case field.DataType of
+  else case Field.DataType of
     ftString   : Result := QuotedStr(Field.AsString);
     ftString   : Result := QuotedStr(Field.AsString);
     ftDate     : Result := '''' + FormatDateTime('yyyy-mm-dd',Field.AsDateTime,FSqlFormatSettings) + '''';
     ftDate     : Result := '''' + FormatDateTime('yyyy-mm-dd',Field.AsDateTime,FSqlFormatSettings) + '''';
     ftDateTime : Result := '''' + FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Field.AsDateTime,FSqlFormatSettings) + '''';
     ftDateTime : Result := '''' + FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz',Field.AsDateTime,FSqlFormatSettings) + '''';