11/* *
22 * @file RowExecutor.h
33 * @ingroup SQLiteCpp
4- * @brief TODO:
4+ * @brief Step executor for SQLite prepared Statement Object
55 *
66 * Copyright (c) 2015 Shibao HONG (shibaohong@outlook.com)
77 * Copyright (c) 2015-2021 Sebastien Rombauts (sebastien.rombauts@gmail.com)
@@ -45,6 +45,11 @@ class RowExecutor
4545 // / Type to store columns names and indexes
4646 using TColumnsMap = std::map<std::string, int , std::less<>>;
4747
48+ RowExecutor (const RowExecutor&) = delete ;
49+ RowExecutor (RowExecutor&&) = default ;
50+ RowExecutor& operator =(const RowExecutor&) = delete ;
51+ RowExecutor& operator =(RowExecutor&&) = default ;
52+
4853 // / Reset the statement to make it ready for a new execution. Throws an exception on error.
4954 void reset ();
5055
@@ -130,17 +135,17 @@ class RowExecutor
130135 int getChanges () const noexcept ;
131136
132137 // / Return the number of columns in the result set returned by the prepared statement
133- int getColumnCount () const
138+ int getColumnCount () const noexcept
134139 {
135140 return mColumnCount ;
136141 }
137142 // / true when a row has been fetched with executeStep()
138- bool hasRow () const
143+ bool hasRow () const noexcept
139144 {
140145 return mbHasRow;
141146 }
142147 // / true when the last executeStep() had no more row to fetch
143- bool isDone () const
148+ bool isDone () const noexcept
144149 {
145150 return mbDone;
146151 }
@@ -167,7 +172,10 @@ class RowExecutor
167172 *
168173 * @return raw pointer to Statement Object
169174 */
170- TStatementPtr getStatement () const noexcept ;
175+ TStatementPtr getStatement () const noexcept
176+ {
177+ return mpStatement;
178+ }
171179
172180 /* *
173181 * @brief Return a prepared SQLite Statement Object.
@@ -176,6 +184,19 @@ class RowExecutor
176184 * @return raw pointer to Prepared Statement Object
177185 */
178186 sqlite3_stmt* getPreparedStatement () const ;
187+
188+ /* *
189+ * @brief Return a prepared SQLite Statement Object.
190+ *
191+ * Throw an exception if the statement object was not prepared.
192+ * @return raw pointer to Prepared Statement Object
193+ */
194+ TRowWeakPtr getExecutorWeakPtr () const
195+ {
196+ return mpRowExecutor;
197+ }
198+
199+ // //////////////////////////////////////////////////////////////////////////
179200
180201 /* *
181202 * @brief Check if a return code equals SQLITE_OK, else throw a SQLite::Exception with the SQLite error message
@@ -222,9 +243,13 @@ class RowExecutor
222243 sqlite3* mpSQLite{}; // !< Pointer to SQLite Database Connection Handle
223244 TStatementPtr mpStatement{}; // !< Shared Pointer to the prepared SQLite Statement Object
224245
225- int mColumnCount { 0 }; // !< Number of columns in the result of the prepared statement
226- bool mbHasRow{ false }; // !< true when a row has been fetched with executeStep()
227- bool mbDone{ false }; // !< true when the last executeStep() had no more row to fetch
246+ // / Shared Pointer to this object.
247+ // / Allows RowIterator to execute next step
248+ TRowPtr mpRowExecutor{};
249+
250+ int mColumnCount = 0 ; // !< Number of columns in the result of the prepared statement
251+ bool mbHasRow = false ; // !< true when a row has been fetched with executeStep()
252+ bool mbDone = false ; // !< true when the last executeStep() had no more row to fetch
228253
229254 // / Map of columns index by name (mutable so getColumnIndex can be const)
230255 mutable TColumnsMap mColumnNames {};
0 commit comments