[fdo-commits] r673 -
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Jan 22 21:04:35 EST 2007
Author: mloskot
Date: 2007-01-22 21:04:35 -0500 (Mon, 22 Jan 2007)
New Revision: 673
Added:
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.c
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.h
Log:
Added postgis_set_err_msg() function.
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.c
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.c 2007-01-23 02:02:40 UTC (rev 672)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.c 2007-01-23 02:04:35 UTC (rev 673)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006 Refractions Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser
+ * General Public License as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "stdafx.h"
+#include "set_err_msg.h"
+
+#include <string.h> /* memset(), strncpy() */
+#include <assert.h>
+
+int postgis_set_err_msg (
+ postgis_context_def *context,
+ const char* msg
+)
+{
+ int ret = RDBI_GENERIC_ERROR;
+
+ if (NULL != context && NULL != msg)
+ {
+ assert(strlen(msg) < RDBI_MSG_SIZE);
+
+ memset(context->postgis_last_err_msg, '\0', RDBI_MSG_SIZE);
+ strncpy(context->postgis_last_err_msg, msg, RDBI_MSG_SIZE);
+ context->postgis_last_err_msg[RDBI_MSG_SIZE - 1] = '\0';
+
+ ret = RDBI_SUCCESS;
+ }
+
+ return ret;
+}
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.h
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.h 2007-01-23 02:02:40 UTC (rev 672)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/Driver/set_err_msg.h 2007-01-23 02:04:35 UTC (rev 673)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Refractions Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of version 2.1 of the GNU Lesser
+ * General Public License as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef POSTGIS_SET_ERR_MSG_H
+#define POSTGIS_SET_ERR_MSG_H
+
+#include "local.h"
+
+/**
+ * Sets passed message as a last eror message for current context.
+ * This function is used internally by the PostGIS RDBI Driver only,
+ * it's not dispatched by the RDBI layer.
+ *
+ * @param context [out] - pointer to current PostGIS session context.
+ * The function updates passed context by setting last error message.
+ * @param msg [in] - string with message being assigned to the context.
+ * @return Returns an rdbi status code from Inc/rdbi.h.
+ */
+int postgis_set_err_msg (
+ postgis_context_def *context,
+ const char* msg);
+
+#endif /* POSTGIS_SET_ERR_MSG_H */
More information about the fdo-commits
mailing list