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

waldo kitty wkitty42 at windstream.net
Tue Jan 20 23:13:15 CET 2009


Mattias Gärtner wrote:
> Move editor cursor over 'procedure Close;' of TCustomConnection and press
> Ctrl+Shift+Down.

ahhh, that's one i hadn't discovered... i did figure out the CTRL-Click thing 
when i had the CTRL pressed inadvertently while hovering over an item and saw 
that it changed to a link :P

so, following along a slightly different path (DoDisconnect pointed to by 
Joost), i've come to the following in database.inc...

procedure TDatabase.DoDisconnect;
begin
   Closedatasets;
   Closetransactions;
   DoInternalDisConnect;
   if csloading in ComponentState then
     FOpenAfterRead := false;
   FConnected := False;
end;

Closedatasets, Closetransactions, and DoInternalDisConnect are all pointed as 
being in db.pas and the first two, Closedatasets and Closetransactions both come 
to code blocks with CTRL-Shift-Down but DoInternalDisConnect does not :?

it is defined in db.pas as

     Procedure DoInternalDisConnect; Virtual;Abstract;

and the IDE doesn't want to show me anything about it when i hover over it so 
now i don't know where to look further :(

on a whim, i went tromping about and have found an empty DoInternalDisConnect 
routine in packages/fcl-db/src/sqldb/sqldb.pp

     procedure TSQLConnection.DoInternalDisconnect;
     begin
     end;

  and another in packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

     procedure TConnectionName.DoInternalDisconnect;
     begin
       inherited DoInternalDisconnect;
       mysql_close(FMySQL);
       FMySQL:=Nil;
       ReleaseMysql;
     end;

which would seem to want to take me to ReleaseMysql from 
packages/mysql/src/mysql.inc...


perhaps i have the wrong idea about database apps?? in all of my coding years, 
the only time i've ever maintained an open connection to the database was way 
back in my days as a dBaseIII/dBaseIV coder working with relational databases... 
this was before and just as SQL stuffs started coming along... heck, what we 
call tables today were called databases back then ;)

with that in mind, should i be maintaining a connection to the mysql database 
the whole time my app is running and only close it when i close my app? what 
about for situations where the database server may not allow persistent 
connections and may close the connection after some minutes?

FWIW: this will be a "relational" type database app in that there is projected 
to be 4 other tables beside the company data table... three of those tables will 
be "related" into the 4th by unique (to each of the 3 tables) id numbers in 
three different columns of the 4th table... yeah, for those who are quick on the 
draw, the 4th table is for sales made by each employee (one table) to each 
customer (another table) for each inventory item (the 3rd table)... and all this 
just to be able to get to the point of implementing the custom math to calculate 
the final sale price, tax and employee commission for the sale... call it an 
exercise in reinventing the wheel, eh? :P

-- 
NOTE: NEW EMAIL ADDRESS!!

        _\/
       (@@)                      Waldo Kitty, Waldo's Place USA
__ooO_( )_Ooo_____________________ telnet://bbs.wpusa.dynip.com
_|_____|_____|_____|_____|_____|_____ http://www.wpusa.dynip.com
____|_____|_____|_____|_____|_____|____ ftp://ftp.wpusa.dynip.com
_|_Eat_SPAM_to_email_me!_YUM!__|_____ wkitty42 -at- windstream.net


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 090120-0, 01/20/2009
Tested on: 1/20/09 17:13:17
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com






More information about the Lazarus mailing list