Bladeren bron

db.executes's input required

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38213 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 jaren geleden
bovenliggende
commit
d11705c199

+ 1 - 0
gui/wxpython/gui_modules/dbm.py

@@ -2717,6 +2717,7 @@ class LayerBook(wx.Notebook):
                         quiet = True,
                         parent = self,
                         stdin = sql,
+                        input = '-',
                         driver = driver,
                         database = database)
         

+ 1 - 0
gui/wxpython/gui_modules/dbm_dialogs.py

@@ -290,6 +290,7 @@ class DisplayAttributesDialog(wx.Dialog):
             
             gcmd.RunCommand('db.execute',
                             quiet = True,
+                            input = '-',
                             stdin = sql)
         
         if self.closeDialog.IsChecked():

+ 1 - 0
gui/wxpython/gui_modules/gdialogs.py

@@ -189,6 +189,7 @@ def CreateNewVector(parent, cmd, title=_('Create new vector map'),
             gcmd.RunCommand('db.execute',
                             quiet = True,
                             parent = parent,
+                            input = '-',
                             stdin = sql)
 
             gcmd.RunCommand('v.db.connect',

+ 1 - 1
scripts/db.dropcolumn/db.dropcolumn.py

@@ -107,7 +107,7 @@ def main():
     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).")
 

+ 1 - 1
scripts/db.droptable/db.droptable.py

@@ -79,7 +79,7 @@ def main():
 	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()

+ 3 - 1
scripts/db.in.ogr/db.in.ogr.py

@@ -77,7 +77,7 @@ def main():
 	    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 @@ def main():
     # 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

+ 1 - 1
scripts/db.test/db.test.py

@@ -50,7 +50,7 @@ def main():
 	# 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)

+ 1 - 1
scripts/v.db.addcol/v.db.addcol.py

@@ -76,7 +76,7 @@ def main():
 	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:

+ 1 - 1
scripts/v.db.addtable/v.db.addtable.py

@@ -132,7 +132,7 @@ def main():
 
     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:

+ 1 - 1
scripts/v.db.dropcolumn/v.db.dropcolumn.py

@@ -108,7 +108,7 @@ def main():
     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).")
 

+ 1 - 1
scripts/v.db.droptable/v.db.droptable.py

@@ -83,7 +83,7 @@ def main():
 
     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)

+ 1 - 1
scripts/v.db.join/v.db.join.py

@@ -108,7 +108,7 @@ def main():
 				   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:

+ 2 - 2
scripts/v.db.renamecolumn/v.db.renamecolumn.py

@@ -104,11 +104,11 @@ def main():
 
 	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)

+ 1 - 1
scripts/v.db.update/v.db.update.py

@@ -110,7 +110,7 @@ def main():
     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)