bzr branch
http://bzr.ed.am/sqlite3cc
1
by edam
- initial commit |
1 |
/* |
2
by edam
- further initial development |
2 |
* query.h |
1
by edam
- initial commit |
3 |
* |
4 |
* Copyright (C) 2009 Tim Marston <edam@waxworlds.org> |
|
5 |
* |
|
2
by edam
- further initial development |
6 |
* This file is part of sqlite3cc (hereafter referred to as "this program"). |
7 |
* See http://www.waxworlds.org/edam/software/sqlite3cc for more information. |
|
1
by edam
- initial commit |
8 |
* |
9 |
* This program is free software: you can redistribute it and/or modify |
|
10 |
* it under the terms of the GNU Lesser General Public License as published |
|
11 |
* by the Free Software Foundation, either version 3 of the License, or |
|
12 |
* (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU Lesser General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU Lesser General Public License |
|
20 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21 |
*/ |
|
22 |
||
2
by edam
- further initial development |
23 |
#ifndef SQLITE3CC_QUERY_H_ |
24 |
#define SQLITE3CC_QUERY_H_ |
|
25 |
||
26 |
||
27 |
#include <sqlite3cc/basic_statement.h> |
|
1
by edam
- initial commit |
28 |
|
29 |
||
30 |
namespace sqlite |
|
31 |
{ |
|
32 |
||
33 |
||
2
by edam
- further initial development |
34 |
class row; |
35 |
||
36 |
||
1
by edam
- initial commit |
37 |
class query |
38 |
: |
|
2
by edam
- further initial development |
39 |
public basic_statement |
1
by edam
- initial commit |
40 |
{ |
2
by edam
- further initial development |
41 |
//______________________________________________________________________________ |
42 |
// instantiation |
|
43 |
public: |
|
44 |
||
45 |
/** |
|
46 |
* Constructor that provides a database upon which to act and the SQL |
|
47 |
* query to execute. |
|
48 |
* @param database a reference to a database |
|
49 |
* @param sql an SQL statement in UTF-8 |
|
50 |
*/ |
|
51 |
explicit query( |
|
52 |
database &database, |
|
53 |
const std::string &sql ); |
|
54 |
||
55 |
/** |
|
56 |
* Constructor that provides a database upon which to act. |
|
57 |
* @param database a reference to a database |
|
58 |
* @param sql an SQL statement in UTF-8 |
|
59 |
*/ |
|
60 |
explicit query( |
|
61 |
database &database ); |
|
62 |
||
63 |
//______________________________________________________________________________ |
|
64 |
// public interface |
|
65 |
public: |
|
66 |
||
67 |
/** |
|
68 |
* Prepare an SQL statement. |
|
69 |
* @param sql an SQL statement in UTF-8 |
|
70 |
* @returns an sqlite error code |
|
71 |
* @see sqlite3_prepare_v2() |
|
72 |
*/ |
|
73 |
virtual int prepare( |
|
74 |
const std::string &sql ); |
|
75 |
||
76 |
/** |
|
77 |
* Peform a step() and return row object that can be used to retrieve the |
|
78 |
* results. |
|
79 |
* @return a row object |
|
80 |
*/ |
|
81 |
row step(); |
|
82 |
||
83 |
/** |
|
84 |
* Get the number of columns in the result of |
|
85 |
*/ |
|
86 |
unsigned int column_count(); |
|
1
by edam
- initial commit |
87 |
|
88 |
}; |
|
89 |
||
90 |
||
2
by edam
- further initial development |
91 |
} // namespace sqlite |
92 |
||
93 |
||
94 |
#endif /* SQLITE3CC_QUERY_H_ */ |