Lazarus

Programming => Databases => Topic started by: thaimann on December 01, 2007, 07:14:34 pm

Title: Accessing a mysql ver 5 server (Text Mode)
Post by: thaimann on December 01, 2007, 07:14:34 pm
I am trying to access a mysql 5 database and am getting the following error on the

mysql_init(PMySQL(@qmysql));

An unhandled exception occurred at $08048538 :
EInOutError : File not open
  $08048538
Title: RE: Accessing a mysql ver 5 server (Text Mode)
Post by: Marc on December 03, 2007, 11:16:00 am
this is a little context :( however I guess you're using windows. Then the file not open might be caused by some writeln.
Try to compile your app with the -WC option
Title: Accessing a mysql ver 5 server (Text Mode)
Post by: thaimann on December 04, 2007, 03:57:03 am
For your information I am running FC7.  I have now done a little more research.

The "mysql_init(PMySQL(@qmysql));" statement appears to be writing beyond the structure size of Mysql_res, about 860 bytes beyond I would say.  Possibly even further.

How do I know this?  Well, I put an array right behind qmysql of 1000 integers and right before executing the mysql_init, I filled it up with integers (1 - 999) and then right after executing the mysql_init I printed them.  The array appeared to be clobbered up until 429th integer.  My program is still behaving kind of oddly though and something may still be getting clobbered further down in the memory.

Terry
Title: Accessing a mysql ver 5 server (Text Mode)
Post by: Marc on December 04, 2007, 10:27:38 am
what is the size of Mysql_res, and how is the mysql_init declared (and if you have it, the C version too)
Title: Accessing a mysql ver 5 server (Text Mode)
Post by: thaimann on December 08, 2007, 01:26:59 am
It turns out that qmysql should have been defined as just type mysql instead of mysql_res.  Previous posts I had seen said that text based programs were not possible with Mysql Ver. 5, so I had looked up info on the c api and took some wild shots in the dark.  In some ways I am surprised I got as far as I did.

I have a larger text program that is now accessing mysql fine, but the toy program still acts bizare.  It is getting at the data though.

I am still not able to access mysql with the mysql components, I haven't given zeos a try yet though.
Title: Accessing a mysql ver 5 server (Text Mode)
Post by: piper62 on December 13, 2007, 11:14:48 pm
I can recommend ZeosLib.


Regards,
Tibor
TinyPortal © 2005-2018