be sure to get the actual size of the query.

This commit is contained in:
Arthur Ice 2013-05-26 20:32:54 -07:00
parent a372ba3d39
commit 2631861370
2 changed files with 2 additions and 1 deletions

View File

@ -74,7 +74,7 @@ bool DBcore::RunQuery(const std::string query, char* errbuf, MYSQL_RES** result,
strn0cpy(tmp, query.c_str(), sizeof(tmp));
std::cout << "QUERY: " << tmp << std::endl;
#endif
if (mysql_real_query(&mysql, query.c_str(), query.length())) {
if (mysql_real_query(&mysql, query.c_str(), strlen(query.c_str()))) {
if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
pStatus = Error;
if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) {

View File

@ -1603,6 +1603,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe
StringFormat(query,"SELECT `spellid`, `type` from `damageshieldtypes` "
"WHERE `spellid` > 0 AND `spellid` <= %i", iMaxSpellID);
if(RunQuery(query,errbuf,&result)) {
while((row = mysql_fetch_row(result))) {