diff options
| author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-10-25 15:06:27 +0000 |
|---|---|---|
| committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-10-25 15:06:27 +0000 |
| commit | 08415514596338f2fe204fbf14678a8ec94e76d1 (patch) | |
| tree | e0811d3798e749ee82197026526d9859e9180cb1 /packages/fcl-web/src/webdata/fpwebdata.pp | |
| parent | 0b8d0d1f49b9b4b16a279a99dc0c7698b40ffe57 (diff) | |
| download | fpc-08415514596338f2fe204fbf14678a8ec94e76d1.tar.gz | |
* Reset adaptor - in case of pooled module, same adaptor is is used for each request
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16220 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-web/src/webdata/fpwebdata.pp')
| -rw-r--r-- | packages/fcl-web/src/webdata/fpwebdata.pp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/packages/fcl-web/src/webdata/fpwebdata.pp b/packages/fcl-web/src/webdata/fpwebdata.pp index a4d8f5da67..9ccfb504c8 100644 --- a/packages/fcl-web/src/webdata/fpwebdata.pp +++ b/packages/fcl-web/src/webdata/fpwebdata.pp @@ -15,6 +15,9 @@ type // Descendents must adapt the methods so they fit the particular JS/HTML engine used. TWebDataAction = (wdaUnknown,wdaRead,wdaUpdate,wdaInsert,wdaDelete); + + { TCustomWebdataInputAdaptor } + TCustomWebdataInputAdaptor = class(TComponent) private FAction: TWebDataAction; @@ -24,6 +27,7 @@ type function GetAction: TWebDataAction; procedure SetRequest(const AValue: TRequest); Protected + procedure reset; virtual; Function GetActionFromRequest : TWebDataAction; virtual; Public Function GetNextBatch : Boolean; virtual; @@ -518,9 +522,17 @@ Resourcestring procedure TCustomWebdataInputAdaptor.SetRequest(const AValue: TRequest); begin + If FRequest=AValue then Exit; FRequest:=AValue; + Reset; +end; + +procedure TCustomWebdataInputAdaptor.reset; +begin +{$ifdef wmdebug}SendDebugFmt('TCustomWebdataInputAdaptor.Reset (%s)',[FRequestPathInfo]);{$endif} FBatchCount:=0; Faction:=wdaUnknown; + FRequestPathInfo:=''; end; function TCustomWebdataInputAdaptor.GetActionFromRequest: TWebDataAction; @@ -535,6 +547,7 @@ begin if (FRequestPathInfo='') then FRequestPathInfo:=Request.GetNextPathInfo; N:=lowercase(FRequestPathInfo); +{$ifdef wmdebug}SendDebugFmt('TCustomWebdataInputAdaptor.GetActionFromRequest : %s (%s)',[n,Request.Pathinfo]);{$endif} If (N='read') then Result:=wdaRead else If (N='insert') then @@ -887,14 +900,15 @@ begin begin {$ifdef wmdebug}SendDebug('Starting batch Loop');{$endif} Case Adaptor.Action of - wdaInsert : DoInsertRecord(Content); - wdaUpdate : begin + wdaInsert : DoInsertRecord(Content); + wdaUpdate : begin {$ifdef wmdebug}SendDebug('Aha1');{$endif} DoUpdateRecord(Content); {$ifdef wmdebug}SendDebug('Aha2');{$endif} end; - wdaDelete : DoDeleteRecord(Content); - wdaRead : DoReadRecords(Content); + wdaDelete : DoDeleteRecord(Content); + wdaRead : DoReadRecords(Content); + wdaUnknown : Raise EFPHTTPError.Create(SErrNoAction); else inherited DoGetContent(ARequest, Content,Handled); end; @@ -1667,6 +1681,7 @@ begin try A:=GetAdaptor; A.Request:=ARequest; + A.Reset; // Force. for wmKind=pooled, fastcgi, request can be the same. Wa:=A.GetAction; Case WA of wdaUnknown : Raise EFPHTTPError.CreateFmt(SErrUnknownProviderAction,[ProviderName]); |
