[GRASS-SVN] r64771 - grass/branches/releasebranch_7_0/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 28 05:52:18 PST 2015


Author: martinl
Date: 2015-02-28 05:52:18 -0800 (Sat, 28 Feb 2015)
New Revision: 64771

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py
Log:
wxGUI/dbmgr: improve handling string where values (check for quotes)
             (merge r64770 from trunk)


Modified: grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py	2015-02-28 13:50:40 UTC (rev 64770)
+++ grass/branches/releasebranch_7_0/gui/wxpython/dbmgr/base.py	2015-02-28 13:52:18 UTC (rev 64771)
@@ -1833,7 +1833,18 @@
             # simple sql statement
             whereCol = self.FindWindowById(self.layerPage[self.selLayer]['whereColumn']).GetStringSelection()
             whereOpe = self.FindWindowById(self.layerPage[self.selLayer]['whereOperator']).GetStringSelection()
-            whereVal = self.FindWindowById(self.layerPage[self.selLayer]['where']).GetValue().strip()
+            whereWin = self.FindWindowById(self.layerPage[self.selLayer]['where'])
+            whereVal = whereWin.GetValue().strip()
+            table    = self.dbMgrData['mapDBInfo'].layers[self.selLayer]["table"]
+            if self.dbMgrData['mapDBInfo'].tables[table][whereCol]['ctype'] == str:
+                # string attribute, check for quotes
+                whereVal = whereVal.replace('"', "'")
+                if not whereVal.startswith("'"):
+                    whereVal = "'" + whereVal
+                if not whereVal.endswith("'"):
+                    whereVal += "'"
+                whereWin.SetValue(whereVal)
+            
             try:
                 if len(whereVal) > 0:
                     showSelected = True



More information about the grass-commit mailing list