[GRASS-SVN] r36377 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 14 10:01:45 EDT 2009


Author: martinl
Date: 2009-03-14 10:01:45 -0400 (Sat, 14 Mar 2009)
New Revision: 36377

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
Log:
wxGUI: fix db submit on MS Windows


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py	2009-03-14 13:43:10 UTC (rev 36376)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py	2009-03-14 14:01:45 UTC (rev 36377)
@@ -3105,24 +3105,18 @@
 
     def OnSubmit(self, event):
         """Submit records"""
-        sqlCommands = self.GetSQLString(updateValues=True)
-        if len(sqlCommands) > 0:
-            sqlFile = tempfile.NamedTemporaryFile(mode="w")
-            for sql in sqlCommands:
-                enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
-                if not enc and \
-                        os.environ.has_key('GRASS_DB_ENCODING'):
-                    enc = os.environ['GRASS_DB_ENCODING']
-                if enc:
-                    sqlFile.file.write(sql.encode(enc))
-                else:
-                    sqlFile.file.write(sql)
-                sqlFile.file.write(os.linesep)
-                sqlFile.file.flush()
-                gcmd.Command(cmd=["db.execute",
-                                  "--q",
-                                  "input=%s" % sqlFile.name])
-
+        for sql in self.GetSQLString(updateValues=True):
+            enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
+            if not enc and \
+                    os.environ.has_key('GRASS_DB_ENCODING'):
+                enc = os.environ['GRASS_DB_ENCODING']
+            if enc:
+                sql = sql.encode(enc)
+            
+            gcmd.Command(cmd=["db.execute",
+                              "--q"],
+                         stdin=sql)
+            
         if self.closeDialog.IsChecked():
             self.OnCancel(event)
 



More information about the grass-commit mailing list