TZStoredProc / Firebird error -501

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

TZStoredProc / Firebird error -501

Post by nostradumbass »

Hi,

Using:
Delphi 2010
Zeos 7 [ZEOSLIB_TRUNK_REV803]
Firebird 2.1.3 embedded

Problem:
I upgraded my project to Delphi 2010/Zeos 7 (from Delphi 2007/Zeos 6.6.6 - it used to work perfect). Now I am getting this error for stored procedures (Insert, Update, Delete etc...) :
Project teml.exe raised exception class EZSQLException with message 'SQL Error: Dynamic SQL Error SQL error code = -501 Attempt to reclose a closed cursor. Error Code: -501. The cursor identified in a FETCH or CLOSE statement is not open.'.
In Firebird stored procedure:

Code: Select all

CREATE PROCEDURE CLIENT_I(
  CLIENTNAME VARCHAR(250) CHARACTER SET UTF8 COLLATE UTF8,
  "POSITION" VARCHAR(250) CHARACTER SET UTF8 COLLATE UTF8,
  COMPANY VARCHAR(250) CHARACTER SET UTF8 COLLATE UTF8,
  EMAIL VARCHAR(250) CHARACTER SET UTF8 COLLATE UTF8)
AS
BEGIN
  INSERT INTO CLIENT (
    CLIENTNAME,
    "POSITION",
    COMPANY,
    EMAIL)
  VALUES (
    :CLIENTNAME,
    :"POSITION",
    :COMPANY,
    :EMAIL);
END^

In Delphi code:

Code: Select all

procedure Tdatamod.AddClient(AClientName, APosition, ACompany, AEmail: string);
begin
  with datamod.ZSP_CLIENT_I do     //insert values
  begin
    ParamByName('ClientName').AsString := AClientName;
    ParamByName('Position').AsString := APosition;
    ParamByName('Company').AsString := ACompany;
    ParamByName('Email').AsString := AEmail;

    ExecProc;
  end;
end;

What is the solution ? Should I wait for some time until it is fixed? How long?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

nostradumbass,

I'm afraid I have really not enough time to look into this issue. So a little debugging from you side might prove more effective. If you can send me an easy test case, including database and all needed dll's, this might make it easier for me to give it some time. (I'm not a FB user, so the fact that you're using the embedded server version is already a positive thing)

Probably it comes from the changes done to make firebird queries (and thus also stored procs) really prepared, executed and reusable.
Probably this occurs because it's is a stored proc that doesn't return any datasets. Maybe I forgot to tak this into account when moving the cleanup code to the unprepare code (or something similar).

Mark
Image
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

test project

Post by nostradumbass »

mdaems -

I have uploaded the source and database for a simple Delphi 2010 test project at this link:

http://www.filehosting.org/file/details ... roject.rar

Note that I used the latest Zeos source from the Trunk of the SVN.

Looking forward to your response and eagerly awaiting a fix soon :?

Regards,
ND
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi,


I just managed to download the test project. (Doesn't work with Google Chrome, btw)
I hope I get access to a D2010 installation...

Mark
Image
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

Post by nostradumbass »

Mark

Hope you can solve it :) There is no other component that comes close to Zeos in terms of user-friendliness and light-weight for me (eg. I tried to install FIBPlus but it is so complicated and behaves differently, similarly, I tried the DBExpress [D2010] Firebird driver, and the same thing - it behaves differently. The main thing I like about Zeos is the ability for the TZStoredProcedure component to return a result set - which the other components do not provide.)


Best Regards,
ND
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

Post by nostradumbass »

Mark

Did you have a look at the test case?

Any idea when this can be solved? My product is suffering without release until this gets resolved.


Regards,
ND
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

nostradumbass,

Didn't look into it yet. (Sorry, but to me zeoslib is just a hobby).
However look here : http://zeos.firmos.at/viewtopic.php?t=2934
André might have found a solution. I don't know his code yet, however.

Mark
Image
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

Post by nostradumbass »

That solution is no use unless the changes are incorporated into the source code, and I can download the fix. Question is when? Another question is has this issue been recorded in the official bugtracker for resolution so that someone can work on it?
andrevanzuydam
Zeos Dev Team
Zeos Dev Team
Posts: 32
Joined: 22.10.2005, 08:53
Location: Bloemfontein
Contact:

Re: Fixes for Stored Produre 501 Error

Post by andrevanzuydam »

Hi Everyone

I have released the patch for the exec stored procedure into the test branch. I seem to have exposed another bug though in doing this fix as I see when calling a stored procedure a second time I get a parameter mismatch, to fix this I simply prepare the procedure again but the correct solution would be to get the params in the correct order.

For now I believe this one is working, I will work on the parameter problem as it is not only todo with Firebird.

Let me know if there are any other problems with the stored procs as we can now get some results.
Image
Nothing is impossible!
andrevanzuydam
Zeos Dev Team
Zeos Dev Team
Posts: 32
Joined: 22.10.2005, 08:53
Location: Bloemfontein
Contact:

Re: test project

Post by andrevanzuydam »

nostradumbass wrote:mdaems -

I have uploaded the source and database for a simple Delphi 2010 test project at this link:

http://www.filehosting.org/file/details ... roject.rar

Note that I used the latest Zeos source from the Trunk of the SVN.

Looking forward to your response and eagerly awaiting a fix soon :?

Regards,
ND
Checked the patch with this, seems to work fine.
Image
Nothing is impossible!
Locked