Sign in to follow this  

Odd MySQL bug...(probably needs SQL guru)

This topic is 4752 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I've been working on an MMORPG for many months now. Recently we've upgraded from MySQL 3.x to 4.x in the server, which is written in C++. Since then we've had a problem with MySQL, the problem is that in the following function pFields[i] is incomplete for some strange reason. pFields->Name contains a bad pointer, as do many other members of the struct. As a matter of fact the struct is almost completely trashed...Even though the query is valid and mysql_num_fields returns a good return value. line that says: Fields.push_back( (string)pFields[i].name ); in: CRecordset CMySQLDatabase::Query(const string &SQL, bool bLog) { DEF_FUNC("Query"); CRecordset rs; MYSQL_RES *pResult; MYSQL_FIELD *pFields; MYSQL_ROW row; unsigned int myErr; unsigned long i, j, rowCount, fieldCount; vector<string> Fields; map<string, string> fieldEntry; if (bLog) TLOG(LOG_DEBUG, SQL); if ( mysql_real_query(&m_Conn, SQL.c_str(), (unsigned int)SQL.length()) == 0 ) { pResult = mysql_store_result(&m_Conn); if (pResult != NULL) { rowCount = (unsigned long)mysql_num_rows(pResult); fieldCount = (unsigned long)mysql_num_fields(pResult); if (fieldCount) { pFields = mysql_fetch_fields(pResult); if (pFields != NULL) { for (i = 0; i < fieldCount; i++) Fields.push_back( (string)pFields[i].name ); } } ...

Share this post


Link to post
Share on other sites

This topic is 4752 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this