aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/traits.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-09-21 19:55:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-09-21 19:55:14 +0200
commit35a280c5f8fa20e54bd56efd64fcdb9bd2f10dc4 (patch)
tree436c43a15fd99b85ff034b6c2106b6f2922a66fd /odb/mysql/traits.cxx
parent348efda0db31ca3a3ea0f7bf2eaa69985d3984b8 (diff)
Redesign value_traits
Diffstat (limited to 'odb/mysql/traits.cxx')
-rw-r--r--odb/mysql/traits.cxx48
1 files changed, 8 insertions, 40 deletions
diff --git a/odb/mysql/traits.cxx b/odb/mysql/traits.cxx
index f90cc0b..f701978 100644
--- a/odb/mysql/traits.cxx
+++ b/odb/mysql/traits.cxx
@@ -13,29 +13,14 @@ namespace odb
{
namespace mysql
{
+ using details::buffer;
+
//
- // value_traits<string>
+ // value_traits<string, buffer>
//
- void value_traits<string>::
- set_image (char* s,
- size_t c,
- size_t& n,
- bool& is_null,
- const string& v)
- {
- is_null = false;
- n = v.size ();
-
- if (n > c)
- n = c;
-
- if (n != 0)
- memcpy (s, v.c_str (), n);
- }
-
- void value_traits<string>::
- set_image (details::buffer& b,
+ void value_traits<string, buffer>::
+ set_image (buffer& b,
size_t& n,
bool& is_null,
const string& v)
@@ -51,28 +36,11 @@ namespace odb
}
//
- // value_traits<const char*>
+ // value_traits<const char*, buffer>
//
- void value_traits<const char*>::
- set_image (char* s,
- size_t c,
- size_t& n,
- bool& is_null,
- const char* v)
- {
- is_null = false;
- n = strlen (v);
-
- if (n > c)
- n = c;
-
- if (n != 0)
- memcpy (s, v, n);
- }
-
- void value_traits<const char*>::
- set_image (details::buffer& b,
+ void value_traits<const char*, buffer>::
+ set_image (buffer& b,
size_t& n,
bool& is_null,
const char* v)