1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
- add columns() to row that returns a boost::tuple of various types so multple
columns can be fetched at once (look in to using BOOST_PP_ITERATE macro)
- make basic_statement and database keep a shared pointer to the database handle
so the classes can be made copyable. The wrappers around the handle
(implemented in sqlite::detail) can clean them up after use. This will also
make the implementation of rows (to get round the forced non-dependency of
rows on querys) a little easier to swallow.
- A similar wrapper should be created for statement handles, making
basic_statements, querys and commands copyable. Could weak_ptrs to these
also be used in the database's list active querys?
- fix to force the finalisation of queries in progress for transactions causes
errors; queries are now finalised twice, the second from basic_statement's
dtor, which causes a segfault. We could:
- keep a list of force-finalised sqlite3_stmt pointers in the database which
we use to check queries against before finalising them to make sure we
don't finalise them a second time
- an efficient implementation, but not very OO
- keep a map of active queries in the database (using the sqlite3_stmt
pointer as the key), so that we can obtain the query and tell it to
finalise its self
- this seems like a messy and complicated implementation
- turn on extended errcodes in open() and handle them in sqlite_error
- use sqlite3_db_mutex() to provide extended error information during
sqlite_error construction. The genreeal procedure would be to lock the db
mutex, perform some sqlite3 command, check the error code, throw an
sqlite_error (whilst obtaining extended error info) and then unlock the db
mutex. Two options:
- a macro would be simple
- a templated safe-calling object (passing the comman's arg types as
template params) may be overkill
- expand sqlite_error - perhaps use boost::system_error (see
boost/asio/error.hpp for an example of extending system_error)
- see if we can #include "sqlite.h" in to a namespace.
Pros:
we better encapsulate the library
we can reuse "sqlite3" as a namespace
Cons:
makes access to real sqlite stuff awkward to sqlite3cc users, but does
this matter? they can't access database._handle anyway!
potential incompatibility when linking to libraries that also link
against sqlite
- query::prepare() isn't being called during construction (form
basic_statement's constructor)
|