#1 2020-07-01 13:20:13

Márcio Baroni
Member
From: Brasil
Registered: 2015-10-07
Posts: 34

Adjustment in the log on TSQLDBStatementWithParams.AddParamValueAsText

@ab when SupportsArrayBindings is enabled, the sql instructions in the log do not show the actual data ... so I made an adjustment to the TSQLDBStatementWithParams.AddParamValueAsText function to show the actual values. It may not be the best code.

procedure TSQLDBStatementWithParams.AddParamValueAsText(Param: integer; Dest: TTextWriter;
  MaxCharCount: integer);
begin
  dec(Param);
  if cardinal(Param)>=cardinal(fParamCount) then
    Dest.Add(',')
  else
    with fParams[Param] do
    begin
       if Length(VArray) = 0 then   <<<----
       begin
          case VType of
            ftInt64:    Dest.Add({$ifdef DELPHI5OROLDER}integer{$endif}(VInt64));
            ftDouble:   Dest.AddDouble(unaligned(PDouble(@VInt64)^));
            ftCurrency: Dest.AddCurr64(VInt64);
            ftDate:     Dest.AddDateTime(PDateTime(@VInt64),' ','''');
            ftUTF8:     Dest.AddQuotedStr(pointer(VData),'''',MaxCharCount);
            ftBlob:     Dest.AddU(length(VData));
            else        Dest.AddShort('null');
          end;
       end
       else
          Dest.AddString(VArray[0]);    <<<----
    end;
end;

Offline

#2 2020-07-01 14:22:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,673
Website

Re: Adjustment in the log on TSQLDBStatementWithParams.AddParamValueAsText

Offline

Board footer

Powered by FluxBB