ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/client/FBSQLData.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/FBSQLData.pas (file contents):
Revision 308 by tony, Sat Jul 18 10:26:30 2020 UTC vs.
Revision 309 by tony, Tue Jul 21 08:00:42 2020 UTC

# Line 139 | Line 139 | type
139       function GetModified: boolean; virtual;
140       function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer;
141       function GetSize: cardinal; virtual; abstract;
142 +     function GetCharSetWidth: integer; virtual; abstract;
143       procedure SetAsBoolean(AValue: boolean); virtual;
144       procedure SetAsCurrency(Value: Currency); virtual;
145       procedure SetAsInt64(Value: Int64); virtual;
# Line 241 | Line 242 | type
242      function GetRelationName: AnsiString;  virtual; abstract;
243      function GetScale: integer; virtual; abstract;
244      function GetCharSetID: cardinal; virtual; abstract;
245 +    function GetCharSetWidth: integer; virtual; abstract;
246      function GetCodePage: TSystemCodePage; virtual; abstract;
247      function GetIsNull: Boolean;   virtual; abstract;
248      function GetIsNullable: boolean; virtual; abstract;
# Line 320 | Line 322 | type
322      function getCharSetID: cardinal; override;
323      function GetIsNullable: boolean; override;
324      function GetSize: cardinal; override;
325 +    function GetCharSetWidth: integer; override;
326      function GetArrayMetaData: IArrayMetaData;
327      function GetBlobMetaData: IBlobMetaData;
328      function GetStatement: IStatement;
# Line 1178 | Line 1181 | end;
1181   {Copied from LazUTF8}
1182  
1183   function UTF8CodepointSizeFull(p: PAnsiChar): integer;
1184 < const TopBitSetMask   = $8000; {%10000000}
1185 <      Top2BitsSetMask = $C000; {%11000000}
1186 <      Top3BitsSetMask = $E000; {%11100000}
1187 <      Top4BitsSetMask = $F000; {%11110000}
1188 <      Top5BitsSetMask = $F800; {%11111000}
1184 > const TopBitSetMask   = $80; {%10000000}
1185 >      Top2BitsSetMask = $C0; {%11000000}
1186 >      Top3BitsSetMask = $E0; {%11100000}
1187 >      Top4BitsSetMask = $F0; {%11110000}
1188 >      Top5BitsSetMask = $F8; {%11111000}
1189   begin
1190    case p^ of
1191    #0..#191: // %11000000
# Line 1225 | Line 1228 | end;
1228   function GetStrLen(p: PAnsiChar; CharWidth, MaxDataLength: cardinal): integer;
1229   var i: integer;
1230      cplen: integer;
1231 +    s: AnsiString;
1232   begin
1233    Result := 0;
1234 +  s := strpas(p);
1235    for i := 1 to CharWidth do
1236    begin
1237      cplen := UTF8CodepointSizeFull(p);
# Line 1264 | Line 1269 | begin
1269          if (SQLType = SQL_TEXT) then
1270          begin
1271            if GetCodePage = cp_utf8 then
1272 <            str_len := GetStrLen(PAnsiChar(sz),GetSize,DataLength)
1272 >            str_len := GetStrLen(PAnsiChar(sz),GetSize div GetCharSetWidth,DataLength)
1273            else
1274              str_len := DataLength
1275          end
# Line 1745 | Line 1750 | begin
1750    result := FIBXSQLVAR.DataLength;
1751   end;
1752  
1753 + function TColumnMetaData.GetCharSetWidth: integer;
1754 + begin
1755 +  CheckActive;
1756 +  result := FIBXSQLVAR.GetCharSetWidth;
1757 + end;
1758 +
1759   function TColumnMetaData.GetArrayMetaData: IArrayMetaData;
1760   begin
1761    CheckActive;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines