[GRASS-SVN] r35517 - grass/trunk/vector/v.to.db

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 20 15:36:16 EST 2009


Author: martinl
Date: 2009-01-20 15:36:15 -0500 (Tue, 20 Jan 2009)
New Revision: 35517

Modified:
   grass/trunk/vector/v.to.db/update.c
Log:
v.to.db: report missing qlayer connection only when querying
	 (merge from devbr6, r35515)


Modified: grass/trunk/vector/v.to.db/update.c
===================================================================
--- grass/trunk/vector/v.to.db/update.c	2009-01-20 20:33:49 UTC (rev 35516)
+++ grass/trunk/vector/v.to.db/update.c	2009-01-20 20:36:15 UTC (rev 35517)
@@ -23,15 +23,22 @@
     db_init_string(&stmt);
 
     /* layer to find table to read from */
-    if ((qFi = Vect_get_field(Map, options.qfield)) == NULL)
+    qFi = Vect_get_field(Map, options.qfield);
+    if (options.option == O_QUERY && qFi == NULL)
         G_fatal_error(_("Database connection not defined for layer %d. Use v.db.connect first."),
                       options.qfield);
     /* layer to find table to write to */
     if ((Fi = Vect_get_field(Map, options.field)) == NULL)
 	G_fatal_error(_("Database connection not defined for layer %d. Use v.db.connect first."),
 		      options.field);
-    G_debug(3, "Reading from map <%s>, query layer %d (table <%s>): updating table <%s>, column <%s>", 
-            options.name, options.qfield, qFi->table, Fi->table, Fi->key);
+    if (qFi) {
+      G_debug(3, "Reading from map <%s>, query layer %d (table <%s>): updating table <%s>, column <%s>", 
+	      options.name, options.qfield, qFi->table, Fi->table, Fi->key);
+    }
+    else {
+      G_debug(3, "Reading from map <%s>, updating table <%s>, column <%s>", 
+	      options.name, Fi->table, Fi->key);
+    }
 
     /* Open driver */
     driver = db_start_driver_open_database(Fi->driver, Fi->database);



More information about the grass-commit mailing list