From 503b61c3dfc8925c81a5dd1da4af79a8bd159ab0 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Wed, 18 Aug 2021 21:36:59 +0300 Subject: [PATCH] Allow unoptimized to use formatting without errors. --- module/Library/MMDB.cpp | 26 ++++++++++++------------ module/Library/MySQL.cpp | 34 +++++++++++++++---------------- module/Library/MySQL.hpp | 2 +- module/Library/SQLite.cpp | 42 +++++++++++++++++++-------------------- 4 files changed, 52 insertions(+), 52 deletions(-) diff --git a/module/Library/MMDB.cpp b/module/Library/MMDB.cpp index 88978fe8..c4518b2e 100644 --- a/module/Library/MMDB.cpp +++ b/module/Library/MMDB.cpp @@ -444,7 +444,7 @@ void SockAddr::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid sockaddr structure handle =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid sockaddr structure handle =>[{}:{}]"), file, line); } } #else @@ -551,7 +551,7 @@ void Database::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else @@ -687,7 +687,7 @@ void Description::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else @@ -708,7 +708,7 @@ Description::Pointer Description::GetValid(const SQChar * file, int32_t line) co // Validate the referenced description if (!m_Description) { - SqThrowF("Invalid Maxmind meta-data description reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind meta-data description reference =>[{}:{}]"), file, line); } // Return the description pointer return m_Description; @@ -747,7 +747,7 @@ void EntryData::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else @@ -768,7 +768,7 @@ EntryData::ConstRef EntryData::GetValid(const SQChar * file, int32_t line) const // See if the entry has any data if (!m_Entry.has_data) { - SqThrowF("The referenced entry has no data =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("The referenced entry has no data =>[{}:{}]"), file, line); } // Return the entry return m_Entry; @@ -821,7 +821,7 @@ void EntryDataList::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else @@ -842,7 +842,7 @@ EntryDataList::Pointer EntryDataList::GetValid(const SQChar * file, int32_t line // Validate the managed list if (!m_List) { - SqThrowF("Invalid Maxmind entry data list reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind entry data list reference =>[{}:{}]"), file, line); } // return the list return m_List; @@ -869,7 +869,7 @@ EntryDataList::Pointer EntryDataList::GetValidElem(const SQChar * file, int32_t // Validate the current element if (!m_List) { - SqThrowF("Invalid Maxmind entry data element reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind entry data element reference =>[{}:{}]"), file, line); } // return the element return m_Elem; @@ -979,7 +979,7 @@ void LookupResult::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else @@ -1139,7 +1139,7 @@ void Metadata::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else @@ -1160,7 +1160,7 @@ Metadata::Pointer Metadata::GetValid(const SQChar * file, int32_t line) const // Validate the referenced meta-data if (!m_Metadata) { - SqThrowF("Invalid Maxmind meta-data reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind meta-data reference =>[{}:{}]"), file, line); } // Return the meta-data pointer return m_Metadata; @@ -1211,7 +1211,7 @@ void SearchNode::Validate(const SQChar * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line); } } #else diff --git a/module/Library/MySQL.cpp b/module/Library/MySQL.cpp index 8c8e5ab9..abc1ae21 100644 --- a/module/Library/MySQL.cpp +++ b/module/Library/MySQL.cpp @@ -1623,7 +1623,7 @@ void Connection::Validate(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid MySQL connection reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL connection reference =>[{}:{}]"), file, line); } } #else @@ -1642,11 +1642,11 @@ void Connection::ValidateCreated(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid MySQL connection reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL connection reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid MySQL connection =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL connection =>[{}:{}]"), file, line); } } #else @@ -1962,12 +1962,12 @@ void Field::Validate(const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } // Are we pointing to a valid index? else if (m_Index >= m_Handle->mFieldCount) { - SqThrowF("Field index is out of range: {} >= {} =>[{}:{}]", m_Index, m_Handle->mFieldCount, file, line); + SqThrowF(SQMOD_RTFMT("Field index is out of range: {} >= {} =>[{}:{}]"), m_Index, m_Handle->mFieldCount, file, line); } } #else @@ -1993,7 +1993,7 @@ void Field::ValidateCreated(const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } // Are we pointing to a valid index? m_Handle->ValidateField(m_Index, file, line); @@ -2018,12 +2018,12 @@ void Field::ValidateStepped(const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } // Do we have a valid row available? else if (m_Handle->mRow == nullptr) { - SqThrowF("No row available in MySQL result-set =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("No row available in MySQL result-set =>[{}:{}]"), file, line); } // Are we pointing to a valid index? m_Handle->ValidateField(m_Index, file, line); @@ -2098,7 +2098,7 @@ void Field::ValidateField(uint32_t idx, const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } // Validate the specified field index m_Handle->ValidateField(idx, file, line); @@ -2471,7 +2471,7 @@ void ResultSet::Validate(const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } } #else @@ -2492,11 +2492,11 @@ void ResultSet::ValidateCreated(const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid MySQL result-set =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set =>[{}:{}]"), file, line); } } #else @@ -2521,12 +2521,12 @@ void ResultSet::ValidateStepped(const char * file, int32_t line) const // Do we have a valid result-set handle? if (!m_Handle) { - SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line); } // Do we have a valid row available? else if (m_Handle->mRow == nullptr) { - SqThrowF("No row available in MySQL result-set =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("No row available in MySQL result-set =>[{}:{}]"), file, line); } } #else @@ -2753,7 +2753,7 @@ void Statement::Validate(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid MySQL statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL statement reference =>[{}:{}]"), file, line); } } #else @@ -2772,11 +2772,11 @@ void Statement::ValidateCreated(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid MySQL statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL statement reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid MySQL statement =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid MySQL statement =>[{}:{}]"), file, line); } } #else diff --git a/module/Library/MySQL.hpp b/module/Library/MySQL.hpp index 88ffb8ba..f585f41d 100644 --- a/module/Library/MySQL.hpp +++ b/module/Library/MySQL.hpp @@ -650,7 +650,7 @@ public: * Grab the current error in the associated statement or connection handle and throw it. */ #if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC) - void ThrowCurrent(const char * act, const char * file, int32_t line); + void ThrowCurrent(const char * act, const char * file, int32_t line) const; #else void ThrowCurrent(const char * act) const; #endif // _DEBUG diff --git a/module/Library/SQLite.cpp b/module/Library/SQLite.cpp index 45fc862a..c1f56a1c 100644 --- a/module/Library/SQLite.cpp +++ b/module/Library/SQLite.cpp @@ -895,7 +895,7 @@ void SQLiteConnection::Validate(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid SQLite connection reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite connection reference =>[{}:{}]"), file, line); } } #else @@ -914,11 +914,11 @@ void SQLiteConnection::ValidateCreated(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid SQLite connection reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite connection reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite connection =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite connection =>[{}:{}]"), file, line); } } #else @@ -1227,12 +1227,12 @@ void SQLiteParameter::Validate(const char * file, int32_t line) const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0 =>[{}:{}]", m_Index, file, line); + SqThrowF(SQMOD_RTFMT("Invalid column index: {} < 0 =>[{}:{}]"), m_Index, file, line); } // Do we have a valid statement handle? else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line); } } #else @@ -1258,15 +1258,15 @@ void SQLiteParameter::ValidateCreated(const char * file, int32_t line) const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0 =>[{}:{}]", m_Index, file, line); + SqThrowF(SQMOD_RTFMT("Invalid column index: {} < 0 =>[{}:{}]"), m_Index, file, line); } else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite statement =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement =>[{}:{}]"), file, line); } } #else @@ -1326,7 +1326,7 @@ void SQLiteParameter::ValidateParam(int32_t idx, const char * file, int32_t line // Is the specified index in range? if (!m_Handle->CheckParameter(idx)) { - SqThrowF("Parameter index is out of range ({}:{}) =>[{}:{}]", idx, m_Handle->mParameters, + SqThrowF(SQMOD_RTFMT("Parameter index is out of range ({}:{}) =>[{}:{}]"), idx, m_Handle->mParameters, file, line); } } @@ -1933,12 +1933,12 @@ void SQLiteColumn::Validate(const char * file, int32_t line) const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0 =>[{}:{}]", m_Index, file, line); + SqThrowF(SQMOD_RTFMT("Invalid column index: {} < 0 =>[{}:{}]"), m_Index, file, line); } // Do we have a valid statement handle? else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line); } } #else @@ -1964,15 +1964,15 @@ void SQLiteColumn::ValidateCreated(const char * file, int32_t line) const // Are we pointing to a valid index? if (m_Index < 0) { - SqThrowF("Invalid column index: {} < 0 =>[{}:{}]", m_Index, file, line); + SqThrowF(SQMOD_RTFMT("Invalid column index: {} < 0 =>[{}:{}]"), m_Index, file, line); } else if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite statement =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement =>[{}:{}]"), file, line); } } #else @@ -2032,7 +2032,7 @@ void SQLiteColumn::ValidateColumn(int32_t idx, const char * file, int32_t line) // Is the specified index in range? if (!m_Handle->CheckColumn(idx)) { - SqThrowF("Column index is out of range: {}:{} =>[{}:{}]", idx, m_Handle->mColumns, + SqThrowF(SQMOD_RTFMT("Column index is out of range: {}:{} =>[{}:{}]"), idx, m_Handle->mColumns, file, line); } } @@ -2407,7 +2407,7 @@ void SQLiteStatement::Validate(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line); } } #else @@ -2426,11 +2426,11 @@ void SQLiteStatement::ValidateCreated(const char * file, int32_t line) const { if (!m_Handle) { - SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line); } else if (m_Handle->mPtr == nullptr) { - SqThrowF("Invalid SQLite statement =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("Invalid SQLite statement =>[{}:{}]"), file, line); } } #else @@ -2485,7 +2485,7 @@ void SQLiteStatement::ValidateColumn(int32_t idx, const char * file, int32_t lin // Is the specified index in range? if (!m_Handle->CheckColumn(idx)) { - SqThrowF("Column index is out of range: {}:{} =>[{}:{}]", idx, m_Handle->mColumns, file, line); + SqThrowF(SQMOD_RTFMT("Column index is out of range: {}:{} =>[{}:{}]"), idx, m_Handle->mColumns, file, line); } } #else @@ -2508,7 +2508,7 @@ void SQLiteStatement::ValidateParam(int32_t idx, const char * file, int32_t line // Is the specified index in range? if (!m_Handle->CheckParameter(idx)) { - SqThrowF("Parameter index is out of range: {}:{} =>[{}:{}]", idx, m_Handle->mParameters, file, line); + SqThrowF(SQMOD_RTFMT("Parameter index is out of range: {}:{} =>[{}:{}]"), idx, m_Handle->mParameters, file, line); } } #else @@ -2531,7 +2531,7 @@ void SQLiteStatement::ValidateRow(const char * file, int32_t line) const // Do we have any rows available? if (!m_Handle->mGood) { - SqThrowF("No row available =>[{}:{}]", file, line); + SqThrowF(SQMOD_RTFMT("No row available =>[{}:{}]"), file, line); } } #else