[Lazarus] is it me or a bug that i ve been fighting?

Joost van der Sluis joost at cnoc.nl
Tue Jan 20 13:32:38 CET 2009


Op maandag 19-01-2009 om 18:29 uur [tijdzone -0500], schreef waldo
kitty:
> Martin Friebe wrote:
> > Anyway, unless you are willing to spent time on debugging the issue your 
> > self, and go into the depth of the Connector code, this will probably be 
> > of little help.
> 
> i've finally been able to work out the following...
> 
> MySQLConnection: TMySQL50Connection;
>    TMySQL50Connection = Class(TConnectionName);
>      TConnectionName = class (TSQLConnection)
>        TSQLConnection = class (TDatabase)
>          TDatabase = class(TCustomConnection)
>            TCustomConnection = class(TComponent)
>              TComponent = class(TPersistent,IUnknown,IInterfaceComponentReference)
>                TPersistent = class(TObject)
> 
> 
> it works out that MySQLConnection.Close is TCustomConnection.Close but if i 
> hover the mouse over "Close" in "Procedure Close;" in the public section of the 
> TCustomConnection definition stuffs, the editor wants to point to the textfile 
> close routine Close(var t:Text); which definitely isn't the same thing :(

You can find the code in the fpc-code-dir under
packages/fcl-db/src/base/database.inc. What primarily happens is that
doDisConnect is called.

> and with all of the searching i've done, i still don't see anything that 
> indicates where i can actually lay eyes on the code for TCustomConnection.Close 
> nor do i see anything indicating that it is assigned to another routine going by 
> another name :?

Take a look at TDatabase.DoDisconnect in the same file. It first closes
all queries which are linked to this dataset, and thereafter it closes
all transactions.

So try to close those yourself before you close the database-connection.
See where it goes wrong...

> now i know why i much prefer the old-style procedural coding methods :P
> 
> > If you get the stack backtrace you can mail it and hope some one knows 
> > about...
> 
> i still don't know what this involves :(

Run the application in gdb, and when the crash occurs, type 'bt' on the
gdb-prompt. But you must have the fcl-db package compiled with
debug-information for it to make any sense. If you really want to try,
add the fcl-db/src/base fcl-db/src/sqldb fcl-db/src/dbase and
fcl-db/src/sqldb/mysql paths to your compiler-options path and rebuild
your application within Lazarus. That way you can 'step' into the fcl-db
sources...

Joost.





More information about the Lazarus mailing list