Lazarus crash using Zeos 6.6.4 SQL 2005

Forum related to MS SQL Server

Moderators: gto, cipto_kh, EgonHugeist

psix
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 09.01.2009, 12:28

Lazarus crash using Zeos 6.6.4 SQL 2005

Postby psix » 09.01.2009, 12:38

Hello,

With lazarus 0.9.26 beta, i'm using in a form a zconnection using mssql.
When I use a Zquery and after a put active the query, lazarus crash.

If I do the same thing with a zconneciton and a table no problem appears.

The funny thing is that after the startup configuration of the zconnection to the sql 2005 server, and when put connected , no problem appears and I can see that the connection is done.

Can someone help please ?

Thanks is advance

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

Postby mdaems » 09.01.2009, 15:41

what if you set the tzquery.sql property to 'select * from <tablename>' using the tablename you used in your TZTable example?

Normally this should work as a TZTable is exactly that : a TZQuery with an automatically set SQL property.

Mark
Image

psix
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 09.01.2009, 12:28

Postby psix » 15.01.2009, 11:16

Thanks Mark for your help, but that didn't work also.

I'm using in the test form a zcconection , a zquery and a Tdatasource, and the goal is to show in a grid the record of a table, that should appear after turning on the active property of the zquery.

Im using Lazarus in Windows, and when in zquery.sql property a use like "select * from <tablename>" , after the active in turned on, the lazarus crash without a message.

Any suggestion ?

Thanks in advance

Paulo

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

Postby mdaems » 15.01.2009, 11:22

In that case the only thing we can do now is debug until the crash line is found...
I've no mssql server available. So no way I can test it.

So if you set the connection active during design time and compile, your program also works? If not, that may mean there are environment differences between the Lazarus exe context and your program executable.

Mark
Image

psix
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 09.01.2009, 12:28

Postby psix » 19.01.2009, 13:14

Hi Mark

In design time I can put active the connection , but when I active the zquery, that as a "select * from <tablename>" in the SQL property, it crash everything including lazarus.

I've tried every way (in design and with source code), but it seems that doesn't work at all.

Does SQL 2005 Express produced the same ? Can you tried with that ? I'm trying to do a application with lazarus to manage some account documents for my company, and I don't want to change again to Delphi 7.

Thanks in advance

PS

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

Postby mdaems » 19.01.2009, 13:35

Paulo,

I have no SQL server available... So that's really bad luck for you.
Do you still have a D7 copy where you can test the situation on? Just to make sure it's Lazarus only?

To find out where it goes wrong exactly:
- Make sure the zeoslib sources are read by the debugger as well
- Add a button to your form to open the query
- Put a debug point on the ZQuery1.Open line
- Step into the zeoslib internal code until you're thrown out. Maybe you can do this layer by layer instead of going until the lowest level at once. So find out what line of a procedure is the last one entered before digging deeper into a subprocedure. eg just step through ZAbstractRODataset.InternalOpen instead of also stepping into all it's subroutines. In a second pass you can step into the subprocedure that finally threw you out of Lazarus.

Mark
Image

psix
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 09.01.2009, 12:28

Postby psix » 22.01.2009, 11:59

Thanks Mark.

I've have done the following code in the button clause :
ZConnection1.Connected := True;
ZQuery1.SQL.Clear;
ZQuery1.SQL.Add('Select * from TEMP_VENDAS');
ZQuery1.Active:= True;

When debugging the application send me a "Project raise exception class 'External : SIGSEGV'
address : $7C90E8C5
Procedure : strchr
File:

after the the Zquery1.active := True statment

I will try with D7 to see if the same occurs.

Thanks in advance

Paulo

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

Postby mdaems » 22.01.2009, 14:56

I suppose there's no way to get a call stack? I think fpc can do it with the -gh and -gl options (see Lazarus compiler options).
So you can find out in which zeoslib unit/function the strchr function is called, debug deeper and find out what the parameters were exactly.

Mark
Image

psix
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 09.01.2009, 12:28

Postby psix » 23.01.2009, 16:13

Mark

Here it's the code from debugger , when he raize error:

Paulo

----------
procedure TZDBLibMSSQL7PlainDriver.CheckError;
var
I: Integer;
S: string;
lErrorEntry: PDBLibError;
lMesageEntry: PDBLibMessage;
begin
{ TODO -ofjanos -cGeneral : Error handling should be based on connection object.
At the moment it is global. }
if (MSSqlErrors.Count = 0) and (MSSqlMessages.Count = 0) then
Exit;
S := '';
for I := 0 to MSSqlErrors.Count - 1 do
S := S + PDBLibError(MSSqlErrors.Items[I]).DbErrStr + ' '
+ PDBLibError(MSSqlErrors.Items[I]).OsErrStr + ' '#13;
for I := 0 to MSSqlMessages.Count - 1 do
if PDBLibMessage(MSSqlMessages.Items[I]).Severity > EXINFO then
S := S + PDBLibMessage(MSSqlMessages.Items[I]).MsgText + ' '#13;
while MSSqlErrors.Count > 0 do
begin
lErrorEntry := MSSqlErrors.Items[0];
Dispose(lErrorEntry);
MSSqlErrors.Delete(0);
end;
MSSqlErrors.Clear;
while MSSqlMessages.Count > 0 do
begin
lMesageEntry := MSSqlMessages.Items[0];
Dispose(lMesageEntry);
MSSqlMessages.Delete(0);
end;
MSSqlMessages.Clear;
if S <> '' then
raise Exception.Create(S);
end;

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

Postby mdaems » 29.01.2009, 21:53

Sorry for the delay, I didn't login for 6 days now...

The thing you show above is NOT a call stack. The piece of code you quote does not contain a call to the failing strchr function. So I can't guess what line exactly it's going wrong. The problem may even be in a lazarus/fpc function that's calling strchr.

Mark
Image


Return to “MS SQL Server”

Who is online

Users browsing this forum: No registered users and 1 guest