From 693759c14408c7607802888a5aed7b58d5c872b7 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Wed, 18 May 2011 16:50:19 +0200 Subject: Add binding structure --- odb/pgsql/binding.hxx | 67 +++++++++++++++++++++++++++++++++++++++++++++++ odb/pgsql/pgsql-types.hxx | 38 +++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 odb/pgsql/binding.hxx create mode 100644 odb/pgsql/pgsql-types.hxx diff --git a/odb/pgsql/binding.hxx b/odb/pgsql/binding.hxx new file mode 100644 index 0000000..d6c61a8 --- /dev/null +++ b/odb/pgsql/binding.hxx @@ -0,0 +1,67 @@ +// file : odb/pgsql/binding.hxx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_PGSQL_BINDING_HXX +#define ODB_PGSQL_BINDING_HXX + +#include + +#include // std::size_t + +#include +#include + +#include + +namespace odb +{ + namespace pgsql + { + class LIBODB_PGSQL_EXPORT native_binding + { + public: + + native_binding (const char* const* v, + const int* l, + const int* f, + std::size_t n) + : values (v), lengths (l), formats (f), count (n) + { + } + + const char* const* values; + const int* lengths; + const int* formats; + std::size_t count; + + private: + native_binding (const native_binding&); + native_binding& operator= (const native_binding&); + }; + + class LIBODB_PGSQL_EXPORT binding + { + public: + typedef pgsql::bind bind_type; + + binding (bind_type* b, std::size_t n) + : bind (b), count (n), version (0) + { + } + + bind_type* bind; + std::size_t count; + std::size_t version; + + private: + binding (const binding&); + binding& operator= (const binding&); + }; + } +} + +#include + +#endif // ODB_PGSQL_BINDING_HXX diff --git a/odb/pgsql/pgsql-types.hxx b/odb/pgsql/pgsql-types.hxx new file mode 100644 index 0000000..930eb2b --- /dev/null +++ b/odb/pgsql/pgsql-types.hxx @@ -0,0 +1,38 @@ +// file : odb/pgsql/pgsql-types.hxx +// author : Constantin Michael +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_PGSQL_PGSQL_TYPES_HXX +#define ODB_PGSQL_PGSQL_TYPES_HXX + +#include + +#include // std::size_t + +#include // Oid + +#include + +namespace odb +{ + namespace pgsql + { + // The libpq result binding. This data structures is + // modelled after MYSQL_BIND from MySQL. + // + struct bind + { + Oid type; + void* buffer; + std::size_t* size; + std::size_t capacity; + bool* is_null; + bool* truncated; + }; + } +} + +#include + +#endif // ODB_PGSQL_PGSQL_TYPES_HXX -- cgit v1.1