11/* *
2- * @file RowExecutor .cpp
2+ * @file StatementExecutor .cpp
33 * @ingroup SQLiteCpp
44 * @brief Step executor for SQLite prepared Statement Object
55 *
99 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
1010 * or copy at http://opensource.org/licenses/MIT)
1111 */
12- #include < SQLiteCpp/RowExecutor .h>
12+ #include < SQLiteCpp/StatementExecutor .h>
1313
1414#include < SQLiteCpp/Exception.h>
1515
@@ -19,18 +19,18 @@ namespace SQLite
1919{
2020
2121
22- RowExecutor::RowExecutor (sqlite3* apSQLite, const std::string& aQuery)
22+ StatementExecutor::StatementExecutor (sqlite3* apSQLite, const std::string& aQuery)
2323 : mpSQLite(apSQLite)
2424 {
2525 prepareStatement (aQuery);
2626 createColumnInfo ();
2727
28- mpRowExecutor.swap (TRowPtr (this , [](const RowExecutor * const ) {
28+ mpRowExecutor.swap (TRowPtr (this , [](const StatementExecutor * const ) {
2929 // empty destructor to make shared_ptr without ownership
3030 }));
3131 }
3232
33- void SQLite::RowExecutor ::prepareStatement (const std::string& aQuery)
33+ void SQLite::StatementExecutor ::prepareStatement (const std::string& aQuery)
3434 {
3535 if (!mpSQLite)
3636 throw SQLite::Exception (" Can't create statement without valid database connection" );
@@ -49,7 +49,7 @@ namespace SQLite
4949 });
5050 }
5151
52- void SQLite::RowExecutor ::createColumnInfo ()
52+ void SQLite::StatementExecutor ::createColumnInfo ()
5353 {
5454 mColumnCount = sqlite3_column_count (mpStatement.get ());
5555
@@ -66,21 +66,21 @@ namespace SQLite
6666 }
6767
6868 // Reset the statement to make it ready for a new execution (see also #clearBindings() bellow)
69- void RowExecutor ::reset ()
69+ void StatementExecutor ::reset ()
7070 {
7171 const int ret = tryReset ();
7272 check (ret);
7373 }
7474
75- int RowExecutor ::tryReset () noexcept
75+ int StatementExecutor ::tryReset () noexcept
7676 {
7777 mbHasRow = false ;
7878 mbDone = false ;
7979 return sqlite3_reset (mpStatement.get ());
8080 }
8181
8282 // Execute a step of the query to fetch one row of results
83- bool RowExecutor ::executeStep ()
83+ bool StatementExecutor ::executeStep ()
8484 {
8585 const int ret = tryExecuteStep ();
8686 if ((SQLITE_ROW != ret) && (SQLITE_DONE != ret)) // on row or no (more) row ready, else it's a problem
@@ -99,7 +99,7 @@ namespace SQLite
9999 }
100100
101101 // Execute a one-step query with no expected result, and return the number of changes.
102- int RowExecutor ::exec ()
102+ int StatementExecutor ::exec ()
103103 {
104104 const int ret = tryExecuteStep ();
105105 if (SQLITE_DONE != ret) // the statement has finished executing successfully
@@ -122,7 +122,7 @@ namespace SQLite
122122 return sqlite3_changes (mpSQLite);
123123 }
124124
125- int RowExecutor ::tryExecuteStep () noexcept
125+ int StatementExecutor ::tryExecuteStep () noexcept
126126 {
127127 if (mbDone)
128128 {
@@ -143,31 +143,31 @@ namespace SQLite
143143 }
144144
145145 // Get number of rows modified by last INSERT, UPDATE or DELETE statement (not DROP table).
146- int RowExecutor ::getChanges () const noexcept
146+ int StatementExecutor ::getChanges () const noexcept
147147 {
148148 return sqlite3_changes (mpSQLite);
149149 }
150150
151151 // Return the numeric result code for the most recent failed API call (if any).
152- int RowExecutor ::getErrorCode () const noexcept
152+ int StatementExecutor ::getErrorCode () const noexcept
153153 {
154154 return sqlite3_errcode (mpSQLite);
155155 }
156156
157157 // Return the extended numeric result code for the most recent failed API call (if any).
158- int RowExecutor ::getExtendedErrorCode () const noexcept
158+ int StatementExecutor ::getExtendedErrorCode () const noexcept
159159 {
160160 return sqlite3_extended_errcode (mpSQLite);
161161 }
162162
163163 // Return UTF-8 encoded English language explanation of the most recent failed API call (if any).
164- const char * RowExecutor ::getErrorMsg () const noexcept
164+ const char * StatementExecutor ::getErrorMsg () const noexcept
165165 {
166166 return sqlite3_errmsg (mpSQLite);
167167 }
168168
169169 // Return prepered SQLite statement object or throw
170- sqlite3_stmt* RowExecutor ::getPreparedStatement () const
170+ sqlite3_stmt* StatementExecutor ::getPreparedStatement () const
171171 {
172172 sqlite3_stmt* ret = mpStatement.get ();
173173 if (ret)
@@ -177,19 +177,19 @@ namespace SQLite
177177 throw SQLite::Exception (" Statement was not prepared." );
178178 }
179179
180- RowExecutor ::RowIterator RowExecutor ::begin ()
180+ StatementExecutor ::RowIterator StatementExecutor ::begin ()
181181 {
182182 reset ();
183183 tryExecuteStep ();
184- return RowExecutor ::RowIterator (getStatement (), getExecutorWeakPtr (), 0 );
184+ return StatementExecutor ::RowIterator (getStatement (), getExecutorWeakPtr (), 0 );
185185 }
186186
187- RowExecutor ::RowIterator RowExecutor ::end ()
187+ StatementExecutor ::RowIterator StatementExecutor ::end ()
188188 {
189- return RowExecutor ::RowIterator ();
189+ return StatementExecutor ::RowIterator ();
190190 }
191191
192- void RowExecutor ::RowIterator::advance () noexcept
192+ void StatementExecutor ::RowIterator::advance () noexcept
193193 {
194194 if (mpRow.expired ())
195195 return ;
@@ -204,7 +204,7 @@ namespace SQLite
204204 }
205205 }
206206
207- bool RowExecutor ::RowIterator::operator ==(const RowIterator& aIt) const
207+ bool StatementExecutor ::RowIterator::operator ==(const RowIterator& aIt) const
208208 {
209209 auto left = mpRow.lock ();
210210 auto right = aIt.mpRow .lock ();
0 commit comments