1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Allow unoptimized to use formatting without errors.

This commit is contained in:
Sandu Liviu Catalin 2021-08-18 21:36:59 +03:00
parent 181b0f4377
commit 503b61c3df
4 changed files with 52 additions and 52 deletions

View File

@ -444,7 +444,7 @@ void SockAddr::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid sockaddr structure handle =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid sockaddr structure handle =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -551,7 +551,7 @@ void Database::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -687,7 +687,7 @@ void Description::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -708,7 +708,7 @@ Description::Pointer Description::GetValid(const SQChar * file, int32_t line) co
// Validate the referenced description // Validate the referenced description
if (!m_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 the description pointer
return m_Description; return m_Description;
@ -747,7 +747,7 @@ void EntryData::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -768,7 +768,7 @@ EntryData::ConstRef EntryData::GetValid(const SQChar * file, int32_t line) const
// See if the entry has any data // See if the entry has any data
if (!m_Entry.has_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 the entry
return m_Entry; return m_Entry;
@ -821,7 +821,7 @@ void EntryDataList::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -842,7 +842,7 @@ EntryDataList::Pointer EntryDataList::GetValid(const SQChar * file, int32_t line
// Validate the managed list // Validate the managed list
if (!m_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 the list
return m_List; return m_List;
@ -869,7 +869,7 @@ EntryDataList::Pointer EntryDataList::GetValidElem(const SQChar * file, int32_t
// Validate the current element // Validate the current element
if (!m_List) 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 the element
return m_Elem; return m_Elem;
@ -979,7 +979,7 @@ void LookupResult::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1139,7 +1139,7 @@ void Metadata::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1160,7 +1160,7 @@ Metadata::Pointer Metadata::GetValid(const SQChar * file, int32_t line) const
// Validate the referenced meta-data // Validate the referenced meta-data
if (!m_Metadata) 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 the meta-data pointer
return m_Metadata; return m_Metadata;
@ -1211,7 +1211,7 @@ void SearchNode::Validate(const SQChar * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid Maxmind database reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid Maxmind database reference =>[{}:{}]"), file, line);
} }
} }
#else #else

View File

@ -1623,7 +1623,7 @@ void Connection::Validate(const char * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL connection reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid MySQL connection reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1642,11 +1642,11 @@ void Connection::ValidateCreated(const char * file, int32_t line) const
{ {
if (!m_Handle) 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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid MySQL connection =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid MySQL connection =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1962,12 +1962,12 @@ void Field::Validate(const char * file, int32_t line) const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Are we pointing to a valid index?
else if (m_Index >= m_Handle->mFieldCount) 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 #else
@ -1993,7 +1993,7 @@ void Field::ValidateCreated(const char * file, int32_t line) const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Are we pointing to a valid index?
m_Handle->ValidateField(m_Index, file, line); 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? // Do we have a valid result-set handle?
if (!m_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? // Do we have a valid row available?
else if (m_Handle->mRow == nullptr) 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? // Are we pointing to a valid index?
m_Handle->ValidateField(m_Index, file, line); 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? // Do we have a valid result-set handle?
if (!m_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 // Validate the specified field index
m_Handle->ValidateField(idx, file, line); 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? // Do we have a valid result-set handle?
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL result-set reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -2492,11 +2492,11 @@ void ResultSet::ValidateCreated(const char * file, int32_t line) const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid MySQL result-set =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid MySQL result-set =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -2521,12 +2521,12 @@ void ResultSet::ValidateStepped(const char * file, int32_t line) const
// Do we have a valid result-set handle? // Do we have a valid result-set handle?
if (!m_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? // Do we have a valid row available?
else if (m_Handle->mRow == nullptr) 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 #else
@ -2753,7 +2753,7 @@ void Statement::Validate(const char * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid MySQL statement reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid MySQL statement reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -2772,11 +2772,11 @@ void Statement::ValidateCreated(const char * file, int32_t line) const
{ {
if (!m_Handle) 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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid MySQL statement =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid MySQL statement =>[{}:{}]"), file, line);
} }
} }
#else #else

View File

@ -650,7 +650,7 @@ public:
* Grab the current error in the associated statement or connection handle and throw it. * Grab the current error in the associated statement or connection handle and throw it.
*/ */
#if defined(_DEBUG) || defined(SQMOD_EXCEPTLOC) #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 #else
void ThrowCurrent(const char * act) const; void ThrowCurrent(const char * act) const;
#endif // _DEBUG #endif // _DEBUG

View File

@ -895,7 +895,7 @@ void SQLiteConnection::Validate(const char * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid SQLite connection reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite connection reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -914,11 +914,11 @@ void SQLiteConnection::ValidateCreated(const char * file, int32_t line) const
{ {
if (!m_Handle) 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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite connection =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite connection =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1227,12 +1227,12 @@ void SQLiteParameter::Validate(const char * file, int32_t line) const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) 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? // Do we have a valid statement handle?
else if (!m_Handle) else if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1258,15 +1258,15 @@ void SQLiteParameter::ValidateCreated(const char * file, int32_t line) const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) 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) 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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite statement =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite statement =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1326,7 +1326,7 @@ void SQLiteParameter::ValidateParam(int32_t idx, const char * file, int32_t line
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckParameter(idx)) 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); file, line);
} }
} }
@ -1933,12 +1933,12 @@ void SQLiteColumn::Validate(const char * file, int32_t line) const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) 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? // Do we have a valid statement handle?
else if (!m_Handle) else if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -1964,15 +1964,15 @@ void SQLiteColumn::ValidateCreated(const char * file, int32_t line) const
// Are we pointing to a valid index? // Are we pointing to a valid index?
if (m_Index < 0) 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) 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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite statement =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite statement =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -2032,7 +2032,7 @@ void SQLiteColumn::ValidateColumn(int32_t idx, const char * file, int32_t line)
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckColumn(idx)) 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); file, line);
} }
} }
@ -2407,7 +2407,7 @@ void SQLiteStatement::Validate(const char * file, int32_t line) const
{ {
if (!m_Handle) if (!m_Handle)
{ {
SqThrowF("Invalid SQLite statement reference =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite statement reference =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -2426,11 +2426,11 @@ void SQLiteStatement::ValidateCreated(const char * file, int32_t line) const
{ {
if (!m_Handle) 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) else if (m_Handle->mPtr == nullptr)
{ {
SqThrowF("Invalid SQLite statement =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("Invalid SQLite statement =>[{}:{}]"), file, line);
} }
} }
#else #else
@ -2485,7 +2485,7 @@ void SQLiteStatement::ValidateColumn(int32_t idx, const char * file, int32_t lin
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckColumn(idx)) 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 #else
@ -2508,7 +2508,7 @@ void SQLiteStatement::ValidateParam(int32_t idx, const char * file, int32_t line
// Is the specified index in range? // Is the specified index in range?
if (!m_Handle->CheckParameter(idx)) 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 #else
@ -2531,7 +2531,7 @@ void SQLiteStatement::ValidateRow(const char * file, int32_t line) const
// Do we have any rows available? // Do we have any rows available?
if (!m_Handle->mGood) if (!m_Handle->mGood)
{ {
SqThrowF("No row available =>[{}:{}]", file, line); SqThrowF(SQMOD_RTFMT("No row available =>[{}:{}]"), file, line);
} }
} }
#else #else