Skip to content
Permalink
Browse files

ensure ExtractInlineParameters() won't modify SQL input content

  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Mar 14, 2019
1 parent 537f66e commit 104a5bf9a18f8e5512efb44c6eed9d9e1e2fd1de
Showing with 7 additions and 6 deletions.
  1. +6 −5 SynTable.pas
  2. +1 −1 SynopseCommit.inc
@@ -8059,8 +8059,8 @@ function SQLParamContent(P: PUTF8Char; out ParamType: TSQLParamType; out ParamVa
end else
if (c=JSON_SQLDATE_MAGIC) and // handle ':("\uFFF112012-05-04"):' format
IsIso8601(PUTF8Char(pointer(ParamValue))+3,L) then begin
ParamValue := copy(ParamValue,4,L); // return ISO-8601 text
ParamType := sptDateTime; // identified as Date/Time
Delete(ParamValue,1,3); // return only ISO-8601 text
ParamType := sptDateTime; // identified as Date/Time
end;
end;
end;
@@ -8120,10 +8120,11 @@ function ExtractInlineParameters(const SQL: RawUTF8;
result := SQL;
exit;
end;
FastSetString(result,pointer(SQL),length(SQL));
// compute GenericSQL from SQL, converting :(...): into ?
Gen := PUTF8Char(pointer(result))+ppBeg-1; // Gen^ just before :(
P := PUTF8Char(pointer(SQL))+ppBeg+1; // P^ just after :(
FastSetString(result,pointer(SQL),length(SQL)); // private copy for unescape
P := pointer(result); // in-place string unescape (keep SQL untouched)
Gen := P+ppBeg-1; // Gen^ just before :(
inc(P,ppBeg+1); // P^ just after :(
repeat
Gen^ := '?'; // replace :(...): by ?
inc(Gen);
@@ -1 +1 @@
'1.18.5103'
'1.18.5104'

0 comments on commit 104a5bf

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