[GRASS-SVN] r51935 - grass/branches/develbranch_6/gui/wxpython/dbmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 2 08:42:27 PDT 2012
Author: martinl
Date: 2012-06-02 08:42:26 -0700 (Sat, 02 Jun 2012)
New Revision: 51935
Modified:
grass/branches/develbranch_6/gui/wxpython/dbmgr/sqlbuilder.py
Log:
wxGUI/dbmgr: fix getting samples (db_select())
(merge r51934 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/dbmgr/sqlbuilder.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/dbmgr/sqlbuilder.py 2012-06-02 15:38:05 UTC (rev 51934)
+++ grass/branches/develbranch_6/gui/wxpython/dbmgr/sqlbuilder.py 2012-06-02 15:42:26 UTC (rev 51935)
@@ -282,26 +282,22 @@
self.list_values.Clear()
- querystring = "SELECT %s FROM %s" % (column, self.tablename)
-
- data = grass.db_select(table = self.tablename,
- sql = querystring,
+ data = grass.db_select(sql = "SELECT %s FROM %s" % (column, self.tablename),
database = self.database,
driver = self.driver)
if not data:
return
-
+
desc = self.dbInfo.GetTableDesc(self.dbInfo.GetTable(self.layer))[column]
i = 0
- for item in sorted(map(desc['ctype'], data)):
- if justsample and i < 256 or \
- not justsample:
- if desc['type'] != 'character':
- item = str(item)
- self.list_values.Append(item)
- else:
+ for item in sorted(set(map(lambda x: desc['ctype'](x[0]), data))):
+ if justsample and i > 255:
break
+
+ if desc['type'] != 'character':
+ item = str(item)
+ self.list_values.Append(item)
i += 1
def OnSampleValues(self, event):
More information about the grass-commit
mailing list