mysql_real_connect() crash, null pointer suspected
Posted by:
Damien
Date: August 08, 2005 04:16AM
Hi
I have crash issues with mysql_real_connect() which makes my plugin (for a game) crashes.
Here is a part of my code :
--8<----8<----8<----8<----8<----8<----8<----8<----8<--
Msg(" mysql_init(conn)\n");
if(mysql_init(conn)==NULL)
{
Warning("MySQL Init Error. MySQL is not aviliable\n");
}
else
{
Msg("mysql_real_connect(conn,'%s','%s','%s','%s',0,NULL,0)\n",db_host,db_user,db_pass,db_base);
if(!mysql_real_connect(conn,db_host,db_user,db_pass,db_base,0,NULL,0))
{
Warning("Failed to connect to database: Error: %s\n",mysql_error(conn));
cv_my_connected.SetValue(0);
}
else
{
Msg("Mysql Connection OK\n");
cv_my_connected.SetValue(1);
Msg("Mysql Connection OK\n");
m_connected=true;
}
}
--8<----8<----8<----8<----8<----8<----8<----8<----8<--
The Msg() and Warning() functions print out text like printf.
db_host, db_user, db_pass and db_base are my class vars containing the necessary objects to connect.
When calling this code, I see the message "mysql_real_connect..." and it crashes while in the mysql_real_connect() function since I don't see any of the following messages.