aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib/error.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2003-02-13 13:11:52 +0000
committerMichael Meskes <meskes@postgresql.org>2003-02-13 13:11:52 +0000
commit1a9b0613c1b5af012735a81c07dc1e9dd97af945 (patch)
tree6494a531b6ff7ec1d8801316d8ee14225dfe0394 /src/interfaces/ecpg/lib/error.c
parente529e9fa4449d77127639b073aa2eed386e367b3 (diff)
downloadpostgresql-1a9b0613c1b5af012735a81c07dc1e9dd97af945.tar.gz
postgresql-1a9b0613c1b5af012735a81c07dc1e9dd97af945.zip
- Applied error reporting patch by Matthew Vanecek
- Started with an Informix compatibility option.
Diffstat (limited to 'src/interfaces/ecpg/lib/error.c')
-rw-r--r--src/interfaces/ecpg/lib/error.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/lib/error.c b/src/interfaces/ecpg/lib/error.c
index 526634a0f6e..d58f6767afe 100644
--- a/src/interfaces/ecpg/lib/error.c
+++ b/src/interfaces/ecpg/lib/error.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.16 2002/09/04 20:31:46 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.17 2003/02/13 13:11:52 meskes Exp $ */
#include "postgres_fe.h"
@@ -10,6 +10,10 @@
#include "extern.h"
#include "sqlca.h"
+/* This should hold the back-end error message from
+ * the last back-end operation. */
+char *ECPGerr;
+
void
ECPGraise(int line, int code, const char *str)
{
@@ -162,6 +166,29 @@ ECPGraise(int line, int code, const char *str)
ECPGfree_auto_mem();
}
+/* Set the error message string from the backend */
+void
+set_backend_err(const char *err, int lineno)
+{
+ if (ECPGerr)
+ ECPGfree(ECPGerr);
+
+ if (!err)
+ {
+ ECPGerr = NULL;
+ return;
+ }
+
+ ECPGerr = ECPGstrdup(err, lineno);
+}
+
+/* Retrieve the error message from the backend. */
+char *
+ECPGerrmsg(void)
+{
+ return ECPGerr;
+}
+
/* print out an error message */
void
sqlprint(void)