Subject Re: [IBO] Firebird 2: "default" parameters in stored procedures
Author Dmitry Beloshistov
Hello, Martijn!
You wrote to <ibobjects@yahoogroups.com> on Fri, 20 Jan 2006 10:46:13 +0100:

MT> Does TIBOStoredProc have a way to use the default value of a stored
MT> procedure parameter?

AFAIK - can be introduced as (it example only!). It`s for Query. But for
stored procedure it`s can be similar.

Constructor TIB_MyQuery.Create(Owner:TComponent);
begin
inherited;
FDefParamValues:=TIB_StringList.Create;
end;

Destructor TIB_MyQuery.Destroy;
begin
if Assigned(FDefParamValues) then FreeAndNil(FDefParamValues);
inherited;
end;

// overrided method SysAfterPrepare from standard TIB_Query

Procedure TIB_MyQuery.SysAfterPrepare;
var i:integer;
S:String;
begin
inherited SysAfterPrepare;
if Prepared then
if (FDefParamValues.Count>0) then // FDefParamValues - internal
TIB_StringList
// contains
strings in default IBO representation:
//
PARAMNAME=ParamValue
begin
for i:=0 to Pred(ParamCount) do
begin
if Params[i].IsNull then
S:=FDefParamValues.LinkValues[Params[i].FieldName];
if (S<>'') then
begin
if UpperCase(S)='NULL' then Params[i].Clear // set to NULL
else Params[i]:=S; // set value
end;
end;
end;
end;


WBR,Dmitry Beloshistov AKA [-=BDS=-]