Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-01

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

21 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

waldo kitty

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

Reply by email

Reenen Laurie
to waldo kitty

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

waldo kitty wrote 158 lines
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 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://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090118/35f17c4a/attachment.html

Reply by email

Reenen Laurie
to waldo kitty: history: i'm a long time pascal coder... since TP3 first appeared on the market... then…

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

waldo kitty wrote 158 lines
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 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://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20090118/80aa37e4/attachment-0001.html

Reply by email

waldo kitty
to Reenen Laurie

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 189 lines
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 < <mailto:>> 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 <mailto:> 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

Reply by email

Martin Friebe
to waldo kitty

Hi,

let me start with "No I have not executed the demo code";

but a couple of thinks that come to mind:
1) What version of FPC are you using (you only said you updated Lazarus); you refer to FPC 2.2.2, have you tried the fixes branch (2.2.3)? or trunc(2.3.1)?

2) You say you do not know the exact error: " because the popup box doesn't state it" => Try running the exe in the debugger, make sure you compile with debug symbols for gdb (-g, maybe also -gl). Or try to compile "not" as a windows app (switch off -WG) then you get a console window, and a lot of output.
(Both options are in Project->compiler options->tab: linking)

It could be in the RTL, in which case it would be helpful to rebuild this with debug support

Good Luck

waldo kitty wrote 228 lines
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 < > <mailto:>> 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 > <mailto:> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > > > > > -- > o__ > ,_.>/ _ > (_)_\(_)_______ > ...speed is good > _______________ > I believe five out of four people have a problem with fractions. >

Reply by email

Lord Satan
to waldo kitty: thanks for your response, reenen... it does tend to make sense on the one hand but on the…

Hi,

I have never done any database stuff either, but AVs cry for a debugger. Maybe other people on this list can help you, but it will do no harm to give gdb (or some such) a chance.

hih

A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?

Reply by email

waldo kitty
to Martin Friebe: let me start with "No I have not executed the demo code"; but a couple of thinks that…
Martin Friebe wrote
let me start with "No I have not executed the demo code";

:) i can appreciate that ;)

but a couple of thinks that come to mind: 1) What version of FPC are you using (you only said you updated Lazarus); you refer to FPC 2.2.2, have you tried the fixes branch (2.2.3)? or trunc(2.3.1)?

i'm using whatever comes with lazarus... i started with laz 0.9.26 and then completely removed it to install 0.9.27 because i found that some config settings are evidently hardcoded or shared in a/the registry when a dual install of 0.9.27 still had some things pointing to the old 0.9.26 stuffs :? :(

and that might be another "bug" or something where one can't install laz 0.9.26 to one directory and 0.9.27 to another and have each come out of the box without sharing any config settings or something... i dunno, as i'm still trying to come to grips with the whole GUI interface and drop this here and that there to create a "hello world!" GUI app that's 10Meg (tongue in cheek!) in size compared to a textmode version that's only 2K ;) :lol:

2) You say you do not know the exact error: " because the popup box doesn't state it" => Try running the exe in the debugger, make sure you compile with debug symbols for gdb (-g, maybe also -gl).

i've not changed any settings from the defaults on install... i have, a few times, run some stuff directly from the GUI in the debugger but even with 256Meg of RAM in this box, it gets a bit on the tight side at times which is why i switched over to simply building the apps and then shutting down laz and running the built code outside on its own... maybe that wasn't/isn't such a good idea?

Or try to compile "not" as a windows app (switch off -WG) then you get a console window, and a lot of output. (Both options are in Project->compiler options->tab: linking)

hummm... that's something i haven't tried and actually wasn't aware of... since i'm on a winwhatever box, i did turn on the windows app option in the settings but other than that, i've not altered any settings from their defaults (that i know of)...

It could be in the RTL, in which case it would be helpful to rebuild this with debug support

interesting... how to do that, i dunno but it would also seem that others might attempt to run the same demo(s) i'm pointing to in a clean install environment if for nothing other than to at least confirm it on other machines/installs than mine... i can't say that my setup is perfect... long way from it, in fact but it just seems that since i've reproduced it in at least two separate installations, that... well... you know? ;)

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/19/09 02:00:02 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

waldo kitty
to Martin Friebe: let me start with "No I have not executed the demo code"; but a couple of thinks that…
Martin Friebe wrote
2) You say you do not know the exact error: " because the popup box doesn't state it" => Try running the exe in the debugger, make sure you compile with debug symbols for gdb (-g, maybe also -gl).

just following up on this (as my other reply hasn't srrived back from the list yet) but i have just attempted to, with laz 0.9.27 fpc 2.2.3, run my app from the laz gui via F9... i got a box stating

Project raised exception class 'External SIGSEGV'

at which point i could only click on the [OK] button in that box... then it appeared that my box was locked up but it took a minute or so and another box appeared titled "Assembly" with what appeared to be a list of addresses but i farkled things up by attempting to scroll the box to see what may have been listed and i lost the starting point that it gave me...

so, at that point, i used the Laz GUI's "stop" (CTRL-F2 IIRC) option to terminate the app but now i'm still waiting on Laz to come back to life... since it has been over 5 minutes, it appears that i'm going to have to reboot the system to get it back and try to go on further :?

Or try to compile "not" as a windows app (switch off -WG) then you get a console window, and a lot of output. (Both options are in Project->compiler options->tab: linking)

i may try this option next... dunno know what i'll see as far as output... anything special i should watch for or possibly TEE to a log file??

maybe i should also mention that i'm using 4DOS for a command interpreter replacement, too?? possibly that could have something to do with this problem??

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/19/09 02:14:14 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

waldo kitty
to waldo kitty
waldo kitty wrote 12 lines
Project raised exception class 'External SIGSEGV' at which point i could only click on the [OK] button in that box... then it appeared that my box was locked up but it took a minute or so and another box appeared titled "Assembly" with what appeared to be a list of addresses but i farkled things up by attempting to scroll the box to see what may have been listed and i lost the starting point that it gave me... so, at that point, i used the Laz GUI's "stop" (CTRL-F2 IIRC) option to terminate the app but now i'm still waiting on Laz to come back to life... since it has been over 5 minutes, it appears that i'm going to have to reboot the system to get it back and try to go on further :?

and another followup... i finally ended up using enditall to kill the gdb and laz tasks... laz first since i didn't notice gdb until afterward... anyway, i then reloaded laz and ran my app via F9 again... this time, i left the Assembler (not Assembly as previously stated) window alone when it came up and after a minute or so, its output finally settled down such that the output looks like so...

BFF8AC13
03508E48 ......
03508E49 ......
03508E4A ......
03508E4B ......
03508E4C ......
03508E4D ......
03508E4E ......
03508E4F ......
03508E50 ......
03508E51 ......
03508E52 ......
03508E53 ......
03508E54 ......
03508E55 ......
03508E56 ......
03508E57 ......
03508E58 ......
03508E59 ......
03508E5A ......
03508E5B ......
03508E5C ......

and that's all i can see without mucking about with that box...

since i can't resist, i did try to scroll up to see what i could see and i have this for the X entries above the starting and including the first one in the above...

BFF8AC0F ......
BFF8AC10
BFF8AC10
BFF8AC10
BFF8AC10
BFF8AC10 ......
BFF8AC11 ......
BFF8AC12 ......
BFF8AC13 << starting point of above...

dunno know if that helps anyone or not.. it doesn't help me as it appears to be addresses but there's no associated content :(

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/19/09 02:33:01 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

waldo kitty
to Martin Friebe: let me start with "No I have not executed the demo code"; but a couple of thinks that…
Martin Friebe wrote
Or try to compile "not" as a windows app (switch off -WG) then you get a console window, and a lot of output. (Both options are in Project->compiler options->tab: linking)

now i've done this and i still got the GUI window of my app which allowed me to click the [connect] so that i could run this in the same way as i have been doing... i did get a "msdos" window but there was no output in it at all... i still also got that assembler window and every time it has come up, the starting address has been the same but the other numbers under it have been different...

now what? :?

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/19/09 02:51:09 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

Martin Friebe
to waldo kitty: :) i can appreciate that ;) i'm using whatever comes with lazarus... i started with laz…
waldo kitty wrote 13 lines
Martin Friebe wrote: > but a couple of thinks that come to mind: > 1) What version of FPC are you using (you only said you updated > Lazarus); you refer to FPC 2.2.2, have you tried the fixes branch > (2.2.3)? or trunc(2.3.1)? > i'm using whatever comes with lazarus... i started with laz 0.9.26 and then completely removed it to install 0.9.27 because i found that some config settings are evidently hardcoded or shared in a/the registry when a dual install of 0.9.27 still had some things pointing to the old 0.9.26 stuffs :? :(

On the daily snapshot page, you get a windows build with fpc 2.2.2 and another one with 2.2.3 (eq fixes branch of fpc)

lookup -pcp (--primar-config-path)
Lazarus does what a windows app should do, it stores setting in you users home director (depends on windows version)

Then if you installed Lazarus (incl fpc) in one directory => do not rename the directory; otherwise you must update you fpc.cfg file (windows search to locate)

If you have multiply installations, you may have to go to environment->options, and adapt the path to fpc
(once you use -pcp)

Show quoted text 7 lines
and that might be another "bug" or something where one can't install laz 0.9.26 to one directory and 0.9.27 to another and have each come out of the box without sharing any config settings or something... i dunno, as i'm still trying to come to grips with the whole GUI interface and drop this here and that there to create a "hello world!" GUI app that's 10Meg (tongue in cheek!) in size compared to a textmode version that's only 2K ;) :lol:

use strip to get rid of the symbols (or compiler options dialog, unclick all the debug info)

But leave it in while looking for a bug

Show quoted text 12 lines
> 2) You say you do not know the exact error: " because the popup box > doesn't state it" => Try running the exe in the debugger, make sure you > compile with debug symbols for gdb (-g, maybe also -gl). > i've not changed any settings from the defaults on install... i have, a few times, run some stuff directly from the GUI in the debugger but even with 256Meg of RAM in this box, it gets a bit on the tight side at times which is why i switched over to simply building the apps and then shutting down laz and running the built code outside on its own... maybe that wasn't/isn't such a good idea?

why not, but it doesn't help debugging (unless you do gdb by hand)

Reply by email

Martin Friebe
to waldo kitty: just following up on this (as my other reply hasn't srrived back from the list yet) but i…
waldo kitty wrote 19 lines
Martin Friebe wrote: > 2) You say you do not know the exact error: " because the popup box > doesn't state it" => Try running the exe in the debugger, make sure you > compile with debug symbols for gdb (-g, maybe also -gl). > just following up on this (as my other reply hasn't srrived back from the list yet) but i have just attempted to, with laz 0.9.27 fpc 2.2.3, run my app from the laz gui via F9... i got a box stating Project raised exception class 'External SIGSEGV' at which point i could only click on the [OK] button in that box... then it appeared that my box was locked up but it took a minute or so and another box appeared titled "Assembly" with what appeared to be a list of addresses but i farkled things up by attempting to scroll the box to see what may have been listed and i lost the starting point that it gave me...

Yes the assembly window, ignore that (and yes if you close it to early, it does mind that sometimes)

Open view->debug->stack window (alt-ctrl-s)
That will show you where in the Lazarus code the exception happened. Problem: Likely it is in the fpc part, which will be useless numbers. Or even in the mysql library.

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.
If you get the stack backtrace you can mail it and hope some one knows about...
.

Reply by email

Bart
to waldo kitty: :) i can appreciate that ;) i'm using whatever comes with lazarus... i started with laz…
waldo kitty wrote
and that might be another "bug" or something where one can't install laz 0.9.26 to one directory and 0.9.27 to another and have each come out of the box without sharing any config settings or something...

It can be done. Just start lazarus with --pcp="path where you want lazarus to save settings"
I have 0.9.26 and an SVN version up and running on Windows with that --pcp thing.

AFAIK before 0.9.27 settings were saved in Lazarus directory, after that in users config directory, which I guess is supplied by OS (on Windows with GetSpecialFolder (?)).

Bart

Reply by email

waldo kitty
to Martin Friebe: Yes the assembly window, ignore that (and yes if you close it to early, it does mind that…
Martin Friebe wrote
Open view->debug->stack window (alt-ctrl-s) That will show you where in the Lazarus code the exception happened. Problem: Likely it is in the fpc part, which will be useless numbers. Or even in the mysql library.

ahhh... that's more than i've seen before...

i opened the stack window after my app started and it was just sitting there... then i clicked on the [connect] button which does the database connection, data retrieval and connection.close... here's what i got...

#0 KERNEL32!GetComputerNameW at :0
#1 KERNEL32!GetPrivateProfileStructA at :0
#2 ?? at :0
#3 ?? at :0

isn't that nice... no filenames listed :?

i get the same if i build it as a win32 GUI app (-WG)...

i'm not sure what debugging options i should turn on on the compiler options -> linking tab... the default was only display line numbers in RT error backtraces... since our previous discussion, i've also turned on generate debug into for gdb (-g) but nothing else...

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.

yeah, it does seem that way but someone's gotta do it... i mean, damn... the code is used in the wiki as workable demo apps and it doesn't work as posted... that's not saying that the demo code posted is broken but that the components used in the demo code have some sort of problem somewhere... so, its gotta be fixed...

If you get the stack backtrace you can mail it and hope some one knows about...

hummm... dunno anything about how to do that... this is all so very very different than the TP6/BP6 and TP7/BP7 IDE style... not only am i stuck trying to learn the new environment but also the new coding techniques and now the new debugging stuffs... i ain't as young as i used to be... i definitely can't sit and beat my head on this stuff for 48+ hours at a stretch like i used to do back in my 20's and earlier :?

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/19/09 10:41:01 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

waldo kitty
to Martin Friebe: Yes the assembly window, ignore that (and yes if you close it to early, it does mind that…
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 :(

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 :?

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 :(

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

Reply by email

Joost van der Sluis
to waldo kitty: i've finally been able to work out the following... MySQLConnection: TMySQL50Connection;…

Op maandag 19-01-2009 om 18:29 uur [tijdzone -0500], schreef waldo kitty:

Show quoted text 21 lines
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 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...

Show quoted text 6 lines
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.

Reply by email

waldo kitty
to Joost van der Sluis
Joost van der Sluis wrote 10 lines
Op maandag 19-01-2009 om 18:29 uur [tijdzone -0500], schreef waldo kitty: > 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.

hummm... ok...

Show quoted text 8 lines
> 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 in the same file. It first closes all queries which are linked to this dataset, and thereafter it closes all transactions.

ok... well, the query is closed by my code after the variables are loaded with the data... then we attempt to close the connection via a routine that all will use to close the connection... this routine does two things...

    transaction.active := false;
    connection.close;

is it enough to set transaction.active:=false? i note there's no transaction.close... in any case, the error pops up when the connection.close is called... so, i'd say that, yes, i've closed the query and the transaction before attempting to close the connection...

also, could it be that because i'm not using a datasource that is causing the problem?

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

by the above, i am, aren't i?... in fact, here's code...

     MySQLConnection: TMySQL50Connection;
     CompanyDataSQLQuery: TSQLQuery;
     SQLTransaction: TSQLTransaction;

the CompanyEdit_co_* fields are all TEdits...

procedure TkimsForm.LoadCompanyData(Sender: TObject);
begin
   if MySQLConnection.Connected then begin
     ShowStatus('Connected #1');
     CloseConnection(Sender);
   end;
   if not MySQLConnection.Connected then ShowStatus('NOT Connected #1');
   MySQLConnection.DatabaseName := 'foo';
   MySQLConnection.HostName := 'bar';
   MySQLConnection.Password := 'fubar';
   MySQLConnection.UserName := 'snafu';
   ShowStatus('Connecting to database ' + MySQLConnection.DatabaseName + '...');
   MySQLConnection.Open;
   // If we're connected, retrieve our company info
   if MySQLConnection.Connected then begin
     ShowStatus('Connected');
     ShowStatus('Opening query...');
     CompanyDataSQLQuery.Open;
     if CompanyDataSQLQuery.Active then begin
       CompanyDataSQLQuery.First;
       ShowStatus('Query ACTIVE and at first record...');
       while not CompanyDataSQLQuery.EOF do begin
         ShowStatus('Loading data from row...');
         CompanyEdit_co_name.text :=
CompanyDataSQLQuery.FieldByName('co_name').AsString;
         CompanyEdit_co_address1.text :=
CompanyDataSQLQuery.FieldByName('co_address1').AsString;
         CompanyEdit_co_address2.text :=
CompanyDataSQLQuery.FieldByName('co_address2').AsString;
         CompanyEdit_co_city.text :=
CompanyDataSQLQuery.FieldByName('co_city').AsString;
         CompanyEdit_co_state.text :=
CompanyDataSQLQuery.FieldByName('co_state').AsString;
         CompanyEdit_co_postal.text :=
CompanyDataSQLQuery.FieldByName('co_postal').AsString;
         CompanyEdit_co_phone.text :=
CompanyDataSQLQuery.FieldByName('co_phone').AsString;
         CompanyEdit_co_fax.text :=
CompanyDataSQLQuery.FieldByName('co_fax').AsString;
         CompanyEdit_co_contact.text :=
CompanyDataSQLQuery.FieldByName('co_contact').AsString;
         CompanyEdit_co_taxpercent.text :=
CompanyDataSQLQuery.FieldByName('co_taxpercent').AsString;
         CompanyEdit_co_commission_rate1.text :=
CompanyDataSQLQuery.FieldByName('co_commission_rate1').AsString;
         CompanyEdit_co_commission_rate2.text :=
CompanyDataSQLQuery.FieldByName('co_commission_rate2').AsString;
         CompanyEdit_co_commission_percent1.text :=
CompanyDataSQLQuery.FieldByName('co_commission_percent1').AsString;
         CompanyEdit_co_commission_percent2.text :=
CompanyDataSQLQuery.FieldByName('co_commission_percent2').AsString;
         CompanyDataSQLQuery.Next;
       end;
       ShowStatus('Closing query...');
       CompanyDataSQLQuery.Close;
     end;
     if not CompanyDataSQLQuery.Active then
       ShowStatus('Query NOT ACTIVE');
   end;
   if MySQLConnection.Connected then begin
     ShowStatus('Connected #2');
     CloseConnection(Sender);
   end;
   if not MySQLConnection.Connected then ShowStatus('NOT Connected #2');
end;
procedure TkimsForm.CloseConnection(Sender: TObject);
begin
   // The SQLTransaction gets activated automatically, but before we can close
   // the connection we have to set the SQLTransaction.Active to false.
   if SQLTransaction.Active then begin
     ShowStatus('Deactivating SQLTransaction...');
     SQLTransaction.Active := False;
     SQLTransaction.
   end;
   if not SQLTransaction.Active then ShowStatus('SQLTransaction NOT Active.')
   else ShowStatus('SQLTransaction Active.');
//  MySQLConnection.CloseTransactions;
//  MySQLConnection.CloseDataSets;
//  MySQLConnection.Connected:=False;
   if MySQLConnection.Connected then begin
     ShowStatus('Closing MySQLConnection...');
     MySQLConnection.Close;     // <-- error occurs here on first execution
// when error occurs, we do not get to the following lines... ignore the
// error and run LoadCompanyData a second time and the error does not show
// and we DO get to the following with the "MySQLConnection Closed" result...
   end;
   if not MySQLConnection.Connected then ShowStatus('MySQLConnection Closed.')
   else ShowStatus('MySQLConnection NOT Closed!');
end;
procedure TkimsForm.ShowStatus(const S: String);
begin
   Memo1.Lines.Add(TimeToStr(now) + ': ' + S);
   StatusBar.SimpleText := S;
end;

so, if i'm understanding what you're saying, i should try to use the commented

//  MySQLConnection.CloseTransactions;
//  MySQLConnection.CloseDataSets;
//  MySQLConnection.Connected:=False;

lines instead of the single MySQLConnection.Close option?

Show quoted text 13 lines
> 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...

run it from gdb?? don't know if i know how other than F9 from the GUI... i don't know that i've seen a gdb command line option in the View menu where i might be able to type 'bt' but i'll take another look...

i'll definitely take a look at adding those paths for the step option... that was one of my tricks along with the watch window back in my heavy coding days of TP/BP stuff :)

BTW: thanks for popping in on this... i was hoping that you would based on seeing other database related messages from you and also seeing your name in a bunch of the db related sources ;)

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 15:29:04 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

waldo kitty
to waldo kitty
waldo kitty wrote 9 lines
procedure TkimsForm.CloseConnection(Sender: TObject); begin // The SQLTransaction gets activated automatically, but before we can close // the connection we have to set the SQLTransaction.Active to false. if SQLTransaction.Active then begin ShowStatus('Deactivating SQLTransaction...'); SQLTransaction.Active := False; SQLTransaction. end;

whoops... the "SQLTransaction." line is not supposed to be there... i had placed it while looking to see if there was a SQLTransaction.Close option and forgot to remove it before copy'n'paste to the message :?

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 15:42:58 avast! - copyright (c) 1988-2009 ALWIL Software. http://www.avast.com

Reply by email

waldo kitty
to Mattias Gärtner: An embedded and charset-unspecified text was scrubbed... Name: not available Url:…
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

Reply by email