[GRASS-SVN] r57305 - grass/branches/releasebranch_6_4/db/base
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jul 27 12:56:37 PDT 2013
Author: neteler
Date: 2013-07-27 12:56:37 -0700 (Sat, 27 Jul 2013)
New Revision: 57305
Modified:
grass/branches/releasebranch_6_4/db/base/columns.c
grass/branches/releasebranch_6_4/db/base/copy.c
grass/branches/releasebranch_6_4/db/base/select.c
Log:
db.*: add test if table exists where appropriate (backport from trunk, r57274)
Modified: grass/branches/releasebranch_6_4/db/base/columns.c
===================================================================
--- grass/branches/releasebranch_6_4/db/base/columns.c 2013-07-27 19:55:08 UTC (rev 57304)
+++ grass/branches/releasebranch_6_4/db/base/columns.c 2013-07-27 19:56:37 UTC (rev 57305)
@@ -40,6 +40,12 @@
parse_command_line(argc, argv);
+ if (!db_table_exists(parms.driver, parms.database, parms.table)) {
+ G_warning(_("Table <%s> not found in database <%s> using driver <%s>"),
+ parms.table, parms.database, parms.driver);
+ exit(EXIT_FAILURE);
+ }
+
driver = db_start_driver(parms.driver);
if (driver == NULL)
G_fatal_error(_("Unable to start driver <%s>"), parms.driver);
Modified: grass/branches/releasebranch_6_4/db/base/copy.c
===================================================================
--- grass/branches/releasebranch_6_4/db/base/copy.c 2013-07-27 19:55:08 UTC (rev 57304)
+++ grass/branches/releasebranch_6_4/db/base/copy.c 2013-07-27 19:56:37 UTC (rev 57305)
@@ -95,6 +95,14 @@
if (select->answer)
G_fatal_error(_("Cannot combine 'from_table' and 'select' options"));
+ if (!db_table_exists(from_driver->answer, from_database->answer,
+ from_table->answer)) {
+ G_warning(_("Table <%s> not found in database <%s> using driver <%s>"),
+ from_table->answer, from_database->answer,
+ from_driver->answer);
+ exit(EXIT_FAILURE);
+ }
+
if (where->answer) {
ret =
db_copy_table_where(from_driver->answer,
Modified: grass/branches/releasebranch_6_4/db/base/select.c
===================================================================
--- grass/branches/releasebranch_6_4/db/base/select.c 2013-07-27 19:55:08 UTC (rev 57304)
+++ grass/branches/releasebranch_6_4/db/base/select.c 2013-07-27 19:56:37 UTC (rev 57305)
@@ -48,6 +48,14 @@
int stat;
FILE *fd;
+ if (parms.table) {
+ if (!db_table_exists(parms.driver, parms.database, parms.table)) {
+ G_warning(_("Table <%s> not found in database <%s> using driver <%s>"),
+ parms.table, parms.database, parms.driver);
+ exit(EXIT_FAILURE);
+ }
+ }
+
parse_command_line(argc, argv);
if (parms.input) {
@@ -89,7 +97,7 @@
}
}
- if(parms.test_only)
+ if (parms.test_only)
G_verbose_message(_("Test %s."), stat ? _("failed") : _("succeeded"));
db_close_database(driver);
More information about the grass-commit
mailing list