[GRASS-SVN] r55344 - grass/branches/develbranch_6/gui/wxpython/dbmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 13 01:29:45 PDT 2013
Author: annakrat
Date: 2013-03-13 01:29:45 -0700 (Wed, 13 Mar 2013)
New Revision: 55344
Modified:
grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py
Log:
wxGUI: fix #1270 (merge from release branch, r55306)
Modified: grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py 2013-03-13 08:25:24 UTC (rev 55343)
+++ grass/branches/develbranch_6/gui/wxpython/dbmgr/manager.py 2013-03-13 08:29:45 UTC (rev 55344)
@@ -1901,17 +1901,18 @@
# perform SQL non-select statements (e.g. 'delete from table where cat=1')
if len(self.listOfSQLStatements) > 0:
- sqlFile = tempfile.NamedTemporaryFile(mode = "wt")
+ fd, sqlFilePath = tempfile.mkstemp(text=True)
+ sqlFile = open(sqlFilePath, 'w')
for sql in self.listOfSQLStatements:
enc = UserSettings.Get(group = 'atm', key = 'encoding', subkey = 'value')
if not enc and 'GRASS_DB_ENCODING' in os.environ:
enc = os.environ['GRASS_DB_ENCODING']
if enc:
- sqlFile.file.write(sql.encode(enc) + ';')
+ sqlFile.write(sql.encode(enc) + ';')
else:
- sqlFile.file.write(sql + ';')
- sqlFile.file.write(os.linesep)
- sqlFile.file.flush()
+ sqlFile.write(sql + ';')
+ sqlFile.write(os.linesep)
+ sqlFile.close()
driver = self.mapDBInfo.layers[self.layer]["driver"]
database = self.mapDBInfo.layers[self.layer]["database"]
@@ -1921,10 +1922,12 @@
RunCommand('db.execute',
parent = self,
- input = sqlFile.name,
+ input = sqlFilePath,
driver = driver,
database = database)
+ os.close(fd)
+ os.remove(sqlFilePath)
# reset list of statements
self.listOfSQLStatements = []
More information about the grass-commit
mailing list