diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-08-26 17:00:26 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2015-09-27 16:28:04 +0200 |
commit | d2076ef8b09f6a59aaa634cc754b805d637ffc8a (patch) | |
tree | c90572c2f14cf9a50e08e271dfdf4a12faefd335 /src/server/database/Database/QueryResult.h | |
parent | 0d0c2e1ca648461bb803f9feb42d9a5aa30a7ef0 (diff) |
Core/DBLayer: Optimized prepared statement query results by eliminating unneeded buffer copies
* Improved error logs for using incorrect Field getters to also include table name, field name and field index.
(cherry picked from commit 65dbc7082a60b67b76966259130aedc337af3eca)
Conflicts:
src/server/database/Database/Field.h
src/server/game/Globals/ObjectMgr.cpp
Diffstat (limited to 'src/server/database/Database/QueryResult.h')
-rw-r--r-- | src/server/database/Database/QueryResult.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/server/database/Database/QueryResult.h b/src/server/database/Database/QueryResult.h index a61fb6331c1..0447ecaae5a 100644 --- a/src/server/database/Database/QueryResult.h +++ b/src/server/database/Database/QueryResult.h @@ -73,18 +73,18 @@ class PreparedResultSet Field* Fetch() const { ASSERT(m_rowPosition < m_rowCount); - return m_rows[uint32(m_rowPosition)]; + return const_cast<Field*>(&m_rows[uint32(m_rowPosition) * m_fieldCount]); } - const Field & operator [] (uint32 index) const + Field const& operator[](uint32 index) const { ASSERT(m_rowPosition < m_rowCount); ASSERT(index < m_fieldCount); - return m_rows[uint32(m_rowPosition)][index]; + return m_rows[uint32(m_rowPosition) * m_fieldCount + index]; } protected: - std::vector<Field*> m_rows; + std::vector<Field> m_rows; uint64 m_rowCount; uint64 m_rowPosition; uint32 m_fieldCount; @@ -92,12 +92,11 @@ class PreparedResultSet private: MYSQL_BIND* m_rBind; MYSQL_STMT* m_stmt; - MYSQL_RES* m_res; + MYSQL_RES* m_metadataResult; ///< Field metadata, returned by mysql_stmt_result_metadata my_bool* m_isNull; unsigned long* m_length; - void FreeBindBuffer(); void CleanUp(); bool _NextRow(); |