// file : odb/connection.ixx // copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file #include // std::string #include namespace odb { inline connection:: connection (connection_factory& f) : factory_ (f), tracer_ (0), results_ (0), prepared_queries_ (0), transaction_tracer_ (0) { } inline connection::database_type& connection:: database () { return factory_.database (); } inline unsigned long long connection:: execute (const char* st) { return execute (st, std::strlen (st)); } inline unsigned long long connection:: execute (const std::string& st) { return execute (st.c_str (), st.size ()); } template inline prepared_query connection:: prepare_query (const char* n, const char* q) { return prepare_query (n, query (q)); } template inline prepared_query connection:: prepare_query (const char* n, const std::string& q) { return prepare_query (n, query (q)); } template inline prepared_query connection:: prepare_query (const char* n, const query& q) { return query_::call (*this, n, q); } template inline void connection:: cache_query (const prepared_query& pq) { assert (pq); cache_query_ (pq.impl_, typeid (T), 0, 0, 0); } #ifdef ODB_CXX11 template inline void connection:: cache_query (const prepared_query& pq, std::unique_ptr

params) { assert (pq); assert (params); cache_query_ ( pq.impl_, typeid (T), params.get (), &typeid (P), ¶ms_deleter

); params.release (); } #else template inline void connection:: cache_query (const prepared_query& pq, std::auto_ptr

params) { assert (pq); assert (params.get () != 0); cache_query_ ( pq.impl_, typeid (T), params.get (), &typeid (P), ¶ms_deleter

); params.release (); } #endif template inline prepared_query connection:: lookup_query (const char* name) const { return prepared_query (lookup_query_ (name, typeid (T), 0, 0)); } template inline prepared_query connection:: lookup_query (const char* name, P*& params) const { return prepared_query ( lookup_query_ (name, typeid (T), reinterpret_cast (¶ms), &typeid (P))); } inline void connection:: tracer (tracer_type& t) { tracer_ = &t; } inline void connection:: tracer (tracer_type* t) { tracer_ = t; } inline connection::tracer_type* connection:: tracer () const { return tracer_; } inline connection::tracer_type* connection:: transaction_tracer () const { return transaction_tracer_; } }