[odb-users] how to represent mysql timestamps?
Douglas Tomm
dctomm at gmail.com
Thu Aug 2 20:39:36 EDT 2012
what is the correct type to represent mysql timestamps? the convention
given in section 19.4.1 of the manual did not work for me. when i put
this in my class:
#pragma db type("timestamp") not_null column("created")
boost::posix_time::ptime m_created;
the following compiler messages appeared. what is the correct way to do
this? my environment is:
* odb 2.0.0
* gcc 4.1.2
* boost 1.46.1
* centos 5 linux
thank you,
doug
/usr/local/include/odb/mysql/traits.hxx: In static member function
'static void odb::mysql::default_value_traits<T, <anonymous>
>::set_image(typename odb::mysql::image_traits<ID>::image_type&, bool&,
T) [with T = boost::posix_time::ptime, odb::mysql::database_type_id ID =
id_timestamp]':
build/cpp/odb/MyTest-odb.cxx:294: instantiated from here
/usr/local/include/odb/mysql/traits.hxx:320: error: no matching function
for call to 'st_mysql_time::st_mysql_time(boost::posix_time::ptime&)'
/usr/include/mysql/mysql_time.h:48: note: candidates are:
st_mysql_time::st_mysql_time()
/usr/include/mysql/mysql_time.h:48: note:
st_mysql_time::st_mysql_time(const st_mysql_time&)
/usr/local/include/odb/mysql/traits.hxx: In static member function
'static void odb::mysql::default_value_traits<T, <anonymous>
>::set_value(T&, const typename
odb::mysql::image_traits<ID>::image_type&, bool) [with T =
boost::posix_time::ptime, odb::mysql::database_type_id ID = id_timestamp]':
build/cpp/odb/MyTest-odb.cxx:379: instantiated from here
/usr/local/include/odb/mysql/traits.hxx:311: error: no matching function
for call to 'boost::posix_time::ptime::ptime(const st_mysql_time&)'
/usr/include/boost/date_time/posix_time/ptime.hpp:53: note: candidates
are: boost::posix_time::ptime::ptime()
/usr/include/boost/date_time/posix_time/ptime.hpp:49: note:
boost::posix_time::ptime::ptime(boost::date_time::special_values)
/usr/include/boost/date_time/posix_time/ptime.hpp:45:
note: boost::posix_time::ptime::ptime(const
boost::date_time::counted_time_rep<boost::posix_time::millisec_posix_time_system_config>&)
/usr/include/boost/date_time/posix_time/ptime.hpp:42: note:
boost::posix_time::ptime::ptime(boost::gregorian::date)
/usr/include/boost/date_time/posix_time/ptime.hpp:39: note:
boost::posix_time::ptime::ptime(boost::gregorian::date,
boost::posix_time::time_duration)
/usr/include/boost/date_time/posix_time/ptime.hpp:32:
note: boost::posix_time::ptime::ptime(const
boost::posix_time::ptime&)
More information about the odb-users
mailing list