1 //
2 // Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 //
7 
8 #define SOCI_SOURCE
9 #include "soci/procedure.h"
10 #include "soci/statement.h"
11 #include "soci/prepare-temp-type.h"
12 
13 using namespace soci;
14 using namespace soci::details;
15 
procedure_impl(prepare_temp_type const & prep)16 procedure_impl::procedure_impl(prepare_temp_type const & prep)
17     : statement_impl(prep.get_prepare_info()->session_),
18     refCount_(1)
19 {
20     ref_counted_prepare_info * prepInfo = prep.get_prepare_info();
21 
22     // take all bind/define info
23     intos_.swap(prepInfo->intos_);
24     uses_.swap(prepInfo->uses_);
25 
26     // allocate handle
27     alloc();
28 
29     // prepare the statement
30     prepare(rewrite_for_procedure_call(prepInfo->get_query()));
31 
32     define_and_bind();
33 }
34