From 1692b3e82521e7d73a908f532eced90491e1eded Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 30 Aug 2010 15:51:23 +0200 Subject: Support for automake and VC++ builds --- odb/mysql/traits.hxx | 78 ++++++++++++++++++---------------------------------- 1 file changed, 26 insertions(+), 52 deletions(-) (limited to 'odb/mysql/traits.hxx') diff --git a/odb/mysql/traits.hxx b/odb/mysql/traits.hxx index b415bd1..bf52d78 100644 --- a/odb/mysql/traits.hxx +++ b/odb/mysql/traits.hxx @@ -6,11 +6,21 @@ #ifndef ODB_MYSQL_TRAITS_HXX #define ODB_MYSQL_TRAITS_HXX -#include // MYSQL_TIME, used in custom specializations. +#include + +#include + +#ifdef LIBODB_MYSQL_INCLUDE_SHORT +# ifdef _WIN32 +# include +# endif +# include // MYSQL_TIME, used in custom specializations. +#else +# include +#endif #include #include // std::size_t -#include // std::memcpy, std::strlen #include @@ -18,6 +28,8 @@ #include +#include + namespace odb { namespace mysql @@ -175,7 +187,7 @@ namespace odb // String type. // template <> - class value_traits + class LIBODB_MYSQL_EXPORT value_traits { public: typedef std::string type; @@ -192,37 +204,17 @@ namespace odb } static void - set_image (char* s, + set_image (char*, std::size_t c, std::size_t& n, bool& is_null, - const std::string& v) - { - is_null = false; - n = v.size (); - - if (n > c) - n = c; - - if (n != 0) - std::memcpy (s, v.c_str (), n); - } + const std::string&); static void - set_image (details::buffer& b, + set_image (details::buffer&, std::size_t& n, bool& is_null, - const std::string& v) - { - is_null = false; - n = v.size (); - - if (n > b.capacity ()) - b.capacity (n); - - if (n != 0) - std::memcpy (b.data (), v.c_str (), n); - } + const std::string&); }; // Specialization for const char* which only supports initialization @@ -230,7 +222,7 @@ namespace odb // we can pass such values to the queries. // template <> - class value_traits + class LIBODB_MYSQL_EXPORT value_traits { public: typedef const char* type; @@ -238,39 +230,21 @@ namespace odb static const image_id_type image_id = id_string; static void - set_image (char* s, + set_image (char*, std::size_t c, std::size_t& n, bool& is_null, - const char* v) - { - is_null = false; - n = std::strlen (v); - - if (n > c) - n = c; - - if (n != 0) - std::memcpy (s, v, n); - } + const char*); static void - set_image (details::buffer& b, + set_image (details::buffer&, std::size_t& n, bool& is_null, - const char* v) - { - is_null = false; - n = std::strlen (v); - - if (n > b.capacity ()) - b.capacity (n); - - if (n != 0) - std::memcpy (b.data (), v, n); - } + const char*); }; } } +#include + #endif // ODB_MYSQL_TRAITS_HXX -- cgit v1.1