FB: AV with invalid SQL. No correct error message / Exceptio

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
mscherr
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 06.02.2009, 09:25
Location: Grevenmacher

FB: AV with invalid SQL. No correct error message / Exceptio

Post by mscherr »

I'm using the latest ZEOS from the SVN from today.

Also in the version before that, I always had the problem, that I never got a meanfull error message when I entered a invalid SQL command. Instead I got a AV in the ZEOS sources.

I was able to fix it by adding a check if FParamSQLData is assigned as is was nil when the AV happened.

Code: Select all

procedure TZInterbase6PreparedStatement.UnPrepareInParameters;
begin
  if assigned(FParamSQLData) then
    FParamSQLData.FreeParamtersValues;
  inherited UnPrepareInParameters;
end;
Can anyone reproduce this issue?


Regard,
Michael
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Can you provide an example which permit us to reproduce the problem you did?

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

Post by mdaems »

This change looks reasonable without a test case. So I committed this to testing branch. (Rev 638)

Mark
Image
mscherr
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 06.02.2009, 09:25
Location: Grevenmacher

Post by mscherr »

Thank!

I had the problem with any invalid sql-command.

TZQuery + TZConnection connected to a firebird 2 server:

select * from existingtablename
= OK

select * from notexistingtablename
= AV

The debugger always stopped twice at this point. The 1st time with FParamSQLData assigned, the 2nd time with FParamSQLData=nil.

Now I get the correct firebird error message.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

The debugger always stopped twice at this point.
Big question : is this twice for the same Object or not? Maybe we must check the call stacks to see why it's executed twice.

Mark
Image
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

I wrote a test in order to verify that problem, but I noted that the procedure TZInterbase6PreparedStatement.UnPrepareInParameters is called before an exception (sInvalid ..) is raised. Is it correct?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

seawolf,
Who are you asking this question?

Were you able to write a test suite case failing because of this issue (without the patch applied)? In that case I might help testing to see why the Unprepare is called twice. My first impression is that it's just normal error handling (= make sure everything's cleaned up), but better be sure...

Mark
Image
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

I wrote a test in order to understand why UnPrepareInParameters is called 2 times (as stated). But, it seems, UnPrepareInParameters is called after a Sinvalid .. exception is raised.

So my question to mscherr is if this is the normal behaviour or I something is wrong.

Anyway I've not applied that patch yet.
mscherr
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 06.02.2009, 09:25
Location: Grevenmacher

Post by mscherr »

Well, I don't know if this is or should be the normal behavior.

MadExpect gave me the callstack of the problem and placing a breakpoint and executing a simple sql query to a not existing table gave me 2 stops...
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Really sorry, what I wrote was not clear.

My question was not related Zeos normal behaviour, but when you had that error, an exception was raised, your software continue and afterDo you have the problem on UnPrepareInParameters?

Or no exceptions were raised and Do you have the problem related to UnPrepareInParameters?
mscherr
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 06.02.2009, 09:25
Location: Grevenmacher

Post by mscherr »

An AV was raised cause of the nil pointer. MadExcept (an AddOn for Delphi to catch and report exceptions in applications like Eureka Log) catched the AV and gave me the callstack where it happended. With ME turned off the app gave me the AV and stopped.

Like I said: After ME gave me the unit, method and line of code, I placed a breakpoint. It stopped twice, 1st time with the pointer assigned, 2nd time with pointer=nil.
Locked