[GRASS-SVN] r48944 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 25 16:46:03 EDT 2011


Author: martinl
Date: 2011-10-25 13:46:03 -0700 (Tue, 25 Oct 2011)
New Revision: 48944

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
Log:
wxGUI: fix updating attributes for OGR layers


Modified: grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2011-10-25 20:29:26 UTC (rev 48943)
+++ grass/trunk/gui/wxpython/gui_modules/dbm_dialogs.py	2011-10-25 20:46:03 UTC (rev 48944)
@@ -244,7 +244,7 @@
                     sqlString = sqlString[:-1] # remove last comma
                     sqlString += ")"
                 else:
-                    sqlString += " WHERE cat=%s" % cat
+                    sqlString += " WHERE %s=%s" % (key, cat)
                 sqlCommands.append(sqlString)
             # for each category
         # for each layer END
@@ -288,18 +288,25 @@
 
     def OnSubmit(self, event):
         """!Submit records"""
+        layer = 1
         for sql in self.GetSQLString(updateValues = True):
             enc = UserSettings.Get(group = 'atm', key = 'encoding', subkey = 'value')
             if not enc and 'GRASS_DB_ENCODING' in os.environ:
                 enc = os.environ['GRASS_DB_ENCODING']
             if enc:
                 sql = sql.encode(enc)
-            
+
+            driver, database = self.mapDBInfo.GetDbSettings(layer)
+            Debug.msg(1, "SQL: %s" % sql)
             gcmd.RunCommand('db.execute',
                             parent = self,
                             quiet = True,
                             input = '-',
-                            stdin = sql)
+                            stdin = sql,
+                            driver = driver,
+                            database = database)
+            
+            layer += 1
         
         if self.closeDialog.IsChecked():
             self.OnCancel(event)



More information about the grass-commit mailing list