[GRASS-SVN] r38213 - in grass/trunk: gui/wxpython/gui_modules scripts/db.dropcolumn scripts/db.droptable scripts/db.in.ogr scripts/db.test scripts/v.db.addcol scripts/v.db.addtable scripts/v.db.dropcolumn scripts/v.db.droptable scripts/v.db.join scripts/v.db.renamecolumn scripts/v.db.update

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jul 4 13:46:21 EDT 2009


Author: martinl
Date: 2009-07-04 13:46:20 -0400 (Sat, 04 Jul 2009)
New Revision: 38213

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
   grass/trunk/scripts/db.dropcolumn/db.dropcolumn.py
   grass/trunk/scripts/db.droptable/db.droptable.py
   grass/trunk/scripts/db.in.ogr/db.in.ogr.py
   grass/trunk/scripts/db.test/db.test.py
   grass/trunk/scripts/v.db.addcol/v.db.addcol.py
   grass/trunk/scripts/v.db.addtable/v.db.addtable.py
   grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
   grass/trunk/scripts/v.db.droptable/v.db.droptable.py
   grass/trunk/scripts/v.db.join/v.db.join.py
   grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py
   grass/trunk/scripts/v.db.update/v.db.update.py
Log:
db.executes's input required


Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -2717,6 +2717,7 @@
                         quiet = True,
                         parent = self,
                         stdin = sql,
+                        input = '-',
                         driver = driver,
                         database = database)
         

Modified: grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -290,6 +290,7 @@
             
             gcmd.RunCommand('db.execute',
                             quiet = True,
+                            input = '-',
                             stdin = sql)
         
         if self.closeDialog.IsChecked():

Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -189,6 +189,7 @@
             gcmd.RunCommand('db.execute',
                             quiet = True,
                             parent = parent,
+                            input = '-',
                             stdin = sql)
 
             gcmd.RunCommand('v.db.connect',

Modified: grass/trunk/scripts/db.dropcolumn/db.dropcolumn.py
===================================================================
--- grass/trunk/scripts/db.dropcolumn/db.dropcolumn.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/db.dropcolumn/db.dropcolumn.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -107,7 +107,7 @@
     else:
 	sql = "ALTER TABLE %s DROP COLUMN %s" % (table, column)
 
-    if grass.write_command('db.execute', database = database, driver = driver,
+    if grass.write_command('db.execute', input = '-', database = database, driver = driver,
 			   stdin = sql) != 0:
 	grass.fatal("Cannot continue (problem deleting column).")
 

Modified: grass/trunk/scripts/db.droptable/db.droptable.py
===================================================================
--- grass/trunk/scripts/db.droptable/db.droptable.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/db.droptable/db.droptable.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -79,7 +79,7 @@
 	grass.message("You must use the force flag to actually remove it. Exiting.")
 	sys.exit(0)
 
-    p = grass.feed_command('db.execute', database = database, driver = driver)
+    p = grass.feed_command('db.execute', input = '-', database = database, driver = driver)
     p.stdin.write("DROP TABLE " + table)
     p.stdin.close()
     p.wait()

Modified: grass/trunk/scripts/db.in.ogr/db.in.ogr.py
===================================================================
--- grass/trunk/scripts/db.in.ogr/db.in.ogr.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/db.in.ogr/db.in.ogr.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -77,7 +77,7 @@
 	    if l == output:
 		grass.fatal("Table <%s> already exists" % output)
     else:
-	grass.write_command('db.execute', stdin = "DROP TABLE %s" % output)
+	grass.write_command('db.execute', input = '-', stdin = "DROP TABLE %s" % output)
 
     # treat DB as real vector map...
     if db_table:
@@ -97,8 +97,10 @@
     # rename ID col if requested from cat to new name
     if key:
 	grass.run_command('db.execute', quiet = True, flags = 'f',
+                          input = '-', 
 			  stdin = "ALTER TABLE %s ADD COLUMN %s integer" % (output, key) )
 	grass.run_command('db.execute', quiet = True, flags = 'f',
+                          input = '-', 
 			  stdin = "UPDATE %s SET %s=cat" % (output, key) )
 
     # ... and immediately drop the empty geometry

Modified: grass/trunk/scripts/db.test/db.test.py
===================================================================
--- grass/trunk/scripts/db.test/db.test.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/db.test/db.test.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -50,7 +50,7 @@
 	# Copy expected result to temp file
 
 	if type == 'X':
-	    r = grass.write_command('db.execute', stdin = sql + '\n')
+	    r = grass.write_command('db.execute', input = '-', stdin = sql + '\n')
 	else:
 	    resf = file(result, 'w')
 	    r = grass.write_command('db.select', flags = 'c', stdin = sql + '\n', stdout = resf)

Modified: grass/trunk/scripts/v.db.addcol/v.db.addcol.py
===================================================================
--- grass/trunk/scripts/v.db.addcol/v.db.addcol.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.addcol/v.db.addcol.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -76,7 +76,7 @@
 	if not col:
 	    grass.fatal("There is an empty column. Did you leave a trailing comma?")
 
-	p = grass.feed_command('db.execute', database = database, driver = driver)
+	p = grass.feed_command('db.execute', input = '-', database = database, driver = driver)
 	p.stdin.write("ALTER TABLE %s ADD COLUMN %s" % (table, col))
 	p.stdin.close()
 	if p.wait() != 0:

Modified: grass/trunk/scripts/v.db.addtable/v.db.addtable.py
===================================================================
--- grass/trunk/scripts/v.db.addtable/v.db.addtable.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.addtable/v.db.addtable.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -132,7 +132,7 @@
 
     sql = "CREATE TABLE %s (%s)" % (table, column_def)
 
-    if grass.write_command('db.execute', database = database, driver = driver, stdin = sql) != 0:
+    if grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql) != 0:
 	grass.fatal("Cannot continue.")
 
     # connect the map to the DB:

Modified: grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -108,7 +108,7 @@
     else:
 	sql = "ALTER TABLE %s DROP COLUMN %s" % (table, column)
 
-    if grass.write_command('db.execute', database = database, driver = driver,
+    if grass.write_command('db.execute', input = '-', database = database, driver = driver,
 			   stdin = sql) != 0:
 	grass.fatal("Cannot continue (problem deleting column).")
 

Modified: grass/trunk/scripts/v.db.droptable/v.db.droptable.py
===================================================================
--- grass/trunk/scripts/v.db.droptable/v.db.droptable.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.droptable/v.db.droptable.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -83,7 +83,7 @@
 
     grass.message("Dropping table <%s>..." % table)
 
-    if grass.write_command('db.execute', stdin = "DROP TABLE %s" % table) != 0:
+    if grass.write_command('db.execute', stdin = "DROP TABLE %s" % table, input = '-') != 0:
 	grass.fatal("An error occured while running db.execute")
 
     grass.run_command('v.db.connect', flags = 'd', map = map, layer = layer)

Modified: grass/trunk/scripts/v.db.join/v.db.join.py
===================================================================
--- grass/trunk/scripts/v.db.join/v.db.join.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.join/v.db.join.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -108,7 +108,7 @@
 				   otable = otable, ocolumn = ocolumn,
 				   colname = colname)
 
-	if grass.write_command('db.execute', stdin = stmt, database = database, driver = driver) != 0:
+	if grass.write_command('db.execute', stdin = stmt, input = '-', database = database, driver = driver) != 0:
 	    grass.fatal("Error filling column <%s>." % colname)
 
     # write cmd history:

Modified: grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py
===================================================================
--- grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -104,11 +104,11 @@
 
 	grass.run_command('v.db.addcol', map = map, layer = layer, column = colspec)
 	sql = "UPDATE %s SET %s=%s" % (table, newcol, oldcol)
-	grass.write_command('db.execute', database = database, driver = driver, stdin = sql)
+	grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
 	grass.run_command('v.db.dropcolumn', map = map, layer = layer, column = oldcol)
     else:
 	sql = "ALTER TABLE %s RENAME %s TO %s" % (table, oldcol, newcol)
-	grass.write_command('db.execute', database = database, driver = driver, stdin = sql)
+	grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
 
     # write cmd history:
     grass.vector_history(map)

Modified: grass/trunk/scripts/v.db.update/v.db.update.py
===================================================================
--- grass/trunk/scripts/v.db.update/v.db.update.py	2009-07-04 16:53:28 UTC (rev 38212)
+++ grass/trunk/scripts/v.db.update/v.db.update.py	2009-07-04 17:46:20 UTC (rev 38213)
@@ -110,7 +110,7 @@
     if where:
 	cmd += " WHERE " + where
 
-    grass.write_command('db.execute', database = database, driver = driver, stdin = cmd)
+    grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = cmd)
 
     # write cmd history:
     grass.vector_history(map)



More information about the grass-commit mailing list