At 11:33 -0500 11/13/05, Bruce Martin wrote:
Ok I have an update. I fixed my problem by passing a NULL parameter to mysql_init() to do this I did this:

MYSQL *m;
m=mysql_init(NULL);
connection=mysql_real_connect(m,cStrdbServer,cStrdbUser,cStrdbUserPass,cStrdbName,0,NULL,0);

Which solves the mystery.  When you passed m, it was not initialized
and pointed to random memory.  mysql_init() was the non-NULL value
and took it to be the address of a struct to initialize, and initialized
it.  That stomped all over whatever m happened to be pointing to - in
this case your int.


On Nov 12, 2005, at 7:44 PM, Bruce Martin wrote:

Hello all,
I found this odd thing when writing a client in C to connect to a mysql database server. I want to use mysql_real_query so I need the strlen() of the sqlStatement. So prior to calling mysql_init(&m) I get the length of the sqlStatement. I check that length and it is correct after I first set it up the length is 23 which is correct. I then call mysql_init(&m), then I check the length again, well the value of the int I set earlier, and it is 0.

What's the deal? why would mysql_init() change the value of my int?

Bruce Martin
The Martin Solution
PO Box 644
Delaware Water Gap, PA
(570) 421-0670
[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Bruce Martin
The Martin Solution
PO Box 644
Delaware Water Gap, PA
(570) 421-0670
[EMAIL PROTECTED]


--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to