/sqlite3cc

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

« back to all changes in this revision

Viewing changes to include/sqlite3cc/connection.h

  • Committer: edam
  • Date: 2012-01-23 13:46:27 UTC
  • Revision ID: edam@waxworlds.org-20120123134627-i6hi9aftfvwgp8vw
updated autotols stuff

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * connection.h
3
3
 *
4
 
 * Copyright (C) 2009 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
5
5
 *
6
6
 * This file is part of sqlite3cc (hereafter referred to as "this program").
7
 
 * See http://ed.am/dev/sqlite3cc for more information.
8
 
 *
9
 
 * This program is free software: you can redistribute it and/or modify it under
10
 
 * the terms of the GNU Lesser General Public License as published by the Free
11
 
 * Software Foundation, either version 3 of the License, or (at your option) any
12
 
 * later version.
13
 
 *
14
 
 * This program is distributed in the hope that it will be useful, but WITHOUT
15
 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
 
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
17
 
 * details.
 
7
 * See http://www.waxworlds.org/edam/software/sqlite3cc for more information.
 
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
18
 *
19
19
 * You should have received a copy of the GNU Lesser General Public License
20
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26
26
 
27
27
#include <sqlite3.h>
28
28
#include <boost/utility.hpp>
29
 
#include <boost/shared_ptr.hpp>
30
29
#include <string>
31
30
 
32
31
 
38
37
        class basic_statement;
39
38
        class basic_transaction;
40
39
}
41
 
class command;
42
 
class query;
43
40
 
44
41
 
45
42
class connection
58
55
        public:
59
56
 
60
57
                /**
61
 
                 * Constructor that provides a connection upon which to act.
62
 
                 *
 
58
                 * Constructor that provides a connection upon which to act
63
59
                 * @param connection reference to a connection
64
60
                 * @see sqlite3_db_mutex()
65
61
                 * @see sqlite3_mutex_enter()
70
66
                ~mutex_guard();
71
67
 
72
68
                /**
73
 
                 * Release the mutex early.
74
 
                 *
 
69
                 * Release the mutex early
75
70
                 * @see sqlite3_mutex_leave()
76
71
                 */
77
72
                void leave();
86
81
 
87
82
        /**
88
83
         * Constructor that specifies the filename of a database to open.
89
 
         *
90
84
         * @param filename the filename of the database file to open
91
85
         * @throws database_error on error
92
86
         */
102
96
 
103
97
        /**
104
98
         * Open a database.
105
 
         *
106
99
         * @param filename the filename of the database file to open
107
100
         * @param flags flags appropriate for sqlite3_open_v2()
108
101
         * @returns an sqlite error code
114
107
 
115
108
        /**
116
109
         * Close an open database.
117
 
         *
118
110
         * @throws database_error on error
119
111
         * @see sqlite3_close()
120
112
         */
121
113
        void close();
122
114
 
123
115
        /**
124
 
         * Execute an SQL statement.  An exception is thrown on error.
125
 
         *
 
116
         * Execute an SQL statement. An exception is thrown on error.
126
117
         * @param sql an SQL statement in UTF-8
127
118
         * @see sqlite3_exc()
128
119
         */
130
121
                const std::string &sql );
131
122
 
132
123
        /**
133
 
         * Sets a default busy handler which will wait for the specified number of
134
 
         * milliseconds.
135
 
         *
 
124
         * Sets a default busy handler which will
 
125
         * wait for the specified number of milliseconds.
136
126
         * @param duration number of milliseconds to wait
137
127
         * @returns an sqlite error code
138
128
         * @see sqlite3_busy_timeout()
140
130
        int busy_timeout(
141
131
                int duration );
142
132
 
143
 
        /**
144
 
         * Create a command.
145
 
         *
146
 
         * @param sql an SQL statement in UTF-8
147
 
         */
148
 
        boost::shared_ptr< command > make_command(
149
 
                std::string sql );
150
 
 
151
 
        /**
152
 
         * Create a query.
153
 
         *
154
 
         * @param sql an SQL statement in UTF-8
155
 
         */
156
 
        boost::shared_ptr< query > make_query(
157
 
                std::string sql );
158
 
 
159
133
//______________________________________________________________________________
160
134
//                                                                implementation
161
135
private: