diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-28 09:45:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-07-28 09:45:36 +0200 |
commit | ab1487672afb5180bd17c9d26b35196bd06f6cda (patch) | |
tree | 51cc25e1b88cb0abc325a822f57845a98a22cb8a /mysql/types/driver.cxx | |
parent | a461f6d8bc6c314249057ad48fa8dd1cea1d8b40 (diff) |
Add value_traits specializations for std::vector<char>
This allows using it as a buffer for BLOB mapping.
Diffstat (limited to 'mysql/types/driver.cxx')
-rw-r--r-- | mysql/types/driver.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mysql/types/driver.cxx b/mysql/types/driver.cxx index 6625adf..f397084 100644 --- a/mysql/types/driver.cxx +++ b/mysql/types/driver.cxx @@ -54,24 +54,25 @@ main (int argc, char* argv[]) o.year_ = 2010; string short_str (128, 's'); - buffer short_buf (short_str.c_str (), short_str.size ()); string medium_str (250, 'm'); - buffer medium_buf (medium_str.c_str (), medium_str.size ()); string long_str (2040, 'l'); - buffer long_buf (long_str.c_str (), long_str.size ()); + + const char* sb (short_str.c_str ()), *se (sb + short_str.size ()); + const char* mb (medium_str.c_str ()), *me (mb + medium_str.size ()); + const char* lb (long_str.c_str ()), *le (lb + long_str.size ()); o.char_ = short_str; - o.binary_ = short_buf; + o.binary_.assign (sb, se); o.varchar_ = medium_str; - o.varbinary_ = medium_buf; + o.varbinary_.assign (mb, me); o.tinytext_ = short_str; - o.tinyblob_ = short_buf; + o.tinyblob_.assign (sb, se); o.text_ = long_str; - o.blob_ = long_buf; + o.blob_.assign (lb, le); o.mediumtext_ = long_str; - o.mediumblob_ = long_buf; + o.mediumblob_.assign (lb, le); o.longtext_ = long_str; - o.longblob_ = long_buf; + o.longblob_.assign (lb, le); o.bit_.a = 1; o.bit_.b = 0; |