[GRASS-SVN] r51961 - grass/trunk/db/drivers/postgres
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jun 3 11:23:31 PDT 2012
Author: martinl
Date: 2012-06-03 11:23:30 -0700 (Sun, 03 Jun 2012)
New Revision: 51961
Modified:
grass/trunk/db/drivers/postgres/db.c
Log:
db-pg driver: print notice message only on verbose level
Modified: grass/trunk/db/drivers/postgres/db.c
===================================================================
--- grass/trunk/db/drivers/postgres/db.c 2012-06-03 17:17:25 UTC (rev 51960)
+++ grass/trunk/db/drivers/postgres/db.c 2012-06-03 18:23:30 UTC (rev 51961)
@@ -18,6 +18,14 @@
#include "globals.h"
#include "proto.h"
+static void notice_processor(void *arg, const char *message)
+{
+ /* print notice messages only on verbose level */
+ if (G_verbose() > G_verbose_std()) {
+ fprintf(stderr, "%s", message);
+ }
+}
+
int db__driver_open_database(dbHandle * handle)
{
char buf[500];
@@ -64,10 +72,11 @@
return DB_FAILED;
}
- /* Set schema */
+ /* set schema */
schema = db_get_handle_dbschema(handle);
- /* Cannot use default schema because link to table can point to different database */
+ /* Cannot use default schema because link to table can point to
+ different database */
/*
if ( schema )
schema = connection.schemaName;
@@ -92,7 +101,7 @@
}
}
- /* Read internal codes */
+ /* read internal codes */
res = PQexec(pg_conn,
"select oid, typname from pg_type where typname in ( "
"'bit', 'int2', 'int4', 'int8', 'serial', 'oid', "
@@ -164,7 +173,10 @@
PQgetvalue(res, row, 1), type);
pg_types[row][1] = type;
}
-
+
+ /* print notice messages only on verbose level */
+ PQsetNoticeProcessor(pg_conn, notice_processor, NULL);
+
PQclear(res);
return DB_OK;
More information about the grass-commit
mailing list