aboutsummaryrefslogtreecommitdiff
path: root/src/server/database/Database/QueryResult.h
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-08-26 17:00:26 +0200
committerShauren <shauren.trinity@gmail.com>2015-08-26 17:00:26 +0200
commit65dbc7082a60b67b76966259130aedc337af3eca (patch)
tree9872befdeb95c44b58591c3a2f6506e7ff0d7d74 /src/server/database/Database/QueryResult.h
parent614b5832ba96b4c5905ece5490a7b5d18c2f710b (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.
Diffstat (limited to 'src/server/database/Database/QueryResult.h')
-rw-r--r--src/server/database/Database/QueryResult.h11
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();