aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/statement.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite/statement.hxx')
-rw-r--r--odb/sqlite/statement.hxx68
1 files changed, 28 insertions, 40 deletions
diff --git a/odb/sqlite/statement.hxx b/odb/sqlite/statement.hxx
index 1be0cab..7344daf 100644
--- a/odb/sqlite/statement.hxx
+++ b/odb/sqlite/statement.hxx
@@ -30,7 +30,8 @@ namespace odb
{
class connection;
- class LIBODB_SQLITE_EXPORT statement: public odb::statement
+ class LIBODB_SQLITE_EXPORT statement: public odb::statement,
+ public active_object
{
public:
typedef sqlite::connection connection_type;
@@ -72,7 +73,7 @@ namespace odb
statement_kind sk,
const binding* process,
bool optimize)
- : conn_ (conn)
+ : active_object (conn)
{
init (text.c_str (), text.size (), sk, process, optimize);
}
@@ -82,7 +83,7 @@ namespace odb
statement_kind sk,
const binding* process,
bool optimize)
- : conn_ (conn)
+ : active_object (conn)
{
init (text, std::strlen (text), sk, process, optimize);
}
@@ -93,13 +94,15 @@ namespace odb
statement_kind sk,
const binding* process,
bool optimize)
- : conn_ (conn)
+ : active_object (conn)
{
init (text, text_size, sk, process, optimize);
}
protected:
- void
+ // Return true if we bound any stream parameters.
+ //
+ bool
bind_param (const bind*, std::size_t count);
// Extract row columns into the bound buffers. If the truncated
@@ -110,6 +113,21 @@ namespace odb
bool
bind_result (const bind*, std::size_t count, bool truncated = false);
+ // Stream (so to speak) parameters.
+ //
+ struct stream_data
+ {
+ std::string db;
+ std::string table;
+ long long rowid;
+ };
+
+ void
+ stream_param (const bind*, std::size_t count, const stream_data&);
+
+ friend void
+ update_hook (void*, const char*, const char*, long long);
+
// Active state.
//
protected:
@@ -146,10 +164,12 @@ namespace odb
return r;
}
- protected:
- friend class sqlite::connection;
+ // The active_object interface.
+ //
+ virtual void
+ clear ();
- connection_type& conn_;
+ protected:
auto_handle<sqlite3_stmt> stmt_;
#if SQLITE_VERSION_NUMBER < 3005003
@@ -165,38 +185,6 @@ namespace odb
statement_kind,
const binding* process,
bool optimize);
-
- // Doubly-linked list of active statements.
- //
- protected:
- void
- list_add ()
- {
- next_ = conn_.statements_;
- conn_.statements_ = this;
-
- if (next_ != 0)
- next_->prev_ = this;
- }
-
- void
- list_remove ()
- {
- (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.
- // next_ == 0 means we are the last element.
- // next_ == this means we are not on the list (prev_ should be 0).
- //
- statement* prev_;
- statement* next_;
};
class LIBODB_SQLITE_EXPORT generic_statement: public statement