[GRASS-SVN] r53972 - grass/trunk/scripts/v.db.reconnect.all

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 22 04:26:11 PST 2012


Author: martinl
Date: 2012-11-22 04:26:11 -0800 (Thu, 22 Nov 2012)
New Revision: 53972

Modified:
   grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.html
   grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py
Log:
v.db.reconnect.all: fix default SQLite settings (see `db.connect -c`)


Modified: grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.html
===================================================================
--- grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.html	2012-11-22 12:24:58 UTC (rev 53971)
+++ grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.html	2012-11-22 12:26:11 UTC (rev 53972)
@@ -53,7 +53,7 @@
 
 <div class="code"><pre>
 v.db.reconnect.all old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
- new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
+ new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
 </pre></div>
 
 If attribute table doesn't exist in the target database
@@ -66,7 +66,7 @@
 
 <div class="code"><pre>
 v.db.reconnect.all -c old_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
- new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db'
+ new_driver=sqlite new_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db'
 </pre></div>
 
 To automatically remove original DBF attribute tables after

Modified: grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py
===================================================================
--- grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py	2012-11-22 12:24:58 UTC (rev 53971)
+++ grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py	2012-11-22 12:26:11 UTC (rev 53972)
@@ -68,6 +68,12 @@
 
 # create database if doesn't exist
 def create_db(driver, database):
+    if driver == 'sqlite':
+        path = os.path.dirname(database)
+        # check if destination directory exists
+        if not os.path.isdir(path):
+            os.makedirs(path)
+    
     if database in grass.read_command('db.databases', quiet = True,
                                       driver = driver).splitlines():
         return False



More information about the grass-commit mailing list