summaryrefslogtreecommitdiff
path: root/libpqpp/pq-error.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-24 04:00:01 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-24 04:00:01 +0000
commitb177499d168936da9e64a964beb22f6057880703 (patch)
treec093da732b44e713af9fad35ff70539455cc355a /libpqpp/pq-error.cpp
parentUse parent glibmm (diff)
downloadlibdbpp-postgresql-b177499d168936da9e64a964beb22f6057880703.tar.bz2
libdbpp-postgresql-b177499d168936da9e64a964beb22f6057880703.tar.xz
libdbpp-postgresql-b177499d168936da9e64a964beb22f6057880703.zip
PostgreSQL files prefixed with pq-
Diffstat (limited to 'libpqpp/pq-error.cpp')
-rw-r--r--libpqpp/pq-error.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/libpqpp/pq-error.cpp b/libpqpp/pq-error.cpp
new file mode 100644
index 0000000..0d0299c
--- /dev/null
+++ b/libpqpp/pq-error.cpp
@@ -0,0 +1,34 @@
+#include "pq-error.h"
+#include <string.h>
+
+PQ::Error::Error() :
+ msg(NULL)
+{
+}
+
+PQ::Error::Error(const PQ::Error & e) :
+ msg(e.msg ? strdup(e.msg) : NULL)
+{
+}
+
+PQ::Error::Error(const char * e) :
+ msg(e ? strdup(e) : NULL)
+{
+}
+
+PQ::Error::~Error() throw()
+{
+ free(msg);
+}
+
+const char *
+PQ::Error::what() const throw()
+{
+ return msg ? msg : "No message";
+}
+
+PQ::ConnectionError::ConnectionError(const PGconn * conn) :
+ PQ::Error(PQerrorMessage(conn))
+{
+}
+