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

values.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 "values.h"
00010 #include "row.h"
00011 
00012 #include <cstddef>
00013 #include <map>
00014 #include <sstream>
00015 #include <string>
00016 
00017 using namespace soci;
00018 using namespace soci::details;
00019 
00020 indicator values::get_indicator(std::size_t pos) const
00021 {
00022     if (row_)
00023     {
00024         return row_->get_indicator(pos);
00025     }
00026     else
00027     {
00028         return *indicators_[pos];
00029     }
00030 }
00031 
00032 indicator values::get_indicator(std::string const& name) const
00033 {
00034     if (row_)
00035     {
00036         return row_->get_indicator(name);
00037     }
00038     else
00039     {
00040         std::map<std::string, std::size_t>::const_iterator it = index_.find(name);
00041         if (it == index_.end())
00042         {
00043             std::ostringstream msg;
00044             msg << "Column '" << name << "' not found";
00045             throw soci_error(msg.str());
00046         }
00047         return *indicators_[it->second];
00048     }
00049 }
00050 
00051 column_properties const& values::get_properties(std::size_t pos) const
00052 {
00053     if (row_)
00054     {
00055         return row_->get_properties(pos);
00056     }
00057 
00058     throw soci_error("Rowset is empty");
00059 }
00060 
00061 column_properties const& values::get_properties(std::string const& name) const
00062 {
00063     if (row_)
00064     {
00065         return row_->get_properties(name);
00066     }
00067 
00068     throw soci_error("Rowset is empty");
00069 }
 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