aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-05-18 16:50:19 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-05-18 16:52:12 +0200
commit693759c14408c7607802888a5aed7b58d5c872b7 (patch)
tree6cdfb993a02efe6328aa46f5161361926753d7de /odb/pgsql
parent2162b1fa3fc74baef93ef1ddbb6ba7d9d40ab511 (diff)
Add binding structure
Diffstat (limited to 'odb/pgsql')
-rw-r--r--odb/pgsql/binding.hxx67
-rw-r--r--odb/pgsql/pgsql-types.hxx38
2 files changed, 105 insertions, 0 deletions
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 <constantin@codesynthesis.com>
+// 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 <odb/pre.hxx>
+
+#include <cstddef> // std::size_t
+
+#include <odb/pgsql/version.hxx>
+#include <odb/pgsql/pgsql-types.hxx>
+
+#include <odb/pgsql/details/export.hxx>
+
+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 <odb/post.hxx>
+
+#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 <constantin@codesynthesis.com>
+// 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 <odb/pre.hxx>
+
+#include <cstddef> // std::size_t
+
+#include <libpq-fe.h> // Oid
+
+#include <odb/pgsql/pgsql-oid.hxx>
+
+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 <odb/post.hxx>
+
+#endif // ODB_PGSQL_PGSQL_TYPES_HXX