Page 1 of 1

problem with TZStoredProc

Posted: 05.05.2010, 07:28
by emils
Hi everyone,

I am usеing ZEOSDBO-6.6.6-stable.
I am trying to set a param of TZStoredProc with this code:

TZStoredProc.ParamByName('MyDATE').asString:= '';

this generates Conversion error. In the firebird stored procedure, parameter 'MyDate' is of type Timestamp. The same problem i have with integers too.

any ideas?
thanks!

solved partially ...

Posted: 05.05.2010, 08:11
by emils
I thing the problem is in procedure TZAbstractRODataset.SetStatementParams, specially this part:

Code: Select all

if Param.IsNull then begin
         Statement.SetNull(I + 1, ConvertDatasetToDbcType(Param.DataType))
      end else begin
        case Param.DataType of
          ftBoolean:
            Statement.SetBoolean(I + 1, Param.AsBoolean);
          ftSmallInt:
            Statement.SetShort(I + 1, Param.AsSmallInt);
          ftInteger, ftAutoInc:
            Statement.SetInt(I + 1, Param.AsInteger);
................
i thing that looking for cases of Param.Datatype undermines useing type conversions like:
ParamByName(Integer Parameter).asString ...

Posted: 12.05.2010, 21:37
by mdaems
What date do you expect from TZStoredProc.ParamByName('MyDATE').asString:= '';
???
I suppose the right action is setting a null parameter.

Mark

Posted: 14.05.2010, 12:00
by trupka
TZStoredProc.ParamByName('MyDATE').asString:= '' behaves correctly - it raises conversion error because empty string can't be converted into date (and empty str is not null either).
For NULLs , there is Clear method e.g. TZStoredProc.ParamByName('MyDATE').Clear

Posted: 16.05.2010, 20:38
by mdaems
trupka,

Thanks for your intervention. That was indeed the message I wanted to pass, but your way of explaining it is way more helpfull.

Mark