Page 1 of 1

TZStoredProc / Firebird error -501

Posted: 04.09.2010, 12:19
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?

Posted: 04.09.2010, 20:16
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

test project

Posted: 05.09.2010, 12:09
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

Posted: 08.09.2010, 21:15
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

Posted: 09.09.2010, 19:34
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

Posted: 18.09.2010, 05:41
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

Posted: 19.09.2010, 22:59
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

Posted: 22.09.2010, 15:56
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?

Re: Fixes for Stored Produre 501 Error

Posted: 25.09.2010, 16:59
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.

Re: test project

Posted: 25.09.2010, 17:47
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.