aboutsummaryrefslogtreecommitdiff
path: root/pgsql/types
diff options
context:
space:
mode:
Diffstat (limited to 'pgsql/types')
-rw-r--r--pgsql/types/driver.cxx3
-rw-r--r--pgsql/types/test.hxx3
-rw-r--r--pgsql/types/traits.hxx39
3 files changed, 4 insertions, 41 deletions
diff --git a/pgsql/types/driver.cxx b/pgsql/types/driver.cxx
index 745d2ee..d6d675c 100644
--- a/pgsql/types/driver.cxx
+++ b/pgsql/types/driver.cxx
@@ -51,8 +51,7 @@ main (int argc, char* argv[])
o.varchar_ = medium_str;
o.text_ = long_str;
- buffer long_buf (long_str.c_str (), long_str.size ());
- o.bytea_ = long_buf;
+ o.bytea_.assign (long_str.c_str (), long_str.c_str () + long_str.size ());
unsigned char varbit_buf[8] = {1, 3, 1, 3, 1, 3, 1, 3};
o.varbit_.size = 52;
diff --git a/pgsql/types/test.hxx b/pgsql/types/test.hxx
index 48c30ee..500887a 100644
--- a/pgsql/types/test.hxx
+++ b/pgsql/types/test.hxx
@@ -8,6 +8,7 @@
#include <set>
#include <string>
+#include <vector>
#include <memory> // std::auto_ptr
#include <cstring> // std::memcmp
#include <cstddef> // std::size_t
@@ -139,7 +140,7 @@ struct object
std::string text_;
#pragma db type ("BYTEA")
- buffer bytea_;
+ std::vector<char> bytea_;
#pragma db type ("VARBIT(1024)")
varbit varbit_;
diff --git a/pgsql/types/traits.hxx b/pgsql/types/traits.hxx
index b3aec70..9852727 100644
--- a/pgsql/types/traits.hxx
+++ b/pgsql/types/traits.hxx
@@ -12,49 +12,12 @@
#include <odb/pgsql/traits.hxx>
#include <odb/pgsql/details/endian-traits.hxx>
-#include "test.hxx" // varbit, buffer, ubuffer, string_ptr
+#include "test.hxx" // varbit, ubuffer, string_ptr
namespace odb
{
namespace pgsql
{
- template <>
- class value_traits<buffer, id_bytea>
- {
- public:
- typedef buffer value_type;
- typedef buffer query_type;
- typedef details::buffer image_type;
-
- static void
- set_value (buffer& v,
- const details::buffer& b,
- std::size_t n,
- bool is_null)
- {
- if (!is_null)
- v.assign (b.data (), n);
- else
- v.assign (0, 0);
- }
-
- static void
- set_image (details::buffer& b,
- std::size_t& n,
- bool& is_null,
- const buffer& v)
- {
- is_null = false;
- n = v.size ();
-
- if (n > b.capacity ())
- b.capacity (n);
-
- if (n != 0)
- std::memcpy (b.data (), v.data (), n);
- }
- };
-
// The first 4 bytes of the image is a signed int specifying the
// number of significant bits contained by the BIT. The following
// bytes contain the bit data.