Warning, file /sdk/codevis/thirdparty/soci/src/core/ref-counted-statement.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // 0002 // Copyright (C) 2004-2016 Maciej Sobczak, Stephen Hutton 0003 // Distributed under the Boost Software License, Version 1.0. 0004 // (See accompanying file LICENSE_1_0.txt or copy at 0005 // http://www.boost.org/LICENSE_1_0.txt) 0006 // 0007 0008 #define SOCI_SOURCE 0009 #include "soci/ref-counted-statement.h" 0010 #include "soci/session.h" 0011 0012 using namespace soci; 0013 using namespace soci::details; 0014 0015 namespace 0016 { 0017 0018 // Unfortunately we can't reuse details::auto_statement here because it works 0019 // with statement_backend and not statement that we use here, so just define a 0020 // similar class. 0021 class auto_statement_alloc 0022 { 0023 public: 0024 explicit auto_statement_alloc(statement& st) 0025 : st_(st) 0026 { 0027 st_.alloc(); 0028 } 0029 0030 ~auto_statement_alloc() 0031 { 0032 st_.clean_up(); 0033 } 0034 0035 private: 0036 statement& st_; 0037 0038 SOCI_NOT_COPYABLE(auto_statement_alloc) 0039 }; 0040 0041 } // anonymous namespace 0042 0043 ref_counted_statement_base::ref_counted_statement_base(session& s) 0044 : refCount_(1), session_(s), need_comma_(false) 0045 { 0046 } 0047 0048 void ref_counted_statement::final_action() 0049 { 0050 auto_statement_alloc auto_st_alloc(st_); 0051 0052 st_.prepare(session_.get_query(), st_one_time_query); 0053 st_.define_and_bind(); 0054 st_.execute(true); 0055 } 0056 0057 std::ostringstream& ref_counted_statement_base::get_query_stream() 0058 { 0059 return session_.get_query_stream(); 0060 }