aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/database.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/pgsql/database.cxx')
-rw-r--r--odb/pgsql/database.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/odb/pgsql/database.cxx b/odb/pgsql/database.cxx
index 8c4c99f..09bf6f0 100644
--- a/odb/pgsql/database.cxx
+++ b/odb/pgsql/database.cxx
@@ -1,5 +1,4 @@
// file : odb/pgsql/database.cxx
-// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#include <cstring> // strlen()
@@ -250,10 +249,11 @@ namespace odb
// Bind parameters and results.
//
+ char* pbuf[1] = {const_cast<char*> (name.c_str ())};
size_t psize[1] = {name.size ()};
bool pnull[1] = {false};
bind pbind[1] = {{bind::text,
- const_cast<char*> (name.c_str ()),
+ &pbuf[0],
&psize[0],
psize[0],
&pnull[0],
@@ -283,7 +283,9 @@ namespace odb
cp = factory_->connect ();
pgsql::connection& c (
- cp != 0 ? *cp : transaction::current ().connection ());
+ cp != 0
+ ? *cp
+ : transaction::current ().connection (const_cast<database&> (*this)));
// If we are in the user's transaction then things are complicated. When
// we try to execute SELECT on a non-existent table, PG "poisons" the
@@ -301,10 +303,11 @@ namespace odb
bool exists (true);
if (cp == 0 && c.server_version () >= 90400)
{
+ char* pbuf[1] = {const_cast<char*> (table)};
size_t psize[1] = {strlen (table)};
bool pnull[1] = {false};
bind pbind[1] = {{bind::text,
- const_cast<char*> (table),
+ &pbuf[0],
&psize[0],
psize[0],
&pnull[0],
@@ -320,7 +323,7 @@ namespace odb
native_binding nparam (values, lengths, formats, 1);
bool rnull[1];
- bind rbind[1] = {{bind::boolean_, &exists, 0, 0, &rnull[1], 0}};
+ bind rbind[1] = {{bind::boolean_, &exists, 0, 0, &rnull[0], 0}};
binding result (rbind, 1);
result.version++;