/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-07-27 15:46:42 UTC
  • Revision ID: edam@waxworlds.org-20100727154642-1uxrjkpxhp7xl6hq
- moved null_t, exec_t and set_index_t to detail namespace so only their extern instantiations are in the main namespace
- added immediate transation

Show diffs side-by-side

added added

removed removed

1
1
/*
2
 
 * database.hpp
 
2
 * database.h
3
3
 *
4
4
 * Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
5
5
 *
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.
 
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.
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 DATABASE_HPP_
24
 
#define DATABASE_HPP_
 
23
#ifndef SQLITE3CC_DATABASE_H_
 
24
#define SQLITE3CC_DATABASE_H_
25
25
 
26
26
 
27
27
#include <sqlite3.h>
28
28
#include <boost/utility.hpp>
 
29
#include <string>
29
30
 
30
31
 
31
32
namespace sqlite
32
33
{
33
34
 
34
35
 
35
 
class statement;
 
36
class basic_statement;
36
37
class transaction;
37
38
 
38
39
 
49
50
         * @param filename the filename of the database file to open
50
51
         * @throws database_error on error
51
52
         */
52
 
        database(
 
53
        explicit database(
53
54
                const std::string &filename );
54
55
 
55
 
        database();
56
 
        virtual ~database() throw( );
 
56
        explicit database();
 
57
        virtual ~database();
57
58
 
58
59
//______________________________________________________________________________
59
60
//                                                              public interface
78
79
        void close();
79
80
 
80
81
        /**
81
 
         * Execute an SQL statement.
 
82
         * Execute an SQL statement. An exception is thrown on error.
82
83
         * @param sql an SQL statement in UTF-8
83
 
         * @return an sqlite error code
84
84
         * @see sqlite3_exc()
85
85
         */
86
 
        int exec(
 
86
        void exec(
87
87
                const std::string &sql );
88
88
 
89
89
        /**
100
100
//                                                                implementation
101
101
private:
102
102
 
103
 
        friend class statement;
104
 
        friend class transaction;
 
103
        friend class basic_statement;
 
104
        friend class command;
105
105
 
106
106
        /** the database handle */
107
107
        sqlite3 *_handle;
109
109
};
110
110
 
111
111
 
112
 
}
113
 
 
114
 
 
115
 
#endif /* DATABASE_HPP_ */
 
112
} // namespace sqlite
 
113
 
 
114
 
 
115
#endif /* SQLITE3CC_DATABASE_H_ */