/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/database.h

  • Committer: edam
  • Date: 2010-02-07 14:39:18 UTC
  • Revision ID: edam@waxworlds.org-20100207143918-gi030ojecbska8hw
- updated README
- set up project for use with autotools

Show diffs side-by-side

added added

removed removed

26
26
 
27
27
#include <sqlite3.h>
28
28
#include <boost/utility.hpp>
29
 
#include <string>
30
29
 
31
30
 
32
31
namespace sqlite
34
33
 
35
34
 
36
35
class basic_statement;
37
 
class basic_transaction;
 
36
class transaction;
38
37
 
39
38
 
40
39
class database
54
53
                const std::string &filename );
55
54
 
56
55
        explicit database();
57
 
        virtual ~database();
 
56
        virtual ~database() throw( );
58
57
 
59
58
//______________________________________________________________________________
60
59
//                                                              public interface
79
78
        void close();
80
79
 
81
80
        /**
82
 
         * Execute an SQL statement. An exception is thrown on error.
 
81
         * Execute an SQL statement.
83
82
         * @param sql an SQL statement in UTF-8
 
83
         * @return an sqlite error code
84
84
         * @see sqlite3_exc()
85
85
         */
86
 
        void exec(
 
86
        int exec(
87
87
                const std::string &sql );
88
88
 
89
89
        /**
98
98
 
99
99
//______________________________________________________________________________
100
100
//                                                                implementation
101
 
protected:
 
101
private:
102
102
 
103
103
        friend class basic_statement;
104
 
        friend class basic_transaction;
105
104
        friend class command;
106
 
        friend class query;
107
 
        friend class sqlite_error;
108
 
 
109
 
        /** class to provide a scope lock for the database mutex */
110
 
        class database_mutex_guard
111
 
        {
112
 
        public:
113
 
 
114
 
                /** constructor that provides a database */
115
 
                database_mutex_guard(
116
 
                        database &database );
117
 
 
118
 
                ~database_mutex_guard();
119
 
 
120
 
                /** release the mutex early */
121
 
                void leave();
122
 
 
123
 
        private:
124
 
                sqlite3_mutex *_mutex;
125
 
        };
126
 
 
127
 
private:
128
105
 
129
106
        /** the database handle */
130
107
        sqlite3 *_handle;