[GRASS-SVN] r50381 - grass/trunk/db/drivers/postgres
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 22 14:11:46 EST 2012
Author: martinl
Date: 2012-01-22 11:11:46 -0800 (Sun, 22 Jan 2012)
New Revision: 50381
Modified:
grass/trunk/db/drivers/postgres/create_table.c
grass/trunk/db/drivers/postgres/cursor.c
grass/trunk/db/drivers/postgres/db.c
grass/trunk/db/drivers/postgres/describe.c
grass/trunk/db/drivers/postgres/error.c
grass/trunk/db/drivers/postgres/execute.c
grass/trunk/db/drivers/postgres/fetch.c
grass/trunk/db/drivers/postgres/globals.h
grass/trunk/db/drivers/postgres/index.c
grass/trunk/db/drivers/postgres/listdb.c
grass/trunk/db/drivers/postgres/listtab.c
grass/trunk/db/drivers/postgres/parse.c
grass/trunk/db/drivers/postgres/priv.c
grass/trunk/db/drivers/postgres/select.c
Log:
pg driver: i18n and some cosmetics
Modified: grass/trunk/db/drivers/postgres/create_table.c
===================================================================
--- grass/trunk/db/drivers/postgres/create_table.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/create_table.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,4 +1,16 @@
+/*!
+ \file db/driver/postgres/create_table.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - create table
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
+
#include <grass/dbmi.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
@@ -77,7 +89,7 @@
break;
default:
- G_warning("Unknown column type (%s)", colname);
+ G_warning(_("Unknown column type (%s)"), colname);
return DB_FAILED;
}
}
@@ -89,7 +101,7 @@
res = PQexec(pg_conn, db_get_string(&sql));
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
- append_error("Cannot create table:\n");
+ append_error(_("Unable to create table:\n"));
append_error(db_get_string(&sql));
append_error("\n");
append_error(PQerrorMessage(pg_conn));
@@ -118,7 +130,7 @@
res = PQexec(pg_conn, db_get_string(&sql));
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
- append_error("Cannot grant select on table:\n");
+ append_error(_("Unable to grant select on table:\n"));
append_error(db_get_string(&sql));
append_error("\n");
append_error(PQerrorMessage(pg_conn));
Modified: grass/trunk/db/drivers/postgres/cursor.c
===================================================================
--- grass/trunk/db/drivers/postgres/cursor.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/cursor.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,6 +1,17 @@
+/*!
+ \file db/driver/postgres/cursor.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - cursor manipulation
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
#include <stdio.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
@@ -29,7 +40,7 @@
/* allocate the cursor */
c = (cursor *) db_malloc(sizeof(cursor));
if (c == NULL) {
- append_error("Cannot allocate cursor.");
+ append_error(_("Unable allocate cursor."));
return NULL;
}
@@ -38,7 +49,7 @@
/* tokenize it */
c->token = db_new_token(c);
if (c->token < 0) {
- append_error("Cannot ad new token.");
+ append_error(_("Unable to add new token."));
return NULL;
}
Modified: grass/trunk/db/drivers/postgres/db.c
===================================================================
--- grass/trunk/db/drivers/postgres/db.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/db.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,3 +1,14 @@
+/*!
+ \file db/driver/postgres/db.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - open/close database.
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
+
#include <stdlib.h>
#include <string.h>
#include <grass/dbmi.h>
@@ -2,2 +13,4 @@
#include <grass/gis.h>
+#include <grass/glocale.h>
+
#include "globals.h"
@@ -23,7 +36,7 @@
name = connection.databaseName;
G_debug(3,
- "db_driver_open_database() driver=pg database definition = '%s'",
+ "db_driver_open_database(): driver=pg database definition = '%s'",
name);
if (parse_conn(name, &pgconn) == DB_FAILED) {
@@ -32,19 +45,19 @@
}
G_debug(3,
- "host = %s, port = %s, options = %s, tty = %s, dbname = %s, user = %s, password = %s, "
+ "db_driver_open_database(): host = %s, port = %s, options = %s, tty = %s, "
+ "dbname = %s, user = %s, password = %s, "
"schema = %s", pgconn.host, pgconn.port, pgconn.options,
pgconn.tty, pgconn.dbname, pgconn.user, pgconn.password,
pgconn.schema);
db_get_login("pg", name, &user, &password);
- pg_conn =
- PQsetdbLogin(pgconn.host, pgconn.port, pgconn.options, pgconn.tty,
- pgconn.dbname, user, password);
-
+ pg_conn = PQsetdbLogin(pgconn.host, pgconn.port, pgconn.options, pgconn.tty,
+ pgconn.dbname, user, password);
+
if (PQstatus(pg_conn) == CONNECTION_BAD) {
- append_error("Cannot connect to Postgres: ");
+ append_error(_("Unable to connect to Postgres: "));
append_error(PQerrorMessage(pg_conn));
report_error();
PQfinish(pg_conn);
@@ -58,18 +71,19 @@
/*
if ( schema )
schema = connection.schemaName;
- */
+ */
if (pgconn.schema) {
schema = pgconn.schema;
}
+ /* set path to the schema */
if (schema && strlen(schema) > 0) {
sprintf(buf, "set search_path to %s", schema);
res = PQexec(pg_conn, buf);
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
- append_error("Cannot set schema: ");
+ append_error(_("Unable to set schema: "));
append_error(schema);
report_error();
PQclear(res);
@@ -78,17 +92,16 @@
}
/* Read internal codes */
- res =
- PQexec(pg_conn,
- "select oid, typname from pg_type where typname in ( "
- "'bit', 'int2', 'int4', 'int8', 'serial', 'oid', "
- "'float4', 'float8', 'numeric', "
- "'char', 'bpchar', 'varchar', 'text', "
- "'time', 'date', 'timestamp', "
- "'bool', 'geometry' ) order by oid");
-
+ res = PQexec(pg_conn,
+ "select oid, typname from pg_type where typname in ( "
+ "'bit', 'int2', 'int4', 'int8', 'serial', 'oid', "
+ "'float4', 'float8', 'numeric', "
+ "'char', 'bpchar', 'varchar', 'text', "
+ "'time', 'date', 'timestamp', "
+ "'bool', 'geometry' ) order by oid");
+
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
- append_error("Cannot select data types");
+ append_error(_("Unable to select data types"));
report_error();
PQclear(res);
return DB_FAILED;
@@ -143,7 +156,7 @@
else
type = PG_TYPE_UNKNOWN;
- G_debug(3, "pgtype = %d, \tname = %s -> \ttype = %d", pgtype,
+ G_debug(3, "db_driver_open_database(): pgtype = %d, name = %s -> type = %d", pgtype,
PQgetvalue(res, row, 1), type);
pg_types[row][1] = type;
}
Modified: grass/trunk/db/drivers/postgres/describe.c
===================================================================
--- grass/trunk/db/drivers/postgres/describe.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/describe.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,8 +1,18 @@
+/*!
+ \file db/driver/postgres/cursor.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - describe table
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
#include <grass/dbmi.h>
#include <grass/datetime.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
-#include <grass/glocale.h>
int db__driver_describe_table(dbString * table_name, dbTable ** table)
{
@@ -27,7 +37,7 @@
}
if (describe_table(res, table, NULL) == DB_FAILED) {
- append_error("Cannot describe table\n");
+ append_error(_("Unable to describe table\n"));
report_error();
PQclear(res);
return DB_FAILED;
Modified: grass/trunk/db/drivers/postgres/error.c
===================================================================
--- grass/trunk/db/drivers/postgres/error.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/error.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,6 +1,19 @@
+/*!
+ \file db/driver/postgres/error.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - report errors
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+*/
+
#include <stdio.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
+#include <grass/glocale.h>
+
#include "globals.h"
/* init error message */
@@ -11,7 +24,7 @@
db_init_string(errMsg);
}
- db_set_string(errMsg, "DBMI-Postgres driver error:\n");
+ db_set_string(errMsg, _("DBMI-Postgres driver error:\n"));
}
/* append error message */
@@ -20,7 +33,7 @@
db_append_string(errMsg, msg);
}
-
+/* report error message */
void report_error(void)
{
db_append_string(errMsg, "\n");
Modified: grass/trunk/db/drivers/postgres/execute.c
===================================================================
--- grass/trunk/db/drivers/postgres/execute.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/execute.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,17 +1,14 @@
+/*!
+ \file db/driver/postgres/execute.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - execute statemets
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
-/****************************************************************************
- *
- * MODULE: execute
- * AUTHOR(S): Alex Shevlakov <sixote yahoo.com> (original contributor)
- * Huidae Cho <grass4u gmail.com>, Glynn Clements <glynn gclements.plus.com>, Markus Neteler <neteler itc.it>, Radim Blazek <radim.blazek gmail.com>
- * PURPOSE: PostgreSQL driver
- * COPYRIGHT: (C) 2002-2006 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- *****************************************************************************/
#include <stdlib.h>
#include <grass/dbmi.h>
@@ -28,15 +25,17 @@
init_error();
- /* Postgres supports in addition to standard escape character ' (apostrophe) also \ (basckslash)
- * as this is not SQL standard, GRASS modules cannot work escape all \ in the text
- * because other drivers do not support this feature. For example, if a text contains
- * string \' GRASS modules escape ' by another ' and string passed to driver is \''
- * postgres takes \' as ' but second ' remains not escaped, result is error.
- * Because of this, all occurencies of \ in sql are escaped by \ */
+ /* Postgres supports in addition to standard escape character '
+ * (apostrophe) also \ (basckslash) as this is not SQL standard,
+ * GRASS modules cannot work escape all \ in the text because
+ * other drivers do not support this feature. For example, if a
+ * text contains string \' GRASS modules escape ' by another ' and
+ * string passed to driver is \'' postgres takes \' as ' but
+ * second ' remains not escaped, result is error. Because of
+ * this, all occurencies of \ in sql are escaped by \ */
str = G_str_replace(db_get_string(sql), "\\", "\\\\");
- G_debug(3, "Escaped SQL: %s", str);
+ G_debug(3, "db__driver_execute_immediate(): Escaped SQL: '%s'", str);
res = PQexec(pg_conn, str);
Modified: grass/trunk/db/drivers/postgres/fetch.c
===================================================================
--- grass/trunk/db/drivers/postgres/fetch.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/fetch.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,11 +1,22 @@
-/* TODO: implement time zone handling */
+/*!
+ \file db/driver/postgres/fetch.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - fetch data
+ \todo implement time zone handling
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
+
#include <stdlib.h>
#include <string.h>
#include <grass/dbmi.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
-#include <grass/glocale.h>
int db__driver_fetch(dbCursor * cn, int position, int *more)
{
@@ -19,7 +30,7 @@
/* get the cursor by its token */
if (!(c = (cursor *) db_find_token(token))) {
- append_error("Cursor not found");
+ append_error(_("Cursor not found"));
report_error();
return DB_FAILED;
}
@@ -114,7 +125,7 @@
&(value->t.year), &(value->t.month), &(value->t.day));
if (ns != 3) {
- append_error("Cannot scan date:");
+ append_error(_("Unable to scan date:"));
append_error(PQgetvalue(c->res, c->row, col));
report_error();
return DB_FAILED;
@@ -131,7 +142,7 @@
&(value->t.seconds));
if (ns != 3) {
- append_error("Cannot scan time:");
+ append_error(_("Unable to scan time:"));
append_error(PQgetvalue(c->res, c->row, col));
report_error();
return DB_FAILED;
@@ -149,14 +160,13 @@
&(value->t.minute), &(value->t.seconds), &tz);
if (ns == 7) {
- append_error
- ("Cannot scan timestamp (no idea how to process time zone):");
+ append_error(_("Unable to scan timestamp (no idea how to process time zone):"));
append_error(PQgetvalue(c->res, c->row, col));
report_error();
return DB_FAILED;
}
else if (ns < 6) {
- append_error("Cannot scan timestamp (not enough arguments):");
+ append_error(_("Unable to scan timestamp (not enough arguments):"));
append_error(PQgetvalue(c->res, c->row, col));
report_error();
return DB_FAILED;
@@ -169,7 +179,7 @@
else if (strcmp(PQgetvalue(c->res, c->row, col), "f") == 0)
db_set_string(&(value->s), "0");
else
- G_warning(_("Cannot recognize boolean value"));
+ G_warning(_("Unable to recognize boolean value"));
break;
}
}
@@ -187,7 +197,7 @@
/* get the cursor by its token */
if (!(c = (cursor *) db_find_token(token))) {
- append_error("Cursor not found");
+ append_error(_("Taken not found"));
report_error();
return DB_FAILED;
}
Modified: grass/trunk/db/drivers/postgres/globals.h
===================================================================
--- grass/trunk/db/drivers/postgres/globals.h 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/globals.h 2012-01-22 19:11:46 UTC (rev 50381)
@@ -48,7 +48,7 @@
PG_TYPE_BOOL, /* bool, boolean */
- PG_TYPE_POSTGIS_GEOM /* Geometry column of PostGIS, GRASS internal type */
+ PG_TYPE_POSTGIS_GEOM /* geometry column of PostGIS, GRASS internal type */
} PG_TYPES;
Modified: grass/trunk/db/drivers/postgres/index.c
===================================================================
--- grass/trunk/db/drivers/postgres/index.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/index.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,4 +1,19 @@
+/*!
+ \file db/driver/postgres/index.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - index management
+
+ \todo implement time zone handling
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
+
#include <grass/dbmi.h>
+#include <grass/glocale.h>
+
#include "globals.h"
#include "proto.h"
@@ -41,7 +56,7 @@
res = PQexec(pg_conn, db_get_string(&sql));
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
- append_error("Cannot create index:\n");
+ append_error(_("Unable to create index:\n"));
append_error(db_get_string(&sql));
append_error("\n");
append_error(PQerrorMessage(pg_conn));
Modified: grass/trunk/db/drivers/postgres/listdb.c
===================================================================
--- grass/trunk/db/drivers/postgres/listdb.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/listdb.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,4 +1,15 @@
+/*!
+ \file db/driver/postgres/listdb.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - list databases
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
#include <grass/dbmi.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
@@ -17,7 +28,7 @@
/* TODO: the solution below is not good as user usually does not have permissions for "template1" */
append_error
- ("db_driver_list_databases() is not implemented in pg driver");
+ (_("db_driver_list_databases() is not implemented in pg driver"));
report_error();
return DB_FAILED;
@@ -37,7 +48,7 @@
"template1");
if (PQstatus(pg_conn) == CONNECTION_BAD) {
- append_error("Cannot connect to Postgres:\n");
+ append_error(_("Unable to connect to Postgres:\n"));
append_error(PQerrorMessage(pg_conn));
report_error();
PQfinish(pg_conn);
@@ -47,7 +58,7 @@
res = PQexec(pg_conn, "select datname from pg_database");
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) {
- append_error("Cannot select from Postgres:\n");
+ append_error(_("Unable to select from Postgres:\n"));
append_error(PQerrorMessage(pg_conn));
report_error();
PQclear(res);
@@ -59,7 +70,7 @@
list = db_alloc_handle_array(rec_num);
if (list == NULL) {
- append_error("Cannot db_alloc_handle_array()");
+ append_error(_("Out of memory"));
report_error();
return DB_FAILED;
}
Modified: grass/trunk/db/drivers/postgres/listtab.c
===================================================================
--- grass/trunk/db/drivers/postgres/listtab.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/listtab.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,6 +1,17 @@
+/*!
+ \file db/driver/postgres/listdb.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - list tables
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
#include <stdlib.h>
#include <string.h>
#include <grass/dbmi.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
@@ -23,7 +34,7 @@
"select * from pg_tables where tablename !~ 'pg_*' order by tablename");
if (!rest || PQresultStatus(rest) != PGRES_TUPLES_OK) {
- append_error("Cannot select table names\n");
+ append_error(_("Unable to select table names\n"));
append_error(PQerrorMessage(pg_conn));
report_error();
PQclear(rest);
@@ -48,7 +59,7 @@
"SELECT * FROM pg_views WHERE schemaname NOT IN ('pg_catalog','information_schema') AND viewname !~ '^pg_'");
if (!resv || PQresultStatus(resv) != PGRES_TUPLES_OK) {
- append_error("Cannot select view names\n");
+ append_error(_("Unable to select view names\n"));
append_error(PQerrorMessage(pg_conn));
report_error();
PQclear(resv);
@@ -75,7 +86,7 @@
list = db_alloc_string_array(nrows);
if (list == NULL) {
- append_error("Cannot db_alloc_string_array()");
+ append_error(_("db_alloc_string_array() failed"));
report_error();
return DB_FAILED;
}
Modified: grass/trunk/db/drivers/postgres/parse.c
===================================================================
--- grass/trunk/db/drivers/postgres/parse.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/parse.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,3 +1,14 @@
+/*!
+ \file db/driver/postgres/parse.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - parse connection string
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+*/
+
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
@@ -7,31 +18,24 @@
#include <grass/glocale.h>
/*
- * \brief Parse connection string in form:
- * 1) 'database_name'
- * 2) 'host=xx,port=xx,dbname=xx'
- *
- * returns: DB_OK - OK
- * DB_FAILED - error
- */
+ \brief Parse connection string in form:
+ 1) 'database_name'
+ 2) 'host=xx,port=xx,dbname=xx'
+
+ \returns DB_OK on success
+ \return DB_FAILED on failure
+*/
int parse_conn(const char *str, PGCONN * pgconn)
{
int i;
char **tokens, delm[2];
/* reset */
- pgconn->host = NULL;
- pgconn->port = NULL;
- pgconn->options = NULL;
- pgconn->tty = NULL;
- pgconn->dbname = NULL;
- pgconn->user = NULL;
- pgconn->password = NULL;
- pgconn->schema = NULL;
+ G_zero(pgconn, sizeof(PGCONN));
- G_debug(3, "parse_conn : %s", str);
+ G_debug(3, "parse_conn: '%s'", str);
- if (strchr(str, '=') == NULL) { /*db name only */
+ if (strchr(str, '=') == NULL) { /* db name only */
pgconn->dbname = G_store(str);
}
else {
Modified: grass/trunk/db/drivers/postgres/priv.c
===================================================================
--- grass/trunk/db/drivers/postgres/priv.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/priv.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,4 +1,15 @@
+/*!
+ \file db/driver/postgres/priv.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - privilages
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
#include <grass/dbmi.h>
+#include <grass/glocale.h>
#include "globals.h"
#include "proto.h"
@@ -39,7 +50,7 @@
res = PQexec(pg_conn, db_get_string(&sql));
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
- append_error("Cannot grant on table:\n");
+ append_error(_("Unable grant on table:\n"));
append_error(db_get_string(&sql));
append_error("\n");
append_error(PQerrorMessage(pg_conn));
Modified: grass/trunk/db/drivers/postgres/select.c
===================================================================
--- grass/trunk/db/drivers/postgres/select.c 2012-01-22 09:18:21 UTC (rev 50380)
+++ grass/trunk/db/drivers/postgres/select.c 2012-01-22 19:11:46 UTC (rev 50381)
@@ -1,6 +1,19 @@
+/*!
+ \file db/driver/postgres/db.c
+
+ \brief DBMI - Low Level PostgreSQL database driver - select cursor
+
+ This program is free software under the GNU General Public License
+ (>=v2). Read the file COPYING that comes with GRASS for details.
+
+ \author Radim Blazek
+ */
+
#include <stdlib.h>
#include <grass/dbmi.h>
#include <grass/gis.h>
+#include <grass/glocale.h>
+
#include "globals.h"
#include "proto.h"
@@ -17,7 +30,7 @@
res = PQexec(pg_conn, "SET DATESTYLE TO ISO");
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) {
- append_error("Cannot set DATESTYLE\n");
+ append_error(_("Unable set DATESTYLE"));
report_error();
PQclear(res);
return DB_FAILED;
@@ -40,9 +53,9 @@
c->res = PQexec(pg_conn, str);
if (!c->res || PQresultStatus(c->res) != PGRES_TUPLES_OK) {
- append_error("Cannot select: \n");
+ append_error(_("Unable to select:\n'"));
append_error(db_get_string(sel));
- append_error("\n");
+ append_error("'");
append_error(PQerrorMessage(pg_conn));
report_error();
PQclear(c->res);
@@ -55,7 +68,7 @@
G_free(str);
if (describe_table(c->res, &table, c) == DB_FAILED) {
- append_error("Cannot describe table\n");
+ append_error(_("Unable to describe table"));
report_error();
PQclear(res);
return DB_FAILED;
More information about the grass-commit
mailing list