Core/DBLayer: Convert another Execute() query to a prepared statement
This commit is contained in:
@@ -19114,13 +19114,17 @@ void Player::SendAttackSwingNotInRange()
|
||||
|
||||
void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss << "UPDATE characters SET position_x='" << x << "', position_y='" << y
|
||||
<< "', position_z='" << z << "', orientation='" << o << "', map='" << mapid
|
||||
<< "', zone='" << zone << "', trans_x='0', trans_y='0', trans_z='0', "
|
||||
<< "transguid='0', taxi_path='' WHERE guid='" << GUID_LOPART(guid) << '\'';
|
||||
sLog->outDebug(LOG_FILTER_UNITS, "%s", ss.str().c_str());
|
||||
CharacterDatabase.Execute(ss.str().c_str());
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_POSITION);
|
||||
|
||||
stmt->setFloat(0, x);
|
||||
stmt->setFloat(1, y);
|
||||
stmt->setFloat(2, z);
|
||||
stmt->setFloat(3, o);
|
||||
stmt->setUInt16(4, uint16(mapid));
|
||||
stmt->setUInt16(5, uint16(zone));
|
||||
stmt->setUInt32(6, GUID_LOPART(guid));
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void Player::SetUInt32ValueInArray(Tokens& tokens, uint16 index, uint32 value)
|
||||
|
||||
@@ -381,5 +381,6 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PREPARE_STATEMENT(CHAR_INS_CHARACTER_SOCIAL, "INSERT INTO character_social (guid, friend, flags) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||
PREPARE_STATEMENT(CHAR_DEL_CHARACTER_SOCIAL, "DELETE FROM character_social WHERE guid = ? AND friend = ?", CONNECTION_ASYNC);
|
||||
PREPARE_STATEMENT(CHAR_UPD_CHARACTER_SOCIAL_NOTE, "UPDATE character_social SET note = ? WHERE guid = ? AND friend = ?", CONNECTION_ASYNC);
|
||||
PREPARE_STATEMENT(CHAR_UPD_CHARACTER_POSITION, "UPDATE characters SET position_x = ?, position_y = ?, position_z = ?, orientation = ?, map = ?, zone = ?, trans_x = 0, trans_y = 0, trans_z = 0, transguid = 0, taxi_path = '' WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
}
|
||||
|
||||
@@ -343,6 +343,7 @@ enum CharacterDatabaseStatements
|
||||
CHAR_INS_CHARACTER_SOCIAL,
|
||||
CHAR_DEL_CHARACTER_SOCIAL,
|
||||
CHAR_UPD_CHARACTER_SOCIAL_NOTE,
|
||||
CHAR_UPD_CHARACTER_POSITION,
|
||||
|
||||
MAX_CHARACTERDATABASE_STATEMENTS,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user