|
@@ -52,7 +52,7 @@ class SQLFrame(wx.Frame):
|
|
|
self.vectmap = self.vectmap + "@" + grass.gisenv()['MAPSET']
|
|
|
self.mapname, self.mapset = self.vectmap.split("@")
|
|
|
self.layer,self.tablename, self.column, self.database, self.driver =\
|
|
|
- os.popen("v.db.connect -g fs='|' map=%s" %\
|
|
|
+ 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, ...
|
|
@@ -224,10 +224,16 @@ class SQLFrame(wx.Frame):
|
|
|
quiet = True,
|
|
|
read = True,
|
|
|
flags = 'c',
|
|
|
- table = self.tablename)
|
|
|
+ table = self.tablename,
|
|
|
+ database = self.database,
|
|
|
+ driver = self.driver)
|
|
|
|
|
|
- # skip ncols and nrows lines
|
|
|
for line in ret.splitlines():
|
|
|
+ # 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)
|
|
@@ -243,7 +249,7 @@ class SQLFrame(wx.Frame):
|
|
|
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:
|
|
@@ -314,7 +320,7 @@ class SQLFrame(wx.Frame):
|
|
|
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
|