00001 #ifndef DVMYSQL_PROPS2SQL_H 00002 #define DVMYSQL_PROPS2SQL_H 00003 // $Id: props2sql.h,v 1.3 2008/03/18 19:55:40 dvermeir Exp $ 00004 00005 #include <dvutil/props.h> 00006 #include <dvmysql/sqldb.h> 00007 #include <dvmysql/object.h> 00008 00009 namespace Dv { 00010 namespace Sql { 00011 /** Fill an object with data from a Dv::Util::Props object, 00012 * where values from the latter are copied to the columns 00013 * with the same name as the corresponding key (of the value). 00014 * @param object pre-existing Dv::Sql::Object 00015 * @param props to copy 00016 * @return number of keys in @a props that do not correspond 00017 * to a column in @a object 00018 */ 00019 size_t 00020 props2object(Object& object, const Dv::Props& props) throw (std::runtime_error); 00021 00022 /** Insert a Dv::Util::Props object into a table, using the 00023 * key's as column names and the values as column values. 00024 * @param db of table to insert into 00025 * @param table_name of table to insert into 00026 * @param props object to insert 00027 * @return number of keys in @a props that do not correspond 00028 * to a column in @a object 00029 * @exception std::runtime_error if the actual insert failed 00030 */ 00031 size_t 00032 props_insert(Db& db, const std::string& table_name, const Dv::Props& props) 00033 throw (std::runtime_error); 00034 } 00035 } 00036 #endif
dvmysql-1.0.3 | [17 November, 2010] |