diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-09 05:52:43 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-09 05:52:43 +0000 |
commit | 71e3c7ee84ee3cf5bf5dfc6e29e1ce469fc605b4 (patch) | |
tree | 7df3813e307d48b13baab4e1518db4a5132b9129 /sca-cpp/trunk/components/sqldb/pgsql.hpp | |
parent | cf35ada83de3ec531817a35b0c4ca2ee8f95974e (diff) |
Add store test using the sqldb component. Add conninfo and table properties to sqldb component.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@932259 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/components/sqldb/pgsql.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sca-cpp/trunk/components/sqldb/pgsql.hpp b/sca-cpp/trunk/components/sqldb/pgsql.hpp index b6b2cab331..08e8a44123 100644 --- a/sca-cpp/trunk/components/sqldb/pgsql.hpp +++ b/sca-cpp/trunk/components/sqldb/pgsql.hpp @@ -162,8 +162,19 @@ const failable<bool> put(const value& key, const value& val, const PGSql& pgsql) PGresult* r = PQexecPrepared(pgsql.conn, "put", 2, params, NULL, NULL, 0); if (PQresultStatus(r) != PGRES_COMMAND_OK) return mkfailure<bool>(string("Could not execute put SQL statement: ") + pgfailure(r)); + const string t = PQcmdTuples(r); + if (t != "0") { + PQclear(r); + debug(true, "pgsql::put::result"); + return true; + } PQclear(r); + PGresult* pr = PQexecPrepared(pgsql.conn, "post", 2, params, NULL, NULL, 0); + if (PQresultStatus(pr) != PGRES_COMMAND_OK) + return mkfailure<bool>(string("Could not execute post SQL statement: ") + pgfailure(pr)); + PQclear(pr); + debug(true, "pgsql::put::result"); return true; } |