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

  • Committer: Tim Marston
  • Date: 2015-02-26 08:59:36 UTC
  • Revision ID: tim@ed.am-20150226085936-xe43in8bfz6f6nxb
fixed some missing/incorrect includes

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * exception.h
3
3
 *
4
 
 * Copyright (C) 2009 Tim Marston <edam@waxworlds.org>
 
4
 * Copyright (C) 2009 Tim Marston <tim@ed.am>
5
5
 *
6
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
 
 *
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.
 
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.
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 <stdexcept>
 
29
#include <string>
29
30
 
30
31
 
31
32
namespace sqlite
32
33
{
33
34
 
34
35
 
35
 
class database;
 
36
class connection;
36
37
 
37
38
 
38
39
/**
47
48
public:
48
49
 
49
50
        /**
50
 
         * Constructor that takes an sqlite error code and a database from which to
51
 
         * determine it's error message
52
 
         * @param code the sqlite error code
 
51
         * Constructor that takes an sqlite result code and a connection from which
 
52
         * to determine it's error message.
 
53
         *
 
54
         * @param connection a reference to a connection
 
55
         * @param code the sqlite result code
53
56
         * @see sqlite_errmsg()
54
57
         */
55
58
        explicit sqlite_error(
56
 
                database &database,
 
59
                connection &connection,
57
60
                int code );
58
61
 
59
62
 
60
63
        /**
61
 
         * Constructor that takes an sqlite error code and determines it's own
62
 
         * generic error message
63
 
         * @param code the sqlite error code
 
64
         * Constructor that takes an sqlite result code and determines it's own
 
65
         * generic error message.
 
66
         *
 
67
         * @param code the sqlite result code
64
68
         */
65
69
        explicit sqlite_error(
66
70
                int code );
67
71
 
68
72
        /**
69
 
         * Constructor that allows the creation of an sqlite error with a custom
 
73
         * Constructor that allows the creation of an sqlite result with a custom
70
74
         * message.
 
75
         *
71
76
         * @param message a customer error message string
72
 
         * @param code the sqlite error code
 
77
         * @param code the sqlite result code
73
78
         */
74
79
        explicit sqlite_error(
75
80
                const std::string &message,
82
87
public:
83
88
 
84
89
        /**
85
 
         * Get the sqlite error code associated with this error
86
 
         * @returns the sqlite error code
 
90
         * Get the sqlite result code associated with this error.
 
91
         *
 
92
         * @returns the sqlite result code
87
93
         */
88
94
        int get_code() const;
89
95
 
98
104
private:
99
105
 
100
106
        /**
101
 
         * Retrieve an automatic error message for a given sqlite error code
102
 
         * @param the sqlite error code
 
107
         * Retrieve an automatic error message for a given sqlite result code.
 
108
         *
 
109
         * @param the sqlite result code
103
110
         * @returns the automatic string
104
111
         */
105
112
        const std::string &get_message(
106
113
                int code );
107
114
 
108
 
        /** the error code */
 
115
        /** the result code */
109
116
        int _code;
110
117
 
111
118
        /** the message string */