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

waldo kitty wkitty42 at windstream.net
Mon Jan 19 00:33:48 CET 2009


thanks for your response, reenen... it does tend to make sense on the one hand 
but on the other i "must" ask if you have looked at and/or run the demo code i 
pointed to?

it does check if the connection is open ;)

procedure TFormTryMySQL.ConnectButtonClick(Sender: TObject);
begin
   // Check if we have an active connection. If so, let's close it.
   if MySQLConnection1.Connected then begin
     SQLTransaction1.Active := False;
     MySQLConnection1.Close;
   end;
blahfooblah...;

when i place logging lines in the above, the last logging line that executes is 
the one right above "MySQLConnection1.Close;" which indicates the error in is 
the "MySQLConnection1.Close;" library code...

i can see where what you are saying may be possible but it doesn't make sense 
because the next time the above is executed, it works "properly" (ie: there's no 
error)..

what it almost sounds like is that in closing the connection object, something 
was not created during the open which somehow does get created during the close...

again, i dunno and that's why i'm here... one would think that demo code should 
work and work properly (ie: without error) out of the box... i won't point back 
to my comment about having problems with several other of the wiki demo apps not 
working for some reason or another :?



Reenen Laurie wrote:
> I am very uninformed when it comes to databases, but access violations 
> happens when you do stuff to stuff that's not there.
> 
> My guess is that for some reason your "close" code gets fired twice, and 
> thus it's already closed by the time you get there the second time.
> 
> So if there's a way to check if it's open, before you close it, I'd 
> suggest try to close it inside an if open...
> 
> Regards,
> -Reenen
> 
> On Sun, Jan 18, 2009 at 9:39 PM, waldo kitty <wkitty42 at windstream.net 
> <mailto:wkitty42 at windstream.net>> wrote:
> 
> 
>     history: i'm a long time pascal coder... since TP3 first appeared on the
>     market... then to TP5 and most of my time with TP6/BP6 and numerous
>     commercial
>     apps under my belt... i've dabbled with OOP stuffs, TP7/BP7 and even
>     have a copy
>     of delphi6-personal that i've not been able to wrap my head
>     around... since my
>     delphi was a downloaded copy from Inprise, it is also a bit harder
>     to work with
>     since i've no real documentation that i can lay in my lap to look
>     over while
>     working on code :? :(
> 
>     in any case, i've been fighting a battle with mysql50conn for a few
>     weeks,
>     now... i started with Lazaruz 0.9.26 and last night installed
>     Lazarus 0.9.27 to
>     see if the problem i'm facing may have been fixed in there but it
>     has not and
>     i'm not even certain if the problem is in the library code or
>     possibly something
>     on this old win98SE box :?
> 
>     ok, enough of the history and story telling...
> 
>     the details: with the tutorial DB code on the wiki (yeah, i was
>     /finally/ able
>     to get two or three of those working after some starts, stops and
>     fits :P),
>     there's several that check to see if the connection to the database
>     is active
>     and if it is, they attempt to close it... my problem is that the
>     first attempt
>     to close the connection _always_ throws an error... i don't know
>     what specific
>     error code because the popup box doesn't state it... the box only says
> 
>       Access violation.
> 
>       Press Ok to ignore and risk data corruption.
>       Press Cancel to kill the program.
> 
>       [OK] [Cancel]
> 
>     i'm triggering my initial connection to the database via a button. i
>     click the
>     button, the connection takes place, data is retrieved, and the
>     connection is
>     attempted to close... that's when the error is thrown... however, if
>     i hit the
>     [OK] button to ignore the error then i can open and close the
>     connection to the
>     database with no problems... at least it appears that way because
>     other routines
>     gather other data from other tables and they all connect, gather,
>     and disconnect
>     without problems... all routines use the very same disconnect
>     routine and this
>     is what leads be to believe that there's something in the library
>     code that's
>     the problem...
> 
>     currently, all the code i'm using simply uses the close procedure of the
>     connection object (ie: MySQL50Connection.Close)... i've only one
>     graphical demo
>     app that doesn't exhibit this problem but it is using mysql4 in the
>     uses and a
>     lot of manual code instead of the connector, transaction, and sqlquery
>     objects... i also have the text modedemo app working and it doesn't
>     have the
>     problems either... now, i'm not sure, at all, if any of the (demo)
>     apps i'm
>     working with are using the libmysql.dll file that i placed in my
>     windows/system(32?) directory or not... i believe that the textmode
>     demo would
>     not run without that dll but that was several weeks ago when i was
>     playing with
>     it and it was also in the plain FPC 2.2.2 installation i have/had on
>     here before
>     i figured out that Laz came with FPC in its tree...
> 
>     for those who want/need a link to example code that exhibits this
>     problem, i'm
>     using the downloaded code "TryMySQL5 Modified by Arwen" but i can't
>     find the
>     link in the wiki now :( in any case, this is the TryMySQL5 demo app
>     with the
>     fields for the server, username, and password rather than them being
>     hardcoded... once you fill them in, then you click the [Connect]
>     button to
>     connect to the server and get a list of available databases... now
>     you choose a
>     database from the combo box and then click the [Select Database]
>     button... it is
>     at this point that the error is thrown when the connection is closed and
>     reopened so the new database can be used...
> 
> 
>     FWIW:
>     here's the memo field "log" with the error point marked with '>>'
>     and yes, i've
>     slightly modified the "logging" to try to figure out where the error
>     is taking
>     place and every time the last line logged before the popup box
>     appears is the
>     one right above the mysql50connection.close line...
> 
>       14:26:18: Opening a connection to server: ender
>       14:26:19: Connected to server: ender
>       14:26:19: Retreiving list of available databases.
>       14:26:19: Query ACTIVE and at the first record
>       14:26:19: List of databases received!
>      >>14:26:26: Closing connection
>       14:26:33: Closing connection
>       14:26:33: Connection closed...
>       14:26:33: DatabaseComboBox.ItemIndex: 2
>       14:26:33: DatabaseComboBox.Items[ItemIndex]: kims
>       14:26:33: setting SQL statement...
>       14:26:33: Retrieving list of tables
>       14:26:33: opening sql query...
>       14:26:34: List of tables received
> 
>     so, at 14:26:26, i clicked the [Select Database] button and then
>     clicked the
>     [OK] button in the error box and then i clicked on the [Select
>     Database] button
>     again (14:26:33)...
> 
>     so, there it is with all my wordiness and verbiage... oh, and the
>     hidden subtle
>     "am i linked?" test message ;)
> 
>     so, is it me or is it a bug in the library? if the library, which
>     library? Laz
>     stuff or FPC stuff?
> 
>     --
>     NOTE: NEW EMAIL ADDRESS!!
> 
>            _\/
>           (@@)                      Waldo Kitty, Waldo's Place USA
>     __ooO_( )_Ooo_____________________ telnet://bbs.wpusa.dynip.com
>     <http://bbs.wpusa.dynip.com>
>     _|_____|_____|_____|_____|_____|_____ http://www.wpusa.dynip.com
>     ____|_____|_____|_____|_____|_____|____ ftp://ftp.wpusa.dynip.com
>     _|_Eat_SPAM_to_email_me!_YUM!__|_____ wkitty42 -at- windstream.net
>     <http://windstream.net>
> 
> 
>     ---
>     avast! Antivirus: Outbound message clean.
>     Virus Database (VPS): 090117-0, 01/17/2009
>     Tested on: 1/18/09 14:39:07
>     avast! - copyright (c) 1988-2009 ALWIL Software.
>     http://www.avast.com
> 
> 
> 
>     _______________________________________________
>     Lazarus mailing list
>     Lazarus at lazarus.freepascal.org <mailto:Lazarus at lazarus.freepascal.org>
>     http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> 
> 
> 
> 
> -- 
> o__
> ,_.>/ _
> (_)_\(_)_______
> ...speed is good
> _______________
> I believe five out of four people have a problem with fractions.


-- 
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): 090118-0, 01/18/2009
Tested on: 1/18/09 18:33:51
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com






More information about the Lazarus mailing list