Skip to content

Commit bc3c0aa

Browse files
committed
Ajustes Controller / SQL
1 parent 50de743 commit bc3c0aa

5 files changed

+15
-0
lines changed

MiniREST.Controller.Base.pas

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TMiniRESTControllerBase = class(TInterfacedObject, IMiniRESTController)
99
protected
1010
FActionContext : IMiniRESTActionContext;
1111
FLogger : IMiniRESTLogger;
12+
procedure InitController; virtual;
1213
public
1314
function GetActionContext: IMiniRESTActionContext;
1415
procedure SetActionContext(AContext: IMiniRESTActionContext);
@@ -49,6 +50,11 @@ function TMiniRESTControllerBase.GetLogger: IMiniRESTLogger;
4950
Result := FLogger;
5051
end;
5152

53+
procedure TMiniRESTControllerBase.InitController;
54+
begin
55+
Exit;
56+
end;
57+
5258
function TMiniRESTControllerBase.PathVariable(AVariable: string): string;
5359
begin
5460
Result := GetActionContext.GetPathVariable(AVariable);

MiniREST.Controller.Intf.pas

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface
77
type
88
IMiniRESTController = interface
99
['{16EA18CD-7AF3-4851-A85B-B2D9E0B22EB5}']
10+
procedure InitController;
1011
function GetActionContext : IMiniRESTActionContext;
1112
procedure SetActionContext(AContext : IMiniRESTActionContext);
1213
procedure Response(AContent : string; AContentType : TMiniRESTResponseType = rtTextHtml; AStatusCode : Integer = 200);

MiniREST.SQL.DBX.pas

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ TMiniRESTSQLQueryDBX = class(TInterfacedObject, IMiniRESTSQLQuery)
9292
procedure Close;
9393
function AddParam(AParam: IMiniRESTSQLParam): IMiniRESTSQLQuery;
9494
function ParamByName(const AParamName: string): IMiniRESTSQLParam;
95+
function FieldByName(const AFieldName: string): TField;
9596
procedure Append;
9697
procedure Insert;
9798
procedure Post;
@@ -173,6 +174,11 @@ function TMiniRESTSQLQueryDBX.Eof: Boolean;
173174
Result := FQry.Eof;
174175
end;
175176

177+
function TMiniRESTSQLQueryDBX.FieldByName(const AFieldName: string): TField;
178+
begin
179+
Result := FQry.FieldByName(AFieldName);
180+
end;
181+
176182
function TMiniRESTSQLQueryDBX.GetDataSet: TDataSet;
177183
begin
178184
Result := FQry;

MiniREST.SQL.Intf.pas

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface
1313
function AddParam(AParam: IMiniRESTSQLParam): IMiniRESTSQLQuery;
1414
function GetValue(AField: string) : Variant; overload;
1515
function GetValue(AField: string; ADefault: Variant): Variant; overload;
16+
function FieldByName(const AFieldName: string): TField;
1617
function Eof: Boolean;
1718
procedure Next;
1819
function IsEmpty: Boolean;

MiniREST.Server.Base.pas

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ procedure TMiniRESTServerBase.FindController(AContext: IMiniRESTActionContext);
172172
LController := LMiniRESTActionInfo.&Class.Create;
173173
if Supports(LController, IMiniRESTController, LControllerIntf) then
174174
begin
175+
LControllerIntf.InitController;
175176
LControllerIntf.SetLogger(GetLogger);
176177
LControllerIntf.SetActionContext(AContext);
177178
if (Length(LMiniRESTActionInfo.Method.GetParameters) = 1) and (LMiniRESTActionInfo.Method.GetParameters[0].ParamType.QualifiedName = 'MiniREST.Intf.IMiniRESTActionContext') then

0 commit comments

Comments
 (0)