diff --git a/src/engine/server/databases/connection.cpp b/src/engine/server/databases/connection.cpp index ac124baa4..58dd5778e 100644 --- a/src/engine/server/databases/connection.cpp +++ b/src/engine/server/databases/connection.cpp @@ -1,7 +1,5 @@ #include "connection.h" -#include - IDbConnection::IDbConnection(const char *pPrefix) { str_copy(m_aPrefix, pPrefix); @@ -30,7 +28,7 @@ void IDbConnection::FormatCreateRace(char *aBuf, unsigned int BufferSize, bool B " PRIMARY KEY (Map, Name, Time, Timestamp, Server)" ")", GetPrefix(), Backup ? "_backup" : "", - BinaryCollate(), MAX_NAME_LENGTH, BinaryCollate()); + BinaryCollate(), MAX_NAME_LENGTH_SQL, BinaryCollate()); } void IDbConnection::FormatCreateTeamrace(char *aBuf, unsigned int BufferSize, const char *pIdType, bool Backup) const @@ -47,7 +45,7 @@ void IDbConnection::FormatCreateTeamrace(char *aBuf, unsigned int BufferSize, co " PRIMARY KEY (ID, Name)" ")", GetPrefix(), Backup ? "_backup" : "", - BinaryCollate(), MAX_NAME_LENGTH, BinaryCollate(), pIdType); + BinaryCollate(), MAX_NAME_LENGTH_SQL, BinaryCollate(), pIdType); } void IDbConnection::FormatCreateMaps(char *aBuf, unsigned int BufferSize) const @@ -90,5 +88,5 @@ void IDbConnection::FormatCreatePoints(char *aBuf, unsigned int BufferSize) cons " Points INT DEFAULT 0, " " PRIMARY KEY (Name)" ")", - GetPrefix(), MAX_NAME_LENGTH, BinaryCollate()); + GetPrefix(), MAX_NAME_LENGTH_SQL, BinaryCollate()); } diff --git a/src/engine/server/databases/connection.h b/src/engine/server/databases/connection.h index a2da8e0da..03ac5be42 100644 --- a/src/engine/server/databases/connection.h +++ b/src/engine/server/databases/connection.h @@ -3,8 +3,15 @@ #include "connection_pool.h" +#include #include +enum +{ + // MAX_NAME_LENGTH includes the size with \0, which is not necessary in SQL + MAX_NAME_LENGTH_SQL = MAX_NAME_LENGTH - 1, +}; + class IConsole; // can hold one PreparedStatement with Results