mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 10:50:59 +02:00
* 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: trunk@17065 -
This commit is contained in:
parent
f0fee289c9
commit
fb6095ebfe
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user