SOCI Logo Get SOCI at SourceForge.net. Fast, secure and Free Open Source software downloads

into-type.cpp

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
00003 // Distributed under the Boost Software License, Version 1.0.
00004 // (See accompanying file LICENSE_1_0.txt or copy at
00005 // http://www.boost.org/LICENSE_1_0.txt)
00006 //
00007 
00008 #define SOCI_SOURCE
00009 #include "into-type.h"
00010 #include "statement.h"
00011 
00012 using namespace soci;
00013 using namespace soci::details;
00014 
00015 standard_into_type::~standard_into_type()
00016 {
00017     delete backEnd_;
00018 }
00019 
00020 void standard_into_type::define(statement_impl & st, int & position)
00021 {
00022     backEnd_ = st.make_into_type_backend();
00023     backEnd_->define_by_pos(position, data_, type_);
00024 }
00025 
00026 void standard_into_type::pre_fetch()
00027 {
00028     backEnd_->pre_fetch();
00029 }
00030 
00031 void standard_into_type::post_fetch(bool gotData, bool calledFromFetch)
00032 {
00033     backEnd_->post_fetch(gotData, calledFromFetch, ind_);
00034 
00035     if (gotData)
00036     {
00037         convert_from_base();
00038     }
00039 }
00040 
00041 void standard_into_type::clean_up()
00042 {
00043     // backEnd_ might be NULL if IntoType<Row> was used
00044     if (backEnd_ != NULL)
00045     {
00046         backEnd_->clean_up();
00047     }
00048 }
00049 
00050 vector_into_type::~vector_into_type()
00051 {
00052     delete backEnd_;
00053 }
00054 
00055 void vector_into_type::define(statement_impl & st, int & position)
00056 {
00057     backEnd_ = st.make_vector_into_type_backend();
00058     backEnd_->define_by_pos(position, data_, type_);
00059 }
00060 
00061 void vector_into_type::pre_fetch()
00062 {
00063     backEnd_->pre_fetch();
00064 }
00065 
00066 void vector_into_type::post_fetch(bool gotData, bool /* calledFromFetch */)
00067 {
00068     if (indVec_ != NULL && indVec_->empty() == false)
00069     {
00070         assert(indVec_->empty() == false);
00071         backEnd_->post_fetch(gotData, &(*indVec_)[0]);
00072     }
00073     else
00074     {
00075         backEnd_->post_fetch(gotData, NULL);
00076     }
00077 
00078     if (gotData)
00079     {
00080         convert_from_base();
00081     }
00082 }
00083 
00084 void vector_into_type::resize(std::size_t sz)
00085 {
00086     if (indVec_ != NULL)
00087     {
00088         indVec_->resize(sz);
00089     }
00090 
00091     backEnd_->resize(sz);
00092 }
00093 
00094 std::size_t vector_into_type::size() const
00095 {
00096     return backEnd_->size();
00097 }
00098 
00099 void vector_into_type::clean_up()
00100 {
00101     if (backEnd_ != NULL)
00102     {
00103         backEnd_->clean_up();
00104     }
00105 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
SourceForge Logo

Generated on Sun Oct 3 2010 17:42:17 for EXTRAS-SOCI by Doxygen 1.7.1