Core/Mysql: Multiple changes

- added support for setting NULL column values to MySQL wrapper in core
- replaced nonstandard strdup function and manual memory management with std::string
- fixed bug in MySQLPreparedStatement::getQueryString method, it failed when string parameter contained embedded '?' symbols
- fixed memory leak in MySQLPreparedStatement::setString method
This commit is contained in:
Spp committed 2013-01-02 12:22:50 +01:00
1 parent 5280a77fe1
commit ebd14b4f01
12 files changed
+736 -671

No files matched your search

@@ -55,7 +55,8 @@ enum PreparedStatementValueType
TYPE_I64,
TYPE_FLOAT,
TYPE_DOUBLE,
TYPE_STRING
TYPE_STRING,
TYPE_NULL
};
struct PreparedStatementData
@@ -91,6 +92,7 @@ class PreparedStatement
void setFloat(const uint8 index, const float value);
void setDouble(const uint8 index, const double value);
void setString(const uint8 index, const std::string& value);
void setNull(const uint8 index);
protected:
void BindParameters();
@@ -125,6 +127,7 @@ class MySQLPreparedStatement
void setFloat(const uint8 index, const float value);
void setDouble(const uint8 index, const double value);
void setString(const uint8 index, const char* value);
void setNull(const uint8 index);
protected:
MYSQL_STMT* GetSTMT() { return m_Mstmt; }
@@ -132,7 +135,7 @@ class MySQLPreparedStatement
PreparedStatement* m_stmt;
void ClearParameters();
bool CheckValidIndex(uint8 index);
std::string getQueryString(const char *query);
std::string getQueryString(std::string const &sqlPattern) const;
private:
void setValue(MYSQL_BIND* param, enum_field_types type, const void* value, uint32 len, bool isUnsigned);