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

Allow chaining on Reset and Clear methods of the SQLite Statement type.

This commit is contained in:
Sandu Liviu Catalin 2016-06-16 06:37:32 +03:00
parent af9c00298c
commit 02aa2667a6
2 changed files with 8 additions and 4 deletions

View File

@ -193,7 +193,7 @@ Object Statement::GetConnection() const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Statement::Reset() Statement & Statement::Reset()
{ {
VALIDATE_CREATED_HND(*this); VALIDATE_CREATED_HND(*this);
// Specify that we don't have a row available and we haven't finished stepping // Specify that we don't have a row available and we haven't finished stepping
@ -206,10 +206,12 @@ void Statement::Reset()
{ {
STHROWF("Unable to reset statement [%s]", m_Handle->ErrStr()); STHROWF("Unable to reset statement [%s]", m_Handle->ErrStr());
} }
// Allow further chaining of operations
return *this;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Statement::Clear() Statement & Statement::Clear()
{ {
VALIDATE_CREATED_HND(*this); VALIDATE_CREATED_HND(*this);
// Specify that we don't have a row available and we haven't finished stepping // Specify that we don't have a row available and we haven't finished stepping
@ -222,6 +224,8 @@ void Statement::Clear()
{ {
STHROWF("Unable to clear statement [%s]", m_Handle->ErrStr()); STHROWF("Unable to clear statement [%s]", m_Handle->ErrStr());
} }
// Allow further chaining of operations
return *this;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -330,12 +330,12 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Reset the statement back to its initial position to be stepped again. * Reset the statement back to its initial position to be stepped again.
*/ */
void Reset(); Statement & Reset();
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Clear any values binded to this statement. * Clear any values binded to this statement.
*/ */
void Clear(); Statement & Clear();
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Execute this statement and don't expect any rows to be returned. * Execute this statement and don't expect any rows to be returned.