aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/statement.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-15 13:17:30 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-19 11:40:30 +0200
commit8112bd0febcfa1e3a76e0d03363facbefc3822f7 (patch)
tree0f5a05b9b29ae7d77e95f7831c214b385aaf6a3b /odb/sqlite/statement.hxx
parentd94948b8bccfd8748245726487d54c41bb199baf (diff)
Implement early connection release
Diffstat (limited to 'odb/sqlite/statement.hxx')
-rw-r--r--odb/sqlite/statement.hxx61
1 files changed, 18 insertions, 43 deletions
diff --git a/odb/sqlite/statement.hxx b/odb/sqlite/statement.hxx
index 92b9c7c..aabb57d 100644
--- a/odb/sqlite/statement.hxx
+++ b/odb/sqlite/statement.hxx
@@ -53,12 +53,6 @@ namespace odb
return conn_;
}
- public:
- using odb::statement::cached;
-
- virtual void
- cached (bool);
-
protected:
statement (connection_type& conn, const std::string& text)
: conn_ (conn)
@@ -118,22 +112,12 @@ namespace odb
{
if (active_)
{
- if (stmt_ != 0)
- sqlite3_reset (stmt_);
-
- if (cached_)
- list_remove ();
-
+ sqlite3_reset (stmt_);
+ list_remove ();
active_ = false;
}
}
- // Cached state (protected part).
- //
- protected:
- void
- finilize ();
-
protected:
friend class sqlite::connection;
@@ -146,38 +130,29 @@ namespace odb
void
init (const char* text, std::size_t text_size);
- // Doubly-linked list of active/uncached statements.
+ // Doubly-linked list of active statements.
//
private:
- void list_add ()
+ void
+ list_add ()
{
- if (next_ == this)
- {
- next_ = conn_.statements_;
- conn_.statements_ = this;
+ next_ = conn_.statements_;
+ conn_.statements_ = this;
- if (next_ != 0)
- next_->prev_ = this;
- }
+ if (next_ != 0)
+ next_->prev_ = this;
}
- void list_remove ()
+ void
+ list_remove ()
{
- if (next_ != this)
- {
- if (prev_ == 0)
- conn_.statements_ = next_;
- else
- {
- prev_->next_ = next_;
- }
-
- if (next_ != 0)
- next_->prev_ = prev_;
-
- prev_ = 0;
- next_ = this;
- }
+ (prev_ == 0 ? conn_.statements_ : prev_->next_) = next_;
+
+ if (next_ != 0)
+ next_->prev_ = prev_;
+
+ prev_ = 0;
+ next_ = this;
}
// prev_ == 0 means we are the first element.