[GRASS-SVN] r62096 - in grass/branches/releasebranch_7_0: . vector/v.select
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 26 08:30:56 PDT 2014
Author: martinl
Date: 2014-09-26 08:30:56 -0700 (Fri, 26 Sep 2014)
New Revision: 62096
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/vector/v.select/copy_tabs.c
Log:
fix r62093: close DB driver on failure (db_set_error_handler_driver)
fix indentation
(merge r62095 from trunk)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
- /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61921,61938,61967-61968,61975,61980,61986,61993,62005
+ /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61921,61938,61967-61968,61975,61980,61986,61993,62005,62095
Modified: grass/branches/releasebranch_7_0/vector/v.select/copy_tabs.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.select/copy_tabs.c 2014-09-26 15:27:55 UTC (rev 62095)
+++ grass/branches/releasebranch_7_0/vector/v.select/copy_tabs.c 2014-09-26 15:30:56 UTC (rev 62096)
@@ -11,7 +11,6 @@
int i, ttype, ntabs;
struct field_info *IFi, *OFi;
- dbDriver *Driver;
ntabs = 0;
@@ -40,6 +39,8 @@
for (i = 0; i < nfields; i++) {
int ret;
+
+ dbDriver *Driver;
if (fields[i] == 0)
continue;
@@ -68,18 +69,21 @@
Vect_map_add_dblink(Out, OFi->number, OFi->name, OFi->table,
IFi->key, OFi->database, OFi->driver);
}
- Driver = db_start_driver_open_database(OFi->driver,
- Vect_subst_var(OFi->database, Out));
- if (Driver == NULL)
- G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
- OFi->database, OFi->driver);
-
- if (db_create_index2(Driver, OFi->table, OFi->key) != DB_OK)
- G_warning(_("Unable to create index"));
- if (db_grant_on_table
+
+ /* create index on key column */
+ Driver = db_start_driver_open_database(OFi->driver,
+ Vect_subst_var(OFi->database, Out));
+ if (Driver == NULL)
+ G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
+ OFi->database, OFi->driver);
+ db_set_error_handler_driver(Driver);
+
+ if (db_create_index2(Driver, OFi->table, OFi->key) != DB_OK)
+ G_warning(_("Unable to create index"));
+ if (db_grant_on_table
(Driver, OFi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK)
- G_fatal_error(_("Unable to grant privileges on table <%s>"),
- OFi->table);
+ G_fatal_error(_("Unable to grant privileges on table <%s>"),
+ OFi->table);
db_close_database_shutdown_driver(Driver);
}
}
More information about the grass-commit
mailing list