aboutsummaryrefslogtreecommitdiff
path: root/odb/oracle/statement.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-09 14:09:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-09 14:09:53 +0200
commit6ab5b0c382d66bc30724c04485c325d573858c0c (patch)
tree6f09f4e1c1f10e23108d75ad56700c45fff7b7a0 /odb/oracle/statement.hxx
parent1d664d31bdfc341ca642948efdf395e7922141f6 (diff)
Avoid copying statement text if it is statically allocated
Diffstat (limited to 'odb/oracle/statement.hxx')
-rw-r--r--odb/oracle/statement.hxx49
1 files changed, 42 insertions, 7 deletions
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx
index f3e86f0..8d97ab4 100644
--- a/odb/oracle/statement.hxx
+++ b/odb/oracle/statement.hxx
@@ -42,8 +42,14 @@ namespace odb
text () const;
protected:
- statement (connection&, const std::string& statement);
+ statement (connection&, const std::string& text);
+ statement (connection&, const char* text);
+ private:
+ void
+ init (const char* text, std::size_t text_size);
+
+ protected:
// Bind parameters for this statement. This function must only
// be called once. Multiple calls to it will result in memory
// leaks due to lost OCIBind resources.
@@ -87,7 +93,8 @@ namespace odb
virtual
~generic_statement ();
- generic_statement (connection&, const std::string& statement);
+ generic_statement (connection&, const std::string& text);
+ generic_statement (connection&, const char* text);
unsigned long long
execute ();
@@ -97,6 +104,10 @@ namespace odb
generic_statement& operator= (const generic_statement&);
private:
+ void
+ init ();
+
+ private:
ub2 stmt_type_;
bool bound_;
};
@@ -108,13 +119,24 @@ namespace odb
~select_statement ();
select_statement (connection& conn,
- const std::string& statement,
+ const std::string& text,
binding& param,
binding& result,
std::size_t lob_prefetch_size = 0);
select_statement (connection& conn,
- const std::string& statement,
+ const char* text,
+ binding& param,
+ binding& result,
+ std::size_t lob_prefetch_size = 0);
+
+ select_statement (connection& conn,
+ const std::string& text,
+ binding& result,
+ std::size_t lob_prefetch_size = 0);
+
+ select_statement (connection& conn,
+ const char* text,
binding& result,
std::size_t lob_prefetch_size = 0);
@@ -157,7 +179,12 @@ namespace odb
~insert_statement ();
insert_statement (connection& conn,
- const std::string& statement,
+ const std::string& text,
+ binding& param,
+ bool returning);
+
+ insert_statement (connection& conn,
+ const char* text,
binding& param,
bool returning);
@@ -192,6 +219,10 @@ namespace odb
};
private:
+ void
+ init (binding& param, bool returning);
+
+ private:
id_bind_type id_bind_;
};
@@ -202,9 +233,11 @@ namespace odb
~update_statement ();
update_statement (connection& conn,
- const std::string& statement,
+ const std::string& text,
binding& param);
+ update_statement (connection& conn, const char* text, binding& param);
+
unsigned long long
execute ();
@@ -220,9 +253,11 @@ namespace odb
~delete_statement ();
delete_statement (connection& conn,
- const std::string& statement,
+ const std::string& text,
binding& param);
+ delete_statement (connection& conn, const char* text, binding& param);
+
unsigned long long
execute ();