[GRASS-SVN] r40337 - grass/trunk/scripts/v.db.addtable
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 8 23:40:06 EST 2010
Author: hamish
Date: 2010-01-08 23:40:05 -0500 (Fri, 08 Jan 2010)
New Revision: 40337
Modified:
grass/trunk/scripts/v.db.addtable/v.db.addtable.html
grass/trunk/scripts/v.db.addtable/v.db.addtable.py
Log:
use the mapset's default DB instead of being locked to the one that layer 1 has used. (bug #809)
Modified: grass/trunk/scripts/v.db.addtable/v.db.addtable.html
===================================================================
--- grass/trunk/scripts/v.db.addtable/v.db.addtable.html 2010-01-09 04:30:49 UTC (rev 40336)
+++ grass/trunk/scripts/v.db.addtable/v.db.addtable.html 2010-01-09 04:40:05 UTC (rev 40337)
@@ -18,8 +18,8 @@
<em><a href="wxGUI.Vector_Digitizing_Tool.html">wxGUI vector digitizer</a></em> to add the relevant lines to the table.
The supported types of columns depend on the database backend. However, all
-backends should support VARCHAR, INT, DOUBLE PRECISION and DATE. The default
-dbf backend supports only these types.
+backends should support VARCHAR, INT, DOUBLE PRECISION and DATE.
+The dbf backend supports only these types.
The existing database connection(s) can be verified with <em>v.db.connect</em>.
Modified: grass/trunk/scripts/v.db.addtable/v.db.addtable.py
===================================================================
--- grass/trunk/scripts/v.db.addtable/v.db.addtable.py 2010-01-09 04:30:49 UTC (rev 40336)
+++ grass/trunk/scripts/v.db.addtable/v.db.addtable.py 2010-01-09 04:40:05 UTC (rev 40337)
@@ -15,7 +15,7 @@
#############################################################################
#%Module
-#% description: Creates and adds a new attribute table to a given layer of an existing vector map.
+#% description: Creates and connects a new attribute table to a given layer of an existing vector map.
#% keywords: vector
#% keywords: database
#% keywords: attribute table
@@ -83,21 +83,13 @@
# check if DB parameters are set, and if not set them.
grass.run_command('db.connect', flags = 'c')
- #check if anything is connected:
- nuldev = file(os.devnull, 'w')
- db = grass.vector_db(map, stderr = nuldev)
- if db:
- f = db[min(db.keys())]
- database = f['database']
- driver = f['driver']
- else:
- # nothing defined
- grass.message(_("Creating new DB connection based on default mapset settings..."))
- kv = grass.db_connection()
- database = kv['database']
- driver = kv['driver']
+ grass.message(_("Creating new DB connection based on default mapset settings..."))
+ kv = grass.db_connection()
+ database = kv['database']
+ driver = kv['driver']
# maybe there is already a table linked to the selected layer?
+ nuldev = file(os.devnull, 'w')
try:
grass.vector_db(map, stderr = nuldev)[int(layer)]
grass.fatal(_("There is already a table linked to layer <%s>") % layer)
More information about the grass-commit
mailing list