Skip to content
Permalink
Browse files

fixed Delphi 5 compilation

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Mar 14, 2019
1 parent 104a5bf commit e2945da631e6b455eb5d21a46d6a12e2e452cde5
Showing with 13 additions and 9 deletions.
  1. +5 −3 SQLite3/mORMotSQLite3.pas
  2. +7 −5 SynCommons.pas
  3. +1 −1 SynopseCommit.inc
@@ -1361,7 +1361,7 @@ function TSQLRestServerDB.MainEngineList(const SQL: RawUTF8; ForceAJAX: Boolean;
finally
MS.Free;
end;
GetAndPrepareStatementRelease(nil, FormatShort('returned % as %',
GetAndPrepareStatementRelease(nil, FormatToShort('returned % as %',
[Plural('row',RowCount),KB(result)]));
except
on E: ESQLite3Exception do
@@ -1519,7 +1519,8 @@ function TSQLRestServerDB.MainEngineUpdateBlob(TableModelIndex: integer; aID: TI
fStatement^.BindBlob(1,BlobData);
fStatement^.Bind(2,aID);
repeat until fStatement^.Step<>SQLITE_ROW; // Execute
GetAndPrepareStatementRelease(nil,FormatShort('stored % in ID=%',[KB(BlobData),aID]),true);
GetAndPrepareStatementRelease(nil,FormatToShort('stored % in ID=%',
[KB(BlobData),aID]),true);
result := true;
except
on E: Exception do
@@ -1657,7 +1658,8 @@ function TSQLRestServerDB.UpdateBlobFields(Value: TSQLRecord): boolean;
end;
fStatement^.Bind(length(BlobFields)+1,Value.ID);
repeat until fStatement^.Step<>SQLITE_ROW; // Execute
GetAndPrepareStatementRelease(nil,FormatShort('stored % in ID=%',[KB(size),Value.ID]),true);
GetAndPrepareStatementRelease(nil,FormatToShort('stored % in ID=%',
[KB(size),Value.ID]),true);
result := true;
except
on E: Exception do
@@ -1630,10 +1630,10 @@ procedure FormatUTF8(const Format: RawUTF8; const Args: array of const;
// - shortstring allows fast stack allocation, so is perfect for small content
// - truncate result if the text size exceeds 255 bytes
procedure FormatShort(const Format: RawUTF8; const Args: array of const;
var result: shortstring); overload;
var result: shortstring);

/// fast Format() function replacement, for UTF-8 content stored in shortstring
function FormatShort(const Format: RawUTF8; const Args: array of const): shortstring; overload;
function FormatToShort(const Format: RawUTF8; const Args: array of const): shortstring;

/// fast Format() function replacement, tuned for small content
// - use the same single token % (and implementation) than FormatUTF8()
end;
end;

function FormatShort(const Format: RawUTF8; const Args: array of const): shortstring;
begin
FormatShort(Format,Args,result);
function FormatToShort(const Format: RawUTF8; const Args: array of const): shortstring;
var process: TFormatUTF8;
begin // Delphi 5 has troubles compiling overloaded FormatShort()
process.Parse(Format,Args);
result[0] := AnsiChar(process.WriteMax(@result[1],255)-@result[1]);
end;

procedure FormatShort16(const Format: RawUTF8; const Args: array of const;
@@ -1 +1 @@
'1.18.5104'
'1.18.5105'

0 comments on commit e2945da

Please sign in to comment.
You can’t perform that action at this time.