diff options
Diffstat (limited to 'odb/pgsql/database.cxx')
-rw-r--r-- | odb/pgsql/database.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/odb/pgsql/database.cxx b/odb/pgsql/database.cxx index 5c60957..09bf6f0 100644 --- a/odb/pgsql/database.cxx +++ b/odb/pgsql/database.cxx @@ -249,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], @@ -282,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 @@ -300,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], @@ -319,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++; |