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

Reenen Laurie rlaurie at gmail.com
Sun Jan 18 21:47:53 CET 2009


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>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://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): 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
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>



-- 
o__
,_.>/ _
(_)_\(_)_______
...speed is good
_______________
I believe five out of four people have a problem with fractions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20090118/35f17c4a/attachment-0007.html>


More information about the Lazarus mailing list