[GRASS-SVN] r38788 -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 19 04:06:13 EDT 2009
Author: hamish
Date: 2009-08-19 04:06:11 -0400 (Wed, 19 Aug 2009)
New Revision: 38788
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/sqlbuilder.py
Log:
merge from devbr6-
quote to protect from spaces in path names (trac #637);
fix access tables not in the current mapset;
skip the non-column lines of db.describe -c
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/sqlbuilder.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/sqlbuilder.py 2009-08-19 07:42:33 UTC (rev 38787)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/sqlbuilder.py 2009-08-19 08:06:11 UTC (rev 38788)
@@ -51,8 +51,8 @@
self.vectmap = self.vectmap + "@" + grassenv.GetGRASSVariable ("MAPSET")
self.mapname, self.mapset = self.vectmap.split("@")
self.layer,self.tablename, self.column, self.database, self.driver =\
- os.popen("v.db.connect -g map=%s" %\
- (self.vectmap)).readlines()[0].strip().split()
+ os.popen("v.db.connect -g fs=\"|\" map=%s" %\
+ (self.vectmap)).readlines()[0].strip().split("|")
self.qtype = qtype # type of the uqery: SELECT, UPDATE, DELETE, ...
self.column_names = [] # array with column names
@@ -221,10 +221,16 @@
"""Get columns"""
dbDescribe = gcmd.Command(['db.describe',
'-c', '--q',
- 'table=%s' % self.tablename])
+ 'table=%s',
+ 'database=%s',
+ 'driver=%s' % self.tablename, self.database, self.driver])
- # skip ncols and nrows lines
for line in dbDescribe.ReadStdOutput()[2:]:
+ # skip ncols and nrows lines
+ linetype = line.strip().split(":")[0]
+ if linetype == "ncols" or linetype == "nrows":
+ continue
+
num, name, ctype, length = line.strip().split(":")
name.strip()
#self.columns_names.append(name)
@@ -240,7 +246,7 @@
self.list_values.Clear()
column = self.list_columns.GetString(idx)
i = 0
- for line in os.popen("""db.select -c database=%s driver=%s sql="SELECT %s FROM %s" """ %\
+ for line in os.popen("""db.select -c database="%s" driver=%s sql="SELECT %s FROM %s" """ %\
(self.database,self.driver,column,self.tablename)):
if justsample and i < 256 or \
not justsample:
@@ -311,7 +317,7 @@
pass
def OnVerify(self,event):
if self.text_sql.GetValue():
- if os.system("""db.select -t driver=%s database=%s sql="SELECT * FROM %s WHERE %s" """ % \
+ if os.system("""db.select -t driver=%s database="%s" sql="SELECT * FROM %s WHERE %s" """ % \
(self.driver, self.database,self.tablename,
self.text_sql.GetValue().strip().replace("\n"," "))):
# FIXME: LOG
More information about the grass-commit
mailing list