libsl3 1.2.41002
A C++ interface for SQLite
Loading...
Searching...
No Matches
rowcallback.hpp
1/******************************************************************************
2 ------------- Copyright (c) 2009-2023 H a r a l d A c h i t z ---------------
3 ---------- < h a r a l d dot a c h i t z at g m a i l dot c o m > ------------
4 ---- This Source Code Form is subject to the terms of the Mozilla Public -----
5 ---- License, v. 2.0. If a copy of the MPL was not distributed with this -----
6 ---------- file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------
7 ******************************************************************************/
8
9#ifndef SL3_RowCallback_HPP
10#define SL3_RowCallback_HPP
11
12#include <functional>
13
14#include <sl3/columns.hpp>
15#include <sl3/config.hpp>
16
17namespace sl3
18{
19 class Columns;
20
21 /**
22 * \brief Callback for SQL Select statements
23 *
24 * This interface can be used to process through the result of
25 * a SQL statement.
26 *
27 *
28 */
29 class LIBSL3_API RowCallback
30 {
31 friend class Command;
32
33 protected:
34 /**
35 * \brief Constructor
36 */
37 RowCallback () noexcept = default;
38
39 /**
40 * \brief Constructor
41 */
42 virtual ~RowCallback () noexcept = default;
43
44 /**
45 * \brief Process one row of the result from a SELECT statement
46 *
47 * @param columns Columns object for accessing values.
48 *
49 * @return false if processing the query result shall stop
50 * \n true otherwise
51 */
52 virtual bool onRow (Columns columns) = 0;
53
54 /**
55 * \brief Called before a query result will be processed
56 *
57 * The default implementation does nothing.
58 */
59 virtual void onStart ();
60
61 /**
62 * \brief Called after a query result has been processed
63 *
64 * The default implementation does nothing.
65 */
66 virtual void onEnd ();
67 };
68}
69
70#endif
Class to access data of query results.
Definition: columns.hpp:38
A compiled SQL command.
Definition: command.hpp:40
Callback for SQL Select statements.
Definition: rowcallback.hpp:30
RowCallback() noexcept=default
Constructor.
Namespace of libSL3.
Definition: columns.hpp:18