[GRASS-SVN] r62025 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 17 13:43:55 PDT 2014
Author: huhabla
Date: 2014-09-17 13:43:55 -0700 (Wed, 17 Sep 2014)
New Revision: 62025
Modified:
grass/trunk/lib/python/temporal/core.py
Log:
temporal framework: Better handling on none-existing temporal databases in existing mapsets
Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py 2014-09-17 19:47:30 UTC (rev 62024)
+++ grass/trunk/lib/python/temporal/core.py 2014-09-17 20:43:55 UTC (rev 62025)
@@ -534,13 +534,13 @@
else:
msgr.fatal(_("Unable to initialize the temporal DBMI interface. Please use "
"t.connect to specify the driver and the database string"))
- dbmi = sqlite3
else:
# Set the default sqlite3 connection in case nothing was defined
gscript.run_command("t.connect", flags="d")
driver_string = ciface.get_driver_name()
database_string = ciface.get_database_name()
tgis_backend = driver_string
+ dbmi = sqlite3
tgis_database_string = database_string
# Set the parameter style
@@ -792,6 +792,8 @@
self.connections[mapset] = self.unique_connections[dbstring]
+ self.msgr = get_tgis_message_interface()
+
def get_dbmi(self, mapset=None):
if mapset is None:
mapset = self.current_mapset
@@ -847,6 +849,10 @@
"""
if mapset is None:
mapset = self.current_mapset
+
+ if mapset not in self.tgis_mapsets.keys():
+ self.msgr.fatal(_("Unable to mogrify sql statement. There is no temporal database "
+ "connection defined for mapset <%(mapset)s>" % {"mapset":mapset}))
return self.connections[mapset].mogrify_sql_statement(content)
@@ -866,6 +872,10 @@
if mapset is None:
mapset = self.current_mapset
+ if mapset not in self.tgis_mapsets.keys():
+ self.msgr.fatal(_("Unable to check table. There is no temporal database "
+ "connection defined for mapset <%(mapset)s>" % {"mapset":mapset}))
+
return self.connections[mapset].check_table(table_name)
def execute(self, statement, args=None, mapset=None):
@@ -876,6 +886,10 @@
"""
if mapset is None:
mapset = self.current_mapset
+
+ if mapset not in self.tgis_mapsets.keys():
+ self.msgr.fatal(_("Unable to execute sql statement. There is no temporal database "
+ "connection defined for mapset <%(mapset)s>" % {"mapset":mapset}))
return self.connections[mapset].execute(statement, args)
@@ -883,12 +897,20 @@
if mapset is None:
mapset = self.current_mapset
+ if mapset not in self.tgis_mapsets.keys():
+ self.msgr.fatal(_("Unable to fetch one. There is no temporal database "
+ "connection defined for mapset <%(mapset)s>" % {"mapset":mapset}))
+
return self.connections[mapset].fetchone()
def fetchall(self, mapset=None):
if mapset is None:
mapset = self.current_mapset
+ if mapset not in self.tgis_mapsets.keys():
+ self.msgr.fatal(_("Unable to fetch all. There is no temporal database "
+ "connection defined for mapset <%(mapset)s>" % {"mapset":mapset}))
+
return self.connections[mapset].fetchall()
def execute_transaction(self, statement, mapset=None):
@@ -902,6 +924,10 @@
if mapset is None:
mapset = self.current_mapset
+ if mapset not in self.tgis_mapsets.keys():
+ self.msgr.fatal(_("Unable to execute transaction. There is no temporal database "
+ "connection defined for mapset <%(mapset)s>" % {"mapset":mapset}))
+
return self.connections[mapset].execute_transaction(statement)
###############################################################################
More information about the grass-commit
mailing list