diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-09-08 08:35:47 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-09-08 08:35:47 +0200 |
commit | a3eb3fedc5478b28a813b689daca88fc2ac6e50a (patch) | |
tree | e0c6c4632d3422ad41222f783074be044db24fab | |
parent | 7823ebdaa6cc9772d1410e6e398ba36501a55f62 (diff) |
Add bind array offset argument to statement::bind_param
This allows for specification of non-contiguous bind arrays
in multiple calls to bind_param for the same statement.
-rw-r--r-- | odb/oracle/statement.cxx | 13 | ||||
-rw-r--r-- | odb/oracle/statement.hxx | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx index a88aa06..ebdbced 100644 --- a/odb/oracle/statement.cxx +++ b/odb/oracle/statement.cxx @@ -48,7 +48,7 @@ namespace odb } void statement:: - bind_param (bind* b, size_t c) + bind_param (bind* b, size_t c, size_t o) { for (size_t i (0); i < c; ++i) { @@ -57,7 +57,7 @@ namespace odb sword r (OCIBindByPos (stmt_, &h, conn_.error_handle (), - i, + o + i, b[i].buffer, b[i].capacity, b[i].type, @@ -120,7 +120,7 @@ namespace odb end_ (false), rows_ (0) { - bind_param (cond.bind, cond.count); + bind_param (cond.bind, cond.count, 0); bind_result (data.bind, data.count); } @@ -263,7 +263,7 @@ namespace odb bool returning) : statement (conn, s) { - bind_param (data.bind, data.count); + bind_param (data.bind, data.count, 0); if (returning) { @@ -357,7 +357,8 @@ namespace odb binding& data) : statement (conn, s) { - bind_param (data.bind, cond.count + data.count); + bind_param (data.bind, data.count, 0); + bind_param (cond.bind, cond.count, data.count); } void update_statement:: @@ -409,7 +410,7 @@ namespace odb binding& cond) : statement (conn, s) { - bind_param (cond.bind, cond.count); + bind_param (cond.bind, cond.count, 0); } unsigned long long delete_statement:: diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx index d59f3a6..cbdb2ce 100644 --- a/odb/oracle/statement.hxx +++ b/odb/oracle/statement.hxx @@ -41,7 +41,7 @@ namespace odb // due to lost OCIBind resources. // void - bind_param (bind*, std::size_t count); + bind_param (bind*, std::size_t count, std::size_t offset); // Bind input parameters to this statement. This function must // only be called once. Multiple calls to it will result in memory leaks @@ -143,8 +143,6 @@ namespace odb virtual ~update_statement (); - // Asssumes that cond.bind is a suffix of data.bind. - // update_statement (connection& conn, const std::string& statement, binding& cond, |