From 02aa2667a6a434aa9026f4a31546c13c2fe805f2 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Thu, 16 Jun 2016 06:37:32 +0300 Subject: [PATCH] Allow chaining on Reset and Clear methods of the SQLite Statement type. --- modules/sqlite/Statement.cpp | 8 ++++++-- modules/sqlite/Statement.hpp | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/sqlite/Statement.cpp b/modules/sqlite/Statement.cpp index 8be04fd4..2215af25 100644 --- a/modules/sqlite/Statement.cpp +++ b/modules/sqlite/Statement.cpp @@ -193,7 +193,7 @@ Object Statement::GetConnection() const } // ------------------------------------------------------------------------------------------------ -void Statement::Reset() +Statement & Statement::Reset() { VALIDATE_CREATED_HND(*this); // 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()); } + // Allow further chaining of operations + return *this; } // ------------------------------------------------------------------------------------------------ -void Statement::Clear() +Statement & Statement::Clear() { VALIDATE_CREATED_HND(*this); // 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()); } + // Allow further chaining of operations + return *this; } // ------------------------------------------------------------------------------------------------ diff --git a/modules/sqlite/Statement.hpp b/modules/sqlite/Statement.hpp index 71171685..7a910bec 100644 --- a/modules/sqlite/Statement.hpp +++ b/modules/sqlite/Statement.hpp @@ -330,12 +330,12 @@ public: /* -------------------------------------------------------------------------------------------- * Reset the statement back to its initial position to be stepped again. */ - void Reset(); + Statement & Reset(); /* -------------------------------------------------------------------------------------------- * Clear any values binded to this statement. */ - void Clear(); + Statement & Clear(); /* -------------------------------------------------------------------------------------------- * Execute this statement and don't expect any rows to be returned.