[GRASS-SVN] r70582 - grass/trunk/vector/v.select
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 15 07:04:43 PST 2017
Author: hcho
Date: 2017-02-15 07:04:43 -0800 (Wed, 15 Feb 2017)
New Revision: 70582
Modified:
grass/trunk/vector/v.select/copy_tabs.c
grass/trunk/vector/v.select/main.c
Log:
v.select: Avoid database warnings when no features are selected and copy an
empty table
Modified: grass/trunk/vector/v.select/copy_tabs.c
===================================================================
--- grass/trunk/vector/v.select/copy_tabs.c 2017-02-15 14:50:07 UTC (rev 70581)
+++ grass/trunk/vector/v.select/copy_tabs.c 2017-02-15 15:04:43 UTC (rev 70582)
@@ -55,12 +55,17 @@
OFi =
Vect_default_field_info(Out, IFi->number, IFi->name, ttype);
- ret =
- db_copy_table_by_ints(IFi->driver, IFi->database, IFi->table,
- OFi->driver,
- Vect_subst_var(OFi->database, Out),
- OFi->table, IFi->key, cats[i],
- ncats[i]);
+ if (ncats[i] > 0)
+ ret = db_copy_table_by_ints(IFi->driver, IFi->database, IFi->table,
+ OFi->driver,
+ Vect_subst_var(OFi->database, Out),
+ OFi->table, IFi->key, cats[i],
+ ncats[i]);
+ else
+ ret = db_copy_table_where(IFi->driver, IFi->database, IFi->table,
+ OFi->driver,
+ Vect_subst_var(OFi->database, Out),
+ OFi->table, "0 = 1");
if (ret == DB_FAILED) {
G_warning(_("Unable to copy table for layer %d"), fields[i]);
Modified: grass/trunk/vector/v.select/main.c
===================================================================
--- grass/trunk/vector/v.select/main.c 2017-02-15 14:50:07 UTC (rev 70581)
+++ grass/trunk/vector/v.select/main.c 2017-02-15 15:04:43 UTC (rev 70582)
@@ -7,7 +7,7 @@
* Markus Neteler <neteler itc.it>
* Martin Landa <landa.martin gmail.com> (GEOS support)
* PURPOSE: Select features from one map by features in another map.
- * COPYRIGHT: (C) 2003-2014 by the GRASS Development Team
+ * COPYRIGHT: (C) 2003-2017 by the GRASS Development Team
*
* This program is free software under the GNU General
* Public License (>=v2). Read the file COPYING that
More information about the grass-commit
mailing list