From 0f9cfacd6cc45f78f1453a8eeb7ffa542dc5dc48 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 15 Jul 2015 18:43:03 +0200 Subject: Implement SQLite incremental BLOB/TEXT I/O --- odb/sqlite/connection.hxx | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'odb/sqlite/connection.hxx') diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index 8e54388..f8378fb 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -34,6 +34,39 @@ namespace odb class connection; typedef details::shared_ptr connection_ptr; + // SQLite "active object", i.e., an object that needs to be + // "cleared" before the transaction can be committed and the + // connection release. These form a doubly-linked list. + // + class active_object + { + public: + // This function should remove the object from the list, since + // it shall no longer be "active". + // + virtual void + clear () = 0; + + protected: + active_object (connection& c): prev_ (0), next_ (this), conn_ (c) {} + + void + list_add (); + + void + list_remove (); + + protected: + // prev_ == 0 means we are the first element. + // next_ == 0 means we are the last element. + // next_ == this means we are not on the list (prev_ should be 0). + // + active_object* prev_; + active_object* next_; + + connection& conn_; + }; + class LIBODB_SQLITE_EXPORT connection: public odb::connection { public: @@ -165,12 +198,12 @@ namespace odb private: friend class transaction_impl; // invalidate_results() - // Linked list of active statements currently associated + // Linked list of active objects currently associated // with this connection. // private: - friend class statement; - statement* statements_; + friend class active_object; + active_object* active_objects_; }; } } -- cgit v1.1