[GRASS-SVN] r51936 - grass/branches/releasebranch_6_4/gui/wxpython/dbmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 2 08:43:56 PDT 2012
Author: martinl
Date: 2012-06-02 08:43:56 -0700 (Sat, 02 Jun 2012)
New Revision: 51936
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/sqlbuilder.py
Log:
wxGUI/dbmgr: fix getting samples (db_select())
(merge r51934 from trunk)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/sqlbuilder.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/sqlbuilder.py 2012-06-02 15:42:26 UTC (rev 51935)
+++ grass/branches/releasebranch_6_4/gui/wxpython/dbmgr/sqlbuilder.py 2012-06-02 15:43:56 UTC (rev 51936)
@@ -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