Go to the documentation of this file.00001 #include "Statement.h"
00002
00003 namespace psql
00004 {
00005
00006 template<>
00007 PGresult* execBT<BindTypes<> >(PGconn* conn, PGparam*, std::string const& sql)
00008 {
00009 auto res = PQexec(conn, sql.c_str());
00010 if (res == NULL
00011 || PQresultStatus(res) == PGRES_BAD_RESPONSE
00012 || PQresultStatus(res) == PGRES_FATAL_ERROR)
00013 throw PgSqlException("Error executing statement: " + std::string(PQerrorMessage(conn)));
00014 return res;
00015 }
00016
00017 template<>
00018 PGresult* execPrepBT<BindTypes<> >(PGconn* conn, PGparam*, std::string const& name)
00019 {
00020 auto res = PQexecPrepared(conn, name.c_str(), 0, NULL, NULL, NULL, 1);
00021 if (res == NULL
00022 || PQresultStatus(res) == PGRES_BAD_RESPONSE
00023 || PQresultStatus(res) == PGRES_FATAL_ERROR)
00024 throw PgSqlException("Error executing statement: " + std::string(PQerrorMessage(conn)));
00025 return res;
00026 }
00027
00028 }