/sqlite3cc

To get this branch, use:
bzr branch http://bzr.ed.am/sqlite3cc

« back to all changes in this revision

Viewing changes to include/sqlitepp/query.hpp

  • Committer: edam
  • Date: 2009-11-25 20:32:34 UTC
  • Revision ID: edam@waxworlds.org-20091125203234-24i7mzd60c7o46py
- initial commit
- basic support for: database, statements, commands, transactions, exceptions
- initial test app
- initial liscence and readme

Show diffs side-by-side

added added

removed removed

1
1
/*
2
 
 * query.h
 
2
 * query.hpp
3
3
 *
4
4
 * Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
5
5
 *
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.
 
6
 * This file is part of sqlitepp (hereafter referred to as "this program").
 
7
 * See http://www.waxworlds.org/edam/software/sqlitepp for more information.
8
8
 *
9
9
 * This program is free software: you can redistribute it and/or modify
10
10
 * it under the terms of the GNU Lesser General Public License as published
20
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
 */
22
22
 
23
 
#ifndef SQLITE3CC_QUERY_H_
24
 
#define SQLITE3CC_QUERY_H_
25
 
 
26
 
 
27
 
#include <sqlite3cc/basic_statement.h>
 
23
#ifndef QUERY_HPP_
 
24
#define QUERY_HPP_
 
25
 
 
26
 
 
27
#include <sqlitepp/statement.hpp>
28
28
 
29
29
 
30
30
namespace sqlite
31
31
{
32
32
 
33
33
 
34
 
class row;
35
 
 
36
 
 
37
34
class query
38
35
        :
39
 
        public basic_statement
 
36
        public statement
40
37
{
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();
87
38
 
88
39
};
89
40
 
90
41
 
91
 
} // namespace sqlite
92
 
 
93
 
 
94
 
#endif /* SQLITE3CC_QUERY_H_ */
 
42
}
 
43
 
 
44
 
 
45
#endif /* QUERY_HPP_ */