/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: edam
  • Date: 2010-07-29 20:56:19 UTC
  • Revision ID: edam@waxworlds.org-20100729205619-a9yo4uzu647nvnsj
- renamed database to connection to better identify what it is (would database_connection be better though?)
- moved basic_statement and basic_transaction to sqlite::detail
- made sqlite::threadsafe() return the threading mode int, not a bool
- renamed row::index() to row_number() so it isn't confused with column index
- added typedef for deferred_transaction
- added early rollback method to transaction_guard
- allowed transaction_guard::~transaction_guard() to throw exceptions, since when it needs to, we're really screwed anyway
- bugfix: query::reset() didn't reset the internal row counter
- added query::num_results()
- added docs/design-notes
- reimplemented query::iterator so that increment() (which performs a step() on the query) now caches the returned row to be returned during dereference() (previously it stashed details and returned new row!?)
- bugfix: resetting active queries during rollbacks would hang!

Show diffs side-by-side

added added

removed removed

32
32
{
33
33
 
34
34
 
 
35
class connection;
 
36
 
 
37
 
35
38
/**
36
39
 * Main (base) sqlite exception class.
37
40
 */
44
47
public:
45
48
 
46
49
        /**
47
 
         * Constructor that takes an sqlite error code and determines it's own
48
 
         * error message
49
 
         * @param error_code the sqlite error code
50
 
         */
51
 
        explicit sqlite_error(
52
 
                int error_code );
53
 
 
54
 
        /**
55
 
         * Constructor that allows the creation of an sqlite error with a custom
 
50
         * Constructor that takes an sqlite result code and a connection from which
 
51
         * to determine it's error message
 
52
         * @param connection a reference to a connection
 
53
         * @param code the sqlite result code
 
54
         * @see sqlite_errmsg()
 
55
         */
 
56
        explicit sqlite_error(
 
57
                connection &connection,
 
58
                int code );
 
59
 
 
60
 
 
61
        /**
 
62
         * Constructor that takes an sqlite result code and determines it's own
 
63
         * generic error message
 
64
         * @param code the sqlite result code
 
65
         */
 
66
        explicit sqlite_error(
 
67
                int code );
 
68
 
 
69
        /**
 
70
         * Constructor that allows the creation of an sqlite result with a custom
56
71
         * message.
57
72
         * @param message a customer error message string
58
 
         * @param error_code the sqlite error code
 
73
         * @param code the sqlite result code
59
74
         */
60
75
        explicit sqlite_error(
61
76
                const std::string &message,
62
 
                int error_code = SQLITE_ERROR );
 
77
                int code = SQLITE_ERROR );
63
78
 
64
79
        virtual ~sqlite_error() throw( );
65
80
 
68
83
public:
69
84
 
70
85
        /**
71
 
         * Get the sqlite error code associated with this error
72
 
         * @returns the sqlite error code
 
86
         * Get the sqlite result code associated with this error
 
87
         * @returns the sqlite result code
73
88
         */
74
 
        int get_error_code() const;
 
89
        int get_code() const;
75
90
 
76
91
        /**
77
92
         * Get the error message
84
99
private:
85
100
 
86
101
        /**
87
 
         * Retrieve an automatic error message for a given sqlite error code
88
 
         * @param the sqlite error code
 
102
         * Retrieve an automatic error message for a given sqlite result code
 
103
         * @param the sqlite result code
89
104
         * @returns the automatic string
90
105
         */
91
 
        const std::string &get_error_message(
92
 
                int error_code );
 
106
        const std::string &get_message(
 
107
                int code );
93
108
 
94
 
        /** the error code */
95
 
        int _error_code;
 
109
        /** the result code */
 
110
        int _code;
96
111
 
97
112
        /** the message string */
98
113
        std::string _message;