Firebird4-Execute block and parameters FAILs

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
hamacker
Junior Boarder
Junior Boarder
Posts: 37
Joined: 13.10.2021, 15:15

Firebird4-Execute block and parameters FAILs

Post by hamacker »

Query sintax perfect outside Zeos:
execute block (
  P_UUID_AGENDA varchar(36)=:P0     ,
  P_UUID_COLABORADOR varchar(36)=:P1,
  P_DT_NUTIL date=:P2          ,
  P_DESCRICAO varchar(4096)=:P3    )
as
begin
  if (not exists(select * from AGENDA_NUTIL
                where UUID_COLABORADOR=:P_UUID_COLABORADOR
                   and DT_NUTIL=:P_DT_NUTIL)) then
  begin
    update or insert into AGENDA_NUTIL (
      UUID_AGENDA, UUID_COLABORADOR, DT_NUTIL, DESCRICAO)
    values (
      :P_UUID_AGENDA, :P_UUID_COLABORADOR, :P_DT_NUTIL, :P_DESCRICAO)
    matching (UUID_AGENDA);
  end
end
Execute in Lazarus 2.3(rc)/Win32/fpc 3.2/Zeos 7.2.14.0/Firebird 4:
      
      qt1.ParamCheck:=true;
      qt1.prepare;   
      qz1.Params[0].AsString:='babla';
      qz1.Params[1].AsString:='blabla';
      qz1.Params[2].AsDateTime:=StrToDate('01/01/1970');
      qz1.Params[3].AsString:='blabla'; 
      qz1.ExecSQL;  -- fail here
Returning error: invalid request BLR at offset 131 undefined parameter number. Error code: -104. Invalid token The SQL: execute block (repete entire query)
I try turn on/off ParamCheck and the same result. Do I something wrong?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: Firebird4-Execute block and parameters FAILs

Post by marsupilami »

Hello hamacker,

I assume that Zeos recognizes ":P_DT_NUTIL" and ":P_UUID_AGENDA, :P_UUID_COLABORADOR, :P_DT_NUTIL, :P_DESCRICAO" as parameters. Please choose another ParamChar (maybe ~?) and use that. This could look like this:

Code: Select all

execute block ( /* note the ~ here */
  P_UUID_AGENDA varchar(36)=~P0     ,
  P_UUID_COLABORADOR varchar(36)=~P1,
  P_DT_NUTIL date=~P2          ,
  P_DESCRICAO varchar(4096)=~P3    )
as
begin
  if (not exists(select * from AGENDA_NUTIL
                where UUID_COLABORADOR=:P_UUID_COLABORADOR
                   and DT_NUTIL=:P_DT_NUTIL)) then
  begin
    update or insert into AGENDA_NUTIL (
      UUID_AGENDA, UUID_COLABORADOR, DT_NUTIL, DESCRICAO)
    values (
      :P_UUID_AGENDA, :P_UUID_COLABORADOR, :P_DT_NUTIL, :P_DESCRICAO)
    matching (UUID_AGENDA);
  end
end
Best regards,

Jan
hamacker
Junior Boarder
Junior Boarder
Posts: 37
Joined: 13.10.2021, 15:15

Re: Firebird4-Execute block and parameters FAILs

Post by hamacker »

Hi I try
qt1.ParamChar:='?'
and not run!
and change to ~, and now it´s run!
Thanks a lot.
Post Reply