/sqlite3cc

To get this branch, use:
bzr branch http://bzr.ed.am/sqlite3cc

« back to all changes in this revision

Viewing changes to TODO

  • Committer: edam
  • Date: 2010-07-29 09:16:26 UTC
  • Revision ID: edam@waxworlds.org-20100729091626-h8fmg0r74eyfo5ae
- fixed error caused by finialising in-progress queries during rollback that were later finaliased by RAII.

Show diffs side-by-side

added added

removed removed

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