Jump to content
  • Advertisement
Sign in to follow this  
eek2121

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

This topic is 5059 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 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.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.name ); } } ...

Share this post


Link to post
Share on other sites
Advertisement
Did you remove all the version 3 libraries when you upgraded? Did you remove all version 3 headers? Did you remove all .o files from the server build, and do a clean build?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!