diff options
| author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-03-03 09:39:39 +0000 |
|---|---|---|
| committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-03-03 09:39:39 +0000 |
| commit | c1ff59a2962e515e2848439fcc029c8859055bbe (patch) | |
| tree | 970ff3f4a8def1cf13bcfdd38beb1e36dacf0901 /packages/fcl-web | |
| parent | 4dbed257d098191503c068e35ff8e2a629734d01 (diff) | |
| download | fpc-c1ff59a2962e515e2848439fcc029c8859055bbe.tar.gz | |
* SetTypedParam: Clear parameter if data is empty and not a string. Fixed bug with GetNewID - undid virtual, moved to DoGetNewID to correctly save Last inert ID
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17065 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-web')
| -rw-r--r-- | packages/fcl-web/src/webdata/sqldbwebdata.pp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/packages/fcl-web/src/webdata/sqldbwebdata.pp b/packages/fcl-web/src/webdata/sqldbwebdata.pp index c706904971..81783a9d8f 100644 --- a/packages/fcl-web/src/webdata/sqldbwebdata.pp +++ b/packages/fcl-web/src/webdata/sqldbwebdata.pp @@ -44,7 +44,8 @@ Type Procedure DoApplyParams; override; Function SQLQuery : TSQLQuery; Function GetDataset : TDataset; override; - Function GetNewID : String; virtual; + Function DoGetNewID : String; virtual; + Function GetNewID : String; Function IDFieldValue : String; override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; Property SelectSQL : TStrings Index 0 Read GetS Write SetS; @@ -273,7 +274,12 @@ Var begin ft:=GetParamtype(P,AValue); - If ft<>ftUnknown then + If (AValue='') and (not (ft in [ftString,ftFixedChar,ftWideString,ftFixedWideChar])) then + begin + P.Clear; + exit; + end; + If (ft<>ftUnknown) then begin try case ft of @@ -358,7 +364,10 @@ begin if not B then begin If (P.Name=IDFieldName) and DoNewID then - SetTypedParam(P,GetNewID) + begin + GetNewID; + SetTypedParam(P,FLastNewID) + end else If Adaptor.TryFieldValue(P.Name,S) then SetTypedParam(P,S) else If Adaptor.TryParamValue(P.Name,S) then @@ -394,12 +403,17 @@ begin {$ifdef wmdebug}SendDebug('Get dataset: done');{$endif} end; -function TCustomSQLDBWebDataProvider.GetNewID: String; - +function TCustomSQLDBWebDataProvider.DoGetNewID: String; begin If Not Assigned(FOnGetNewID) then Raise EFPHTTPError.CreateFmt(SErrNoNewIDEvent,[Self.Name]); FOnGetNewID(Self,Result); +end; + +function TCustomSQLDBWebDataProvider.GetNewID: String; + +begin + Result:=DoGetNewID; FLastNewID:=Result; end; |
