Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unitialized Reply
#5
Conforme solicitado, segue fonte.
OBS: Algumas partes de código foram ocultas para preservar as regas de negócio do cliente, e não influenciam no caso.



Code:
unit IWContents.Test;

interface

uses
  Classes,
  IW.Content.Base,
  HTTPApp,
  IWApplication,
  IW.HTTP.Request,
  IW.HTTP.Reply;

type
  TContentChart = class(TContentBase)
  protected
    function Execute(aRequest: THttpRequest; aReply: THttpReply; const aPathname: string; aSession: TIWApplication; aParams: TStrings): boolean; override;
  public
    constructor Create; override;
  end;

implementation

uses
  IW.Content.Handlers,
  IWMimeTypes,
  FireDAC.Comp.Client,
  ServerController,
  System.DateUtils,
  System.SysUtils,
  ...;
 
constructor TContentChart.Create;
begin
  inherited;
  mFileMustExist := False;
  mCanStartSession:= true;
//  mRequiresSessionStart := true;
end;

function TContentChart.Execute(aRequest: THttpRequest; aReply: THttpReply; const aPathname: string; aSession: TIWApplication; aParams: TStrings): boolean;
var
  JSON: string;
  FDataSet: TFDquery;
begin
  Result := true;
  JSON := '';

  if aParams.Count > 0 then
  begin

    if Assigned(aReply) then
    begin

      //Verify Action
      if aParams.Values['action'] = 'GV' then
      begin

        try
          FDataSet := TFDQuery.Create(nil);
          FDataSet.SQL.Clear;
          ...
          FDataSet.Open();

          JSON := '[' + sLineBreak;
          FDataSet.First;
          while not FDataSet.Eof do
          begin
            ...
            FDataSet.Next;
          end;
          JSON := ']' + sLineBreak;
          aReply.WriteString(JSON);

        finally
          FreeAndNil(FDataSet);
        end;

      end;
    end;
  end;

end;

initialization

end.
Reply


Messages In This Thread
Unitialized Reply - by Raphael - 12-17-2019, 02:27 PM
RE: Unitialized Reply - by Jose Nilton Pace - 12-17-2019, 02:35 PM
RE: Unitialized Reply - by Raphael - 12-17-2019, 03:00 PM
RE: Unitialized Reply - by Jose Nilton Pace - 12-17-2019, 03:04 PM
RE: Unitialized Reply - by Raphael - 12-17-2019, 03:36 PM
RE: Unitialized Reply - by Jose Nilton Pace - 12-17-2019, 06:38 PM
RE: Unitialized Reply - by Raphael - 12-17-2019, 06:54 PM
RE: Unitialized Reply - by kudzu - 12-17-2019, 06:59 PM
RE: Unitialized Reply - by Raphael - 12-17-2019, 07:10 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)