Created
September 19, 2011 00:23
-
-
Save cenfa/1225753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/shared/Database/DatabaseMysql.cpp b/src/shared/Database/DatabaseMysql.cpp | |
index 13b77bf..bf52639 100644 | |
--- a/src/shared/Database/DatabaseMysql.cpp | |
+++ b/src/shared/Database/DatabaseMysql.cpp | |
@@ -505,9 +505,10 @@ enum_field_types MySqlPreparedStatement::ToMySQLType( const SqlStmtFieldData &da | |
switch (data.type()) | |
{ | |
case FIELD_NONE: dataType = MYSQL_TYPE_NULL; break; | |
- case FIELD_BOOL: dataType = MYSQL_TYPE_BIT; bUnsigned = 1; break; | |
- case FIELD_I8: dataType = MYSQL_TYPE_TINY; break; | |
+ // MySQL does not support MYSQL_TYPE_BIT as input type | |
+ case FIELD_BOOL: //dataType = MYSQL_TYPE_BIT; bUnsigned = 1; break; | |
case FIELD_UI8: dataType = MYSQL_TYPE_TINY; bUnsigned = 1; break; | |
+ case FIELD_I8: dataType = MYSQL_TYPE_TINY; break; | |
case FIELD_I16: dataType = MYSQL_TYPE_SHORT; break; | |
case FIELD_UI16: dataType = MYSQL_TYPE_SHORT; bUnsigned = 1; break; | |
case FIELD_I32: dataType = MYSQL_TYPE_LONG; break; | |
diff --git a/src/shared/Database/SqlPreparedStatement.h b/src/shared/Database/SqlPreparedStatement.h | |
index e32988c..9a0789a 100644 | |
--- a/src/shared/Database/SqlPreparedStatement.h | |
+++ b/src/shared/Database/SqlPreparedStatement.h | |
@@ -75,7 +75,7 @@ class MANGOS_DLL_SPEC SqlStmtFieldData | |
void set(T1 param1); | |
//getters | |
- bool toBool() const { MANGOS_ASSERT(m_type == FIELD_BOOL); return m_binaryData.boolean; } | |
+ bool toBool() const { MANGOS_ASSERT(m_type == FIELD_BOOL); return static_cast<bool>(m_binaryData.ui8); } | |
uint8 toUint8() const { MANGOS_ASSERT(m_type == FIELD_UI8); return m_binaryData.ui8; } | |
int8 toInt8() const { MANGOS_ASSERT(m_type == FIELD_I8); return m_binaryData.i8; } | |
uint16 toUint16() const { MANGOS_ASSERT(m_type == FIELD_UI16); return m_binaryData.ui16; } | |
@@ -99,7 +99,7 @@ class MANGOS_DLL_SPEC SqlStmtFieldData | |
switch (m_type) | |
{ | |
case FIELD_NONE: return 0; | |
- case FIELD_BOOL: return sizeof(bool); | |
+ case FIELD_BOOL: //return sizeof(bool); | |
case FIELD_UI8: return sizeof(uint8); | |
case FIELD_UI16: return sizeof(uint16); | |
case FIELD_UI32: return sizeof(uint32); | |
@@ -124,7 +124,7 @@ class MANGOS_DLL_SPEC SqlStmtFieldData | |
}; | |
//template specialization | |
-template<> inline void SqlStmtFieldData::set(bool val) { m_type = FIELD_BOOL; m_binaryData.boolean = val; } | |
+template<> inline void SqlStmtFieldData::set(bool val) { m_type = FIELD_BOOL; m_binaryData.ui8 = val; } | |
template<> inline void SqlStmtFieldData::set(uint8 val) { m_type = FIELD_UI8; m_binaryData.ui8 = val; } | |
template<> inline void SqlStmtFieldData::set(int8 val) { m_type = FIELD_I8; m_binaryData.i8 = val; } | |
template<> inline void SqlStmtFieldData::set(uint16 val) { m_type = FIELD_UI16; m_binaryData.ui16 = val; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment