libsl3 1.3.51003
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 the result of
25 * a SQL statement.
26 *
27 *
28 */
29 class LIBSL3_API RowCallback
30 {
31 friend class Command;
32
33 public:
34 /**
35 * \brief Destructor
36 */
37 virtual ~RowCallback () noexcept;
38
39 protected:
40 /**
41 * \brief Constructor
42 */
43 RowCallback () noexcept;
44
45 /**
46 * \brief Process one row of the result from a SELECT statement
47 *
48 * @param columns Columns object for accessing values.
49 *
50 * @return false if processing the query result shall stop
51 * \n true otherwise
52 */
53 virtual bool onRow (Columns columns) = 0;
54
55 /**
56 * \brief Called before a query result will be processed
57 *
58 * The default implementation does nothing.
59 */
60 virtual void onStart ();
61
62 /**
63 * \brief Called after a query result has been processed
64 *
65 * The default implementation does nothing.
66 */
67 virtual void onEnd ();
68 };
69}
70
71#endif
Class to access data of query results.
Definition columns.hpp:38
virtual ~RowCallback() noexcept
Destructor.
virtual bool onRow(Columns columns)=0
Process one row of the result from a SELECT statement.
virtual void onStart()
Called before a query result will be processed.
RowCallback() noexcept
Constructor.
virtual void onEnd()
Called after a query result has been processed.
Namespace of libSL3.
Definition columns.hpp:18