[GRASS-SVN] r48662 - in grass/trunk: lib/python/temporal lib/temporal temporal/t.list temporal/tr.extract temporal/tr.register temporal/tr.series

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 6 08:42:10 EDT 2011


Author: huhabla
Date: 2011-10-06 05:42:10 -0700 (Thu, 06 Oct 2011)
New Revision: 48662

Added:
   grass/trunk/lib/temporal/sqlite3_delete_trigger.sql
Modified:
   grass/trunk/lib/python/temporal/abstract_datasets.py
   grass/trunk/lib/python/temporal/base.py
   grass/trunk/lib/python/temporal/core.py
   grass/trunk/lib/python/temporal/space_time_datasets.py
   grass/trunk/lib/temporal/map_stds_register_table_template.sql
   grass/trunk/lib/temporal/map_tables_template.sql
   grass/trunk/lib/temporal/raster3d_metadata_table.sql
   grass/trunk/lib/temporal/raster_metadata_table.sql
   grass/trunk/lib/temporal/stds_map_register_table_template.sql
   grass/trunk/lib/temporal/stds_raster3d_register_trigger_template.sql
   grass/trunk/lib/temporal/stds_raster_register_trigger_template.sql
   grass/trunk/lib/temporal/stds_tables_template.sql
   grass/trunk/lib/temporal/str3ds_metadata_table.sql
   grass/trunk/lib/temporal/strds_metadata_table.sql
   grass/trunk/lib/temporal/stvds_metadata_table.sql
   grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql
   grass/trunk/lib/temporal/update_str3ds_metadata_template.sql
   grass/trunk/lib/temporal/update_strds_metadata_template.sql
   grass/trunk/lib/temporal/vector_metadata_table.sql
   grass/trunk/temporal/t.list/t.list.py
   grass/trunk/temporal/tr.extract/test.tr.extract.sh
   grass/trunk/temporal/tr.extract/tr.extract.py
   grass/trunk/temporal/tr.register/register_ECAD_maps_temp_mean_1995_2010.py
   grass/trunk/temporal/tr.series/test.tr.series.sh
   grass/trunk/temporal/tr.series/tr.series.py
Log:
Implemented support for sqlite and postgresql as temporal database backend.

Modified: grass/trunk/lib/python/temporal/abstract_datasets.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_datasets.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/python/temporal/abstract_datasets.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -589,8 +589,6 @@
             if order:
                 sql += " ORDER BY %s" % (order)
 
-            print sql
-
             try:
                 dbif.cursor.execute(sql)
                 rows = dbif.cursor.fetchall()
@@ -682,7 +680,10 @@
 
         # Check if map is already registred
         if stds_register_table:
-            sql = "SELECT id FROM " + stds_register_table + " WHERE id = (?)"
+	    if dbmi.paramstyle == "qmark":
+		sql = "SELECT id FROM " + stds_register_table + " WHERE id = (?)"
+	    else:
+		sql = "SELECT id FROM " + stds_register_table + " WHERE id = (%s)"
             dbif.cursor.execute(sql, (map_id,))
             row = dbif.cursor.fetchone()
             # In case of no entry make a new one
@@ -709,7 +710,10 @@
             sql = sql.replace("MAP_ID", map_id)
             sql = sql.replace("STDS", self.get_type())
             try:
-                dbif.cursor.executescript(sql)
+		if dbmi.paramstyle == "qmark":
+		    dbif.cursor.executescript(sql)
+		else:
+		    dbif.cursor.execute(sql)
             except:
                 try:
                     # Drop stds register table
@@ -719,7 +723,10 @@
                     core.error(_("Unable to drop table <%s>" % (map_register_table)))
                     raise
                 try:
-                    dbif.cursor.executescript(sql_script)
+		    if dbmi.paramstyle == "qmark":
+			dbif.cursor.executescript(sql_script)
+		    else:
+			dbif.cursor.execute(sql_script)
                 except:
                     core.error(_("Unable to create the space time %s dataset register table for <%s>") % (map.get_type(), map.get_id()))
                     raise
@@ -748,17 +755,24 @@
             #sql_script += "\n"
             #sql_script += "END TRANSACTION;"
             try:
-                dbif.cursor.executescript(sql_script)
+		if dbmi.paramstyle == "qmark":
+		    dbif.cursor.executescript(sql_script)
+		else:
+		    dbif.cursor.execute(sql_script)
             except:
                 try:
                     # Drop map register table
                     sql = "DROP TABLE " + stds_register_table
+		    print sql
                     dbif.cursor.execute(sql)
                 except:
                     core.error(_("Unable to drop table <%s>" % (stds_register_table)))
                     raise
                 try:
-                    dbif.cursor.executescript(sql_script)
+		    if dbmi.paramstyle == "qmark":
+			dbif.cursor.executescript(sql_script)
+		    else:
+			dbif.cursor.execute(sql_script)
                 except:
                     core.error(_("Unable to create the space time %s dataset register table for <%s>") % (map.get_type(), map.get_id()))
                     raise
@@ -787,18 +801,27 @@
 
         # Register the stds in the map stds register table
         # Check if the entry is already there
-        sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
+	if dbmi.paramstyle == "qmark":
+	    sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
+	else:
+	    sql = "SELECT id FROM " + map_register_table + " WHERE id = %s"
         dbif.cursor.execute(sql, (self.base.get_id(),))
       	row = dbif.cursor.fetchone()
 
         # In case of no entry make a new one
         if row == None:
-            sql = "INSERT INTO " + map_register_table + " (id) " + "VALUES (?)"
+	    if dbmi.paramstyle == "qmark":
+		sql = "INSERT INTO " + map_register_table + " (id) " + "VALUES (?)"
+	    else:
+		sql = "INSERT INTO " + map_register_table + " (id) " + "VALUES (%s)"
             #print sql
             dbif.cursor.execute(sql, (self.base.get_id(),))
 
         # Now put the raster name in the stds map register table
-        sql = "INSERT INTO " + stds_register_table + " (id) " + "VALUES (?)"
+	if dbmi.paramstyle == "qmark":
+	    sql = "INSERT INTO " + stds_register_table + " (id) " + "VALUES (?)"
+	else:
+	    sql = "INSERT INTO " + stds_register_table + " (id) " + "VALUES (%s)"
         #print sql
         dbif.cursor.execute(sql, (map_id,))
 
@@ -834,7 +857,10 @@
         stds_register_table = self.get_map_register()
 
         # Check if the map is registered in the space time raster dataset
-        sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
+	if dbmi.paramstyle == "qmark":
+	    sql = "SELECT id FROM " + map_register_table + " WHERE id = ?"
+	else:
+	    sql = "SELECT id FROM " + map_register_table + " WHERE id = %s"
         dbif.cursor.execute(sql, (self.base.get_id(),))
       	row = dbif.cursor.fetchone()
 
@@ -845,12 +871,18 @@
 
         # Remove the space time raster dataset from the raster dataset register
         if map_register_table != None:
-            sql = "DELETE FROM " + map_register_table + " WHERE id = ?"
+	    if dbmi.paramstyle == "qmark":
+		sql = "DELETE FROM " + map_register_table + " WHERE id = ?"
+	    else:
+		sql = "DELETE FROM " + map_register_table + " WHERE id = %s"
             dbif.cursor.execute(sql, (self.base.get_id(),))
 
         # Remove the raster map from the space time raster dataset register
         if stds_register_table != None:
-            sql = "DELETE FROM " + stds_register_table + " WHERE id = ?"
+	    if dbmi.paramstyle == "qmark":
+		sql = "DELETE FROM " + stds_register_table + " WHERE id = ?"
+	    else:
+		sql = "DELETE FROM " + stds_register_table + " WHERE id = %s"
             dbif.cursor.execute(sql, (map_id,))
 
         if connect == True:
@@ -918,7 +950,11 @@
 
         sql_script += "END TRANSACTION;"
 
-        dbif.cursor.executescript(sql_script)
+	if dbmi.paramstyle == "qmark":
+	    dbif.cursor.executescript(sql_script)
+	else:
+	    dbif.cursor.execute(sql_script)
+	    
 
         # Read and validate the selected end time
         self.select()
@@ -948,16 +984,20 @@
             row = dbif.cursor.fetchone()
 
             if row != None:
-                tstring = row[0]
-                # Convert the unicode string into the datetime format
-                if tstring.find(":") > 0:
-                    time_format = "%Y-%m-%d %H:%M:%S"
-                else:
-                    time_format = "%Y-%m-%d"
+		if dbmi.paramstyle == "qmark":
+		    tstring = row[0]
+		    # Convert the unicode string into the datetime format
+		    if tstring.find(":") > 0:
+			time_format = "%Y-%m-%d %H:%M:%S"
+		    else:
+			time_format = "%Y-%m-%d"
 
-                max_start_time = datetime.strptime(tstring, time_format)
-                if end_time < max_start_time:
-                    use_start_time = True
+		    max_start_time = datetime.strptime(tstring, time_format)
+		else:
+		    max_start_time = row[0]
+		    
+		if end_time < max_start_time:
+		    use_start_time = True
 
         # Set the maximum start time as end time
         if use_start_time:
@@ -965,7 +1005,7 @@
                 sql = """UPDATE STDS_absolute_time SET end_time =
                (SELECT max(start_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-               ) WHERE id = "SPACETIME_ID";"""
+               ) WHERE id = 'SPACETIME_ID';"""
                 sql = sql.replace("GRASS_MAP", self.get_new_map_instance(None).get_type())
                 sql = sql.replace("SPACETIME_NAME", stds_name + "_" + stds_mapset )
                 sql = sql.replace("SPACETIME_ID", self.base.get_id())
@@ -974,13 +1014,16 @@
                 sql = """UPDATE STDS_relative_time SET end_time =
                (SELECT max(start_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
                         (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-               ) WHERE id = "SPACETIME_ID";"""
+               ) WHERE id = 'SPACETIME_ID';"""
                 sql = sql.replace("GRASS_MAP", self.get_new_map_instance(None).get_type())
                 sql = sql.replace("SPACETIME_NAME", stds_name + "_" + stds_mapset )
                 sql = sql.replace("SPACETIME_ID", self.base.get_id())
                 sql = sql.replace("STDS", self.get_type())
 
-            dbif.cursor.executescript(sql)
+	    if dbmi.paramstyle == "qmark":
+		dbif.cursor.executescript(sql)
+	    else:
+		dbif.cursor.execute(sql)
 
         if connect == True:
             dbif.close()

Modified: grass/trunk/lib/python/temporal/base.py
===================================================================
--- grass/trunk/lib/python/temporal/base.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/python/temporal/base.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -7,7 +7,7 @@
 
 This packages includes all base classes to stor basic information like id, name,
 mapset creation and modification time as well as sql serialization and deserialization
-and the sqlite3 database interface.
+and the sql database interface.
 
 Usage:
 
@@ -75,9 +75,15 @@
 	    sql += ') VALUES ('
             for key in self.D.keys():
 		if count == 0:
-                    sql += '?'
+		    if dbmi.paramstyle == "qmark":
+			sql += '?'
+		    else:
+			sql += '%s'
 		else:
-                    sql += ',?'
+		    if dbmi.paramstyle == "qmark":
+			sql += ' ,?'
+		    else:
+			sql += ' ,%s'
 		count += 1
 		args.append(self.D[key])
 	    sql += ') '
@@ -93,9 +99,17 @@
 		# Update only entries which are not None
 		if self.D[key] != None:
 		    if count == 0:
-                        sql += ' %s = ? ' % key
+			if dbmi.paramstyle == "qmark":
+			    sql += ' %s = ? ' % key
+			else:
+			    sql += ' %s ' % key
+			    sql += '= %s '
 		    else:
-                        sql += ' ,%s = ? ' % key
+			if dbmi.paramstyle == "qmark":
+			    sql += ' ,%s = ? ' % key
+			else:
+			    sql += ' ,%s ' % key
+			    sql += '= %s '
 		    count += 1
 	            args.append(self.D[key])
 	    if where:
@@ -107,9 +121,17 @@
 	    sql += 'UPDATE ' + table + ' SET '
             for key in self.D.keys():
                 if count == 0:
-                    sql += ' %s = ? ' % key
+		    if dbmi.paramstyle == "qmark":
+			sql += ' %s = ? ' % key
+		    else:
+			sql += ' %s ' % key
+			sql += '= %s '
                 else:
-                    sql += ' ,%s = ? ' % key
+		    if dbmi.paramstyle == "qmark":
+	                sql += ' ,%s = ? ' % key
+		    else:
+			sql += ' ,%s ' % key
+			sql += '= %s '
                 count += 1
                 args.append(self.D[key])
 	    if where:
@@ -118,7 +140,7 @@
     	return sql, tuple(args)
 
     def deserialize(self, row):
-	"""Convert the content of the sqlite row into the internal dictionary"""
+	"""Convert the content of the dbmi row into the internal dictionary"""
 	self.D = {}
 	for key in row.keys():
 	    self.D[key] = row[key]
@@ -149,7 +171,7 @@
 ###############################################################################
 
 class sql_database_interface(dict_sql_serializer):
-    """This is the sql database interface to sqlite3"""
+    """This is the sql database interface"""
     def __init__(self, table=None, ident=None, database=None):
         dict_sql_serializer.__init__(self)
 
@@ -165,9 +187,14 @@
 
     def connect(self):
         #print "Connect to",  self.database
-	self.connection = sqlite3.connect(self.database, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
-	self.connection.row_factory = sqlite3.Row
-        self.cursor = self.connection.cursor()
+	if dbmi.paramstyle == "qmark":
+	    self.connection = dbmi.connect(self.database, detect_types=dbmi.PARSE_DECLTYPES|dbmi.PARSE_COLNAMES)
+	    self.connection.row_factory = dbmi.Row
+	    self.cursor = self.connection.cursor()
+	else:
+	    self.connection = dbmi.connect(self.database)
+	    self.connection.set_isolation_level(dbmi.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
+	    self.cursor = self.connection.cursor(cursor_factory=dbmi.extras.DictCursor)
 
     def close(self):
         #print "Close connection to",  self.database
@@ -175,7 +202,7 @@
         self.cursor.close()
 
     def get_delete_statement(self):
-	return "DELETE FROM " + self.get_table_name() + " WHERE id = \"" + str(self.ident) + "\""
+	return "DELETE FROM " + self.get_table_name() + " WHERE id = \'" + str(self.ident) + "\'"
 
     def delete(self, dbif=None):
 	sql = self.get_delete_statement()
@@ -189,7 +216,7 @@
             self.close()
 
     def get_is_in_db_statement(self):
-	return "SELECT id FROM " + self.get_table_name() + " WHERE id = \"" + str(self.ident) + "\""
+	return "SELECT id FROM " + self.get_table_name() + " WHERE id = \'" + str(self.ident) + "\'"
 
     def is_in_db(self, dbif=None):
 
@@ -212,7 +239,7 @@
 	return True
 
     def get_select_statement(self):
-	return self.serialize("SELECT", self.get_table_name(), "WHERE id = \"" + str(self.ident) + "\"")
+	return self.serialize("SELECT", self.get_table_name(), "WHERE id = \'" + str(self.ident) + "\'")
 
     def select(self, dbif=None):
 	sql, args = self.get_select_statement()
@@ -261,7 +288,7 @@
             self.close()
 
     def get_update_statement(self):
-	return self.serialize("UPDATE", self.get_table_name(), "WHERE id = \"" + str(self.ident) + "\"")
+	return self.serialize("UPDATE", self.get_table_name(), "WHERE id = \'" + str(self.ident) + "\'")
 
     def update(self, dbif=None):
 	if self.ident == None:
@@ -279,7 +306,7 @@
             self.close()
 
     def get_update_all_statement(self):
-	return self.serialize("UPDATE ALL", self.get_table_name(), "WHERE id = \"" + str(self.ident) + "\"")
+	return self.serialize("UPDATE ALL", self.get_table_name(), "WHERE id = \'" + str(self.ident) + "\'")
 
     def update_all(self, dbif=None):
 	if self.ident == None:
@@ -310,9 +337,9 @@
 	self.set_mapset(mapset)
 	self.set_creator(creator)
 	self.set_ctime(ctime)
-	self.set_mtime(mtime)
 	self.set_ttype(ttype)
-	self.set_revision(revision)
+	#self.set_mtime(mtime)
+	#self.set_revision(revision)
 
     def set_id(self, ident):
 	"""Convenient method to set the unique identifier (primary key)"""
@@ -338,13 +365,6 @@
 	else:
             self.D["creation_time"] = ctime
 
-    def set_mtime(self, mtime=None):
-	"""Set the modification time of the map, if nothing set the current time is used"""
-	if mtime == None:
-            self.D["modification_time"] = datetime.now()
-	else:
-            self.D["modification_time"] = mtime
-
     def set_ttype(self, ttype):
 	"""Set the temporal type of the map: absolute or relative, if nothing set absolute time will assumed"""
 	if ttype == None or (ttype != "absolute" and ttype != "relative"):
@@ -352,10 +372,17 @@
         else:
 	    self.D["temporal_type"] = ttype
 
-    def set_revision(self, revision=1):
-	"""Set the revision of the map: if nothing set revision 1 will assumed"""
-	self.D["revision"] = revision
+#    def set_mtime(self, mtime=None):
+#	"""Set the modification time of the map, if nothing set the current time is used"""
+#	if mtime == None:
+#            self.D["modification_time"] = datetime.now()
+#	else:
+#            self.D["modification_time"] = mtime
 
+#    def set_revision(self, revision=1):
+#	"""Set the revision of the map: if nothing set revision 1 will assumed"""
+#	self.D["revision"] = revision
+
     def get_id(self):
 	"""Convenient method to get the unique identifier (primary key)
 	   @return None if not found
@@ -397,14 +424,6 @@
         else:
 	    return None
 
-    def get_mtime(self):
-	"""Get the modification time of the map, datatype is datetime
-	   @return None if not found"""
-	if self.D.has_key("modification_time"):
-	    return self.D["modification_time"]
-        else:
-	    return None
-
     def get_ttype(self):
 	"""Get the temporal type of the map
 	   @return None if not found"""
@@ -413,14 +432,22 @@
         else:
 	    return None
 
-    def get_revision(self):
-	"""Get the revision of the map
-	   @return None if not found"""
-	if self.D.has_key("revision"):
-	    return self.D["revision"]
-        else:
-	    return None
+#    def get_mtime(self):
+#	"""Get the modification time of the map, datatype is datetime
+#	   @return None if not found"""
+#	if self.D.has_key("modification_time"):
+#	    return self.D["modification_time"]
+#       else:
+#	    return None
 
+#    def get_revision(self):
+#	"""Get the revision of the map
+#	   @return None if not found"""
+#	if self.D.has_key("revision"):
+#	    return self.D["revision"]
+#       else:
+#	    return None
+
     def print_info(self):
         """Print information about this class in human readable style"""
         #      0123456789012345678901234567890
@@ -430,9 +457,9 @@
         print " | Mapset: .................... " + str(self.get_mapset())
         print " | Creator: ................... " + str(self.get_creator())
         print " | Creation time: ............. " + str(self.get_ctime())
-        print " | Modification time: ......... " + str(self.get_mtime())
+#        print " | Modification time: ......... " + str(self.get_mtime())
         print " | Temporal type: ............. " + str(self.get_ttype())
-        print " | Revision in database: ...... " + str(self.get_revision())
+#        print " | Revision in database: ...... " + str(self.get_revision())
         
     def print_shell_info(self):
         """Print information about this class in shell style"""
@@ -441,9 +468,9 @@
         print "mapset=" + str(self.get_mapset())
         print "creator=" + str(self.get_creator())
         print "creation_time=" + str(self.get_ctime())
-        print "modification_time=" + str(self.get_mtime())
+#        print "modification_time=" + str(self.get_mtime())
         print "temporal_type=" + str(self.get_ttype())
-        print "revision=" + str(self.get_revision())
+#        print "revision=" + str(self.get_revision())
 
 ###############################################################################
 

Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/python/temporal/core.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -21,7 +21,10 @@
 @author Soeren Gebbert
 """
 import os
-import sqlite3
+import sqlite3 as dbmi
+#import psycopg2 as dbmi
+# Needed for dictionary like cursors
+#import psycopg2.extras
 import grass.script.core as core
 import copy
 from datetime import datetime, date, time, timedelta
@@ -29,9 +32,12 @@
 ###############################################################################
 
 def get_grass_location_db_path():
-    grassenv = core.gisenv()
-    dbpath = os.path.join(grassenv["GISDBASE"], grassenv["LOCATION_NAME"])
-    return os.path.join(dbpath, "grass.db")
+    if dbmi.paramstyle == "qmark":
+	grassenv = core.gisenv()
+	dbpath = os.path.join(grassenv["GISDBASE"], grassenv["LOCATION_NAME"])
+	return os.path.join(dbpath, "grass.db")
+    else:
+	return "dbname=grass_test user=soeren password=abcdefgh"
 
 ###############################################################################
 
@@ -154,10 +160,17 @@
     
     database = get_grass_location_db_path()
 
+    build_db = False
+
     # Check if it already exists
-    if os.path.exists(database):
-        return False
-
+    if dbmi.paramstyle == "qmark":
+	# Check path of the sqlite database
+	if not os.path.exists(database):
+	    build_db = True
+    
+    if build_db == False:
+	return
+    
     # Read all SQL scripts and templates
     map_tables_template_sql = open(os.path.join(get_sql_template_path(), "map_tables_template.sql"), 'r').read()
     raster_metadata_sql = open(os.path.join(get_sql_template_path(), "raster_metadata_table.sql"), 'r').read()
@@ -167,6 +180,7 @@
     strds_metadata_sql = open(os.path.join(get_sql_template_path(), "strds_metadata_table.sql"), 'r').read()
     str3ds_metadata_sql = open(os.path.join(get_sql_template_path(), "str3ds_metadata_table.sql"), 'r').read()
     stvds_metadata_sql = open(os.path.join(get_sql_template_path(), "stvds_metadata_table.sql"), 'r').read()
+    
 
     # Create the raster, raster3d and vector tables
     raster_tables_sql = map_tables_template_sql.replace("GRASS_MAP", "raster")
@@ -178,39 +192,47 @@
     stvds_tables_sql = stds_tables_template_sql.replace("STDS", "stvds")
     str3ds_tables_sql = stds_tables_template_sql.replace("STDS", "str3ds")
 
-    # Check for completion
-    sqlite3.complete_statement(raster_tables_sql)
-    sqlite3.complete_statement(vector_tables_sql)
-    sqlite3.complete_statement(raster3d_tables_sql)
-    sqlite3.complete_statement(raster_metadata_sql)
-    sqlite3.complete_statement(vector_metadata_sql)
-    sqlite3.complete_statement(raster3d_metadata_sql)
-    sqlite3.complete_statement(strds_tables_sql)
-    sqlite3.complete_statement(stvds_tables_sql)
-    sqlite3.complete_statement(str3ds_tables_sql)
-    sqlite3.complete_statement(strds_metadata_sql)
-    sqlite3.complete_statement(stvds_metadata_sql)
-    sqlite3.complete_statement(str3ds_metadata_sql)
-
     # Connect to database
-    connection = sqlite3.connect(database)
+    connection = dbmi.connect(database)
     cursor = connection.cursor()
 
-    # Execute the SQL statements
-    # Create the global tables for the native grass datatypes
-    cursor.executescript(raster_tables_sql)
-    cursor.executescript(raster_metadata_sql)
-    cursor.executescript(vector_tables_sql)
-    cursor.executescript(vector_metadata_sql)
-    cursor.executescript(raster3d_tables_sql)
-    cursor.executescript(raster3d_metadata_sql)
-    # Create the tables for the new space-time datatypes
-    cursor.executescript(strds_tables_sql)
-    cursor.executescript(strds_metadata_sql)
-    cursor.executescript(stvds_tables_sql)
-    cursor.executescript(stvds_metadata_sql)
-    cursor.executescript(str3ds_tables_sql)
-    cursor.executescript(str3ds_metadata_sql)
+    
+    if dbmi.paramstyle == "qmark":
+	
+	sqlite3_delete_trigger_sql = open(os.path.join(get_sql_template_path(), "sqlite3_delete_trigger.sql"), 'r').read()
+	
+	# Execute the SQL statements for sqlite
+	# Create the global tables for the native grass datatypes
+	cursor.executescript(raster_tables_sql)
+	cursor.executescript(raster_metadata_sql)
+	cursor.executescript(vector_tables_sql)
+	cursor.executescript(vector_metadata_sql)
+	cursor.executescript(raster3d_tables_sql)
+	cursor.executescript(raster3d_metadata_sql)
+	# Create the tables for the new space-time datatypes
+	cursor.executescript(strds_tables_sql)
+	cursor.executescript(strds_metadata_sql)
+	cursor.executescript(stvds_tables_sql)
+	cursor.executescript(stvds_metadata_sql)
+	cursor.executescript(str3ds_tables_sql)
+	cursor.executescript(str3ds_metadata_sql)
+	cursor.executescript(sqlite3_delete_trigger_sql)
+    else:
+	# Execute the SQL statements for postgresql
+	# Create the global tables for the native grass datatypes
+	cursor.execute(raster_tables_sql)
+	cursor.execute(raster_metadata_sql)
+	cursor.execute(vector_tables_sql)
+	cursor.execute(vector_metadata_sql)
+	cursor.execute(raster3d_tables_sql)
+	cursor.execute(raster3d_metadata_sql)
+	# Create the tables for the new space-time datatypes
+	cursor.execute(strds_tables_sql)
+	cursor.execute(strds_metadata_sql)
+	cursor.execute(stvds_tables_sql)
+	cursor.execute(stvds_metadata_sql)
+	cursor.execute(str3ds_tables_sql)
+	cursor.execute(str3ds_metadata_sql)
 
     connection.commit()
     cursor.close()

Modified: grass/trunk/lib/python/temporal/space_time_datasets.py
===================================================================
--- grass/trunk/lib/python/temporal/space_time_datasets.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/python/temporal/space_time_datasets.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -426,8 +426,10 @@
     else:
         maplist = tuple(maps.split(","))
 
+    num_maps = len(maplist)
     count = 0
     for mapname in maplist:
+	core.percent(count, num_maps, 1)
         mapname = mapname.strip()
         # Check if the map name contains the mapset as well
         if mapname.find("@") < 0:
@@ -471,6 +473,8 @@
 
     if connect == True:
         dbif.close()
+
+    core.percent(num_maps, num_maps, 1)
         
 ###############################################################################
 
@@ -513,7 +517,10 @@
     else:
         maplist = tuple(maps.split(","))
 
+    num_maps = len(maplist)
+    count = 0
     for mapname in maplist:
+	core.percent(count, num_maps, 1)
         mapname = mapname.strip()
         # Check if the map name contains the mapset as well
         if mapname.find("@") < 0:
@@ -537,12 +544,16 @@
             else:
                 map.select(dbif)
                 map.unregister(dbif)
+		
+	count += 1
 
     if name:
         sp.update_from_registered_maps(dbif)
 
     if connect == True:
         dbif.close()
+	
+    core.percent(num_maps, num_maps, 1)
 
 ###############################################################################
 
@@ -583,8 +594,11 @@
     else:
         maplist = tuple(maps.split(","))
 
+    num_maps = len(maplist)
     count = 0
+    
     for mapname in maplist:
+	core.percent(count, num_maps, 1)
         mapname = mapname.strip()
         # Check if the map name contains the mapset as well
         if mapname.find("@") < 0:
@@ -631,6 +645,8 @@
     if connect == True:
         dbif.close()
 
+    core.percent(num_maps, num_maps, 1)
+    
 
 ###############################################################################
 

Modified: grass/trunk/lib/temporal/map_stds_register_table_template.sql
===================================================================
--- grass/trunk/lib/temporal/map_stds_register_table_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/map_stds_register_table_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -9,7 +9,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- TABLE_NAME is a placeholder for specific table name (SQL compliant)
 -- MAP_ID is a placeholder for specific map id: name at mapset
@@ -23,16 +23,16 @@
   FOREIGN KEY (id) REFERENCES  STDS_base (id) ON DELETE CASCADE
 );
 
-CREATE TRIGGER TABLE_NAME_STDS_register_insert AFTER INSERT ON TABLE_NAME_STDS_register
-  BEGIN
-    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE GRASS_MAP_base.id = "MAP_ID";
-    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE GRASS_MAP_base.id = "MAP_ID";
-  END;
+--CREATE TRIGGER TABLE_NAME_STDS_register_insert AFTER INSERT ON TABLE_NAME_STDS_register
+--  BEGIN
+--    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE GRASS_MAP_base.id = 'MAP_ID';
+--    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE GRASS_MAP_base.id = 'MAP_ID';
+--  END;
 
-CREATE TRIGGER TABLE_NAME_STDS_register_delete AFTER DELETE ON TABLE_NAME_STDS_register
-  BEGIN
-    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE GRASS_MAP_base.id = "MAP_ID";
-    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE GRASS_MAP_base.id = "MAP_ID";
-  END;
+--CREATE TRIGGER TABLE_NAME_STDS_register_delete AFTER DELETE ON TABLE_NAME_STDS_register
+--  BEGIN
+--    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE GRASS_MAP_base.id = 'MAP_ID';
+--    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE GRASS_MAP_base.id = 'MAP_ID';
+--  END;
 
 

Modified: grass/trunk/lib/temporal/map_tables_template.sql
===================================================================
--- grass/trunk/lib/temporal/map_tables_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/map_tables_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -12,7 +12,7 @@
 
 -- GRASS_MAP is a placeholder for specific map type: raster, raster3d or vector
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 CREATE TABLE  GRASS_MAP_base (
   id VARCHAR NOT NULL,                  -- The id (PK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary key
@@ -21,8 +21,9 @@
   creator VARCHAR NOT NULL,
   temporal_type VARCHAR,                -- The temporal type of the grass map "absolute" or "relative" or NULL in case no time stamp is available
   creation_time TIMESTAMP NOT NULL,      -- The time of creation of the grass map
-  modification_time TIMESTAMP NOT NULL,  -- The time of the last modification of the grass map
-  revision SMALLINT NOT NULL,           -- The revision number
+-- Uncommented due to performance issues
+--  modification_time TIMESTAMP NOT NULL,  -- The time of the last modification of the grass map
+--  revision SMALLINT NOT NULL,           -- The revision number
   PRIMARY KEY (id)
 );
 
@@ -55,28 +56,28 @@
   west DOUBLE PRECISION NOT NULL,
   top DOUBLE PRECISION NOT NULL,
   bottom DOUBLE PRECISION NOT NULL,
-  proj DOUBLE VARCHAR,
+  proj VARCHAR,
   PRIMARY KEY (id),
   FOREIGN KEY (id) REFERENCES  GRASS_MAP_base (id) ON DELETE CASCADE
 );
 
 -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated 
 
-CREATE TRIGGER update_GRASS_MAP_absolute_time AFTER UPDATE ON GRASS_MAP_absolute_time 
-  BEGIN
-    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
+--CREATE TRIGGER update_GRASS_MAP_absolute_time AFTER UPDATE ON GRASS_MAP_absolute_time 
+--  BEGIN
+--    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
+-- END;
 
-CREATE TRIGGER update_GRASS_MAP_relative_time AFTER UPDATE ON GRASS_MAP_relative_time 
-  BEGIN
-    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
+--CREATE TRIGGER update_GRASS_MAP_relative_time AFTER UPDATE ON GRASS_MAP_relative_time 
+--  BEGIN
+--    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;
 
 
-CREATE TRIGGER update_GRASS_MAP_spatial_extent AFTER UPDATE ON GRASS_MAP_spatial_extent 
-  BEGIN
-    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
+--CREATE TRIGGER update_GRASS_MAP_spatial_extent AFTER UPDATE ON GRASS_MAP_spatial_extent 
+--  BEGIN
+--    UPDATE GRASS_MAP_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE GRASS_MAP_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;

Modified: grass/trunk/lib/temporal/raster3d_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/raster3d_metadata_table.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/raster3d_metadata_table.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -6,7 +6,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- The metadata table reflects most of the raster3d metadata available in grass
 
@@ -32,8 +32,10 @@
 CREATE VIEW raster3d_view_abs_time AS SELECT 
             A1.id, A1.mapset,
             A1.name, A1.temporal_type,
-            A1.creation_time, A1.modification_time,
-            A1.revision, A1.creator,
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator,
 	    A2.start_time, A2.end_time, A2.timezone,
             A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.datatype, A4.cols, A4.rows, A4.depths,
@@ -48,8 +50,10 @@
 CREATE VIEW raster3d_view_rel_time AS SELECT 
             A1.id, A1.mapset,
             A1.name, A1.temporal_type,
-            A1.creation_time, A1.modification_time,
-            A1.revision, A1.creator,
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator,
 	    A2.start_time, A2.end_time,
             A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.datatype, A4.cols, A4.rows, A4.depths,
@@ -63,19 +67,8 @@
 
 -- Create a trigger to update the modification time and revision number in case the metadata have been updated 
 
-CREATE TRIGGER update_raster3d_metadata AFTER UPDATE ON raster3d_metadata 
-  BEGIN
-    UPDATE raster3d_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE raster3d_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-
--- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
-
-CREATE TRIGGER delete_raster3d_base AFTER DELETE ON raster3d_base
-  BEGIN
-    DELETE FROM raster3d_absolute_time WHERE id = old.id;
-    DELETE FROM raster3d_relative_time WHERE id = old.id;
-    DELETE FROM raster3d_spatial_extent WHERE id = old.id;
-    DELETE FROM raster3d_metadata WHERE id = old.id;
-  END;
-
+--CREATE TRIGGER update_raster3d_metadata AFTER UPDATE ON raster3d_metadata 
+--  BEGIN
+--    UPDATE raster3d_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE raster3d_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;

Modified: grass/trunk/lib/temporal/raster_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/raster_metadata_table.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/raster_metadata_table.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -6,7 +6,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- The metadata table reflects most of the raster metadata available in grass
 
@@ -30,8 +30,10 @@
 CREATE VIEW raster_view_abs_time AS SELECT 
             A1.id, A1.mapset,
             A1.name, A1.temporal_type,
-            A1.creation_time, A1.modification_time,
-            A1.revision, A1.creator, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.timezone,
             A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.datatype, A4.cols, A4.rows,
@@ -45,8 +47,10 @@
 CREATE VIEW raster_view_rel_time AS SELECT 
             A1.id, A1.mapset,
             A1.name, A1.temporal_type,
-            A1.creation_time, A1.modification_time,
-            A1.revision, A1.creator,
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time,
             A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.datatype, A4.cols, A4.rows,
@@ -58,20 +62,10 @@
 	    WHERE A1.id = A2.id AND A1.id = A3.id AND A1.id = A4.id;
 
 -- Create a trigger to update the modification time and revision number in case the metadata have been updated 
+-- Uncommented due to performance issues
+--CREATE TRIGGER update_raster_metadata AFTER UPDATE ON raster_metadata 
+--  BEGIN
+--    UPDATE raster_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE raster_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;
 
-CREATE TRIGGER update_raster_metadata AFTER UPDATE ON raster_metadata 
-  BEGIN
-    UPDATE raster_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE raster_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-
--- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
-
-CREATE TRIGGER delete_raster_base AFTER DELETE ON raster_base
-  BEGIN
-    DELETE FROM raster_absolute_time WHERE id = old.id;
-    DELETE FROM raster_relative_time WHERE id = old.id;
-    DELETE FROM raster_spatial_extent WHERE id = old.id;
-    DELETE FROM raster_metadata WHERE id = old.id;
-  END;
-

Added: grass/trunk/lib/temporal/sqlite3_delete_trigger.sql
===================================================================
--- grass/trunk/lib/temporal/sqlite3_delete_trigger.sql	                        (rev 0)
+++ grass/trunk/lib/temporal/sqlite3_delete_trigger.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -0,0 +1,51 @@
+
+-- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
+
+CREATE TRIGGER delete_strds_base AFTER DELETE ON strds_base
+  BEGIN
+    DELETE FROM strds_absolute_time WHERE id = old.id;
+    DELETE FROM strds_relative_time WHERE id = old.id;
+    DELETE FROM strds_spatial_extent WHERE id = old.id;
+    DELETE FROM strds_metadata WHERE id = old.id;
+  END;
+
+CREATE TRIGGER delete_raster_base AFTER DELETE ON raster_base
+  BEGIN
+    DELETE FROM raster_absolute_time WHERE id = old.id;
+    DELETE FROM raster_relative_time WHERE id = old.id;
+    DELETE FROM raster_spatial_extent WHERE id = old.id;
+    DELETE FROM raster_metadata WHERE id = old.id;
+  END;
+
+CREATE TRIGGER delete_str3ds_base AFTER DELETE ON str3ds_base
+  BEGIN
+    DELETE FROM str3ds_absolute_time WHERE id = old.id;
+    DELETE FROM str3ds_relative_time WHERE id = old.id;
+    DELETE FROM str3ds_spatial_extent WHERE id = old.id;
+    DELETE FROM str3ds_metadata WHERE id = old.id;
+  END;
+
+CREATE TRIGGER delete_raster3d_base AFTER DELETE ON raster3d_base
+  BEGIN
+    DELETE FROM raster3d_absolute_time WHERE id = old.id;
+    DELETE FROM raster3d_relative_time WHERE id = old.id;
+    DELETE FROM raster3d_spatial_extent WHERE id = old.id;
+    DELETE FROM raster3d_metadata WHERE id = old.id;
+  END;
+
+CREATE TRIGGER delete_stvds_base AFTER DELETE ON stvds_base
+  BEGIN
+    DELETE FROM stvds_absolute_time WHERE id = old.id;
+    DELETE FROM stvds_relative_time WHERE id = old.id;
+    DELETE FROM stvds_spatial_extent WHERE id = old.id;
+    DELETE FROM stvds_metadata WHERE id = old.id;
+  END;
+
+CREATE TRIGGER delete_vector_base AFTER DELETE ON vector_base
+  BEGIN
+    DELETE FROM vector_absolute_time WHERE id = old.id;
+    DELETE FROM vector_relative_time WHERE id = old.id;
+    DELETE FROM vector_spatial_extent WHERE id = old.id;
+    DELETE FROM vector_metadata WHERE id = old.id;
+  END;
+

Modified: grass/trunk/lib/temporal/stds_map_register_table_template.sql
===================================================================
--- grass/trunk/lib/temporal/stds_map_register_table_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/stds_map_register_table_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -12,7 +12,7 @@
 -- GRASS_MAP is a placeholder for specific map type: raster, raster3d or vector
 -- STDS is a placeholder for specific space-time dataset type: strds, str3ds, stvds
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- This table stores the.ids of the GRASS_MAP maps registered in the current spacetime GRASS_MAP table
 CREATE TABLE  SPACETIME_NAME_GRASS_MAP_register (
@@ -24,106 +24,106 @@
 -- Triggers are disabled due to huge performance issues
 --CREATE TRIGGER SPACETIME_NAME_GRASS_MAP_register_insert_trigger AFTER INSERT ON SPACETIME_NAME_GRASS_MAP_register 
 --  BEGIN
---    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = "SPACETIME_ID";
---    UPDATE STDS_base SET revision = (revision + 1) WHERE id = "SPACETIME_ID";
+--    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = 'SPACETIME_ID';
+--    UPDATE STDS_base SET revision = (revision + 1) WHERE id = 'SPACETIME_ID';
 --    -- Number of registered maps
 --    UPDATE STDS_metadata SET number_of_maps = 
 --           (SELECT count(id) FROM SPACETIME_NAME_GRASS_MAP_register)
---           WHERE id = "SPACETIME_ID";
+--           WHERE id = 'SPACETIME_ID';
 --    -- Update the temporal extent
 --    UPDATE STDS_absolute_time SET start_time = 
 --           (SELECT min(start_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_absolute_time SET end_time = 
 --           (SELECT max(end_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 
 --    UPDATE STDS_relative_time SET start_time =
 --           (SELECT min(start_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
 --                      (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_relative_time SET end_time =
 --           (SELECT max(end_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
 --                      (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    -- Update the spatial extent
 --    UPDATE STDS_spatial_extent SET north = 
 --           (SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET south = 
 --           (SELECT min(south) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET east = 
 --           (SELECT max(east) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET west = 
 --           (SELECT min(west) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET top = 
 --           (SELECT max(top) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET bottom = 
 --           (SELECT min(bottom) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET proj = 
 --           (SELECT min(proj) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --  END;
 --
 --CREATE TRIGGER SPACETIME_NAME_GRASS_MAP_register_delete_trigger AFTER DELETE ON SPACETIME_NAME_GRASS_MAP_register 
 -- BEGIN
---    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = "SPACETIME_ID";
---    UPDATE STDS_base SET revision = (revision + 1) WHERE id = "SPACETIME_ID";
+--    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = 'SPACETIME_ID';
+--    UPDATE STDS_base SET revision = (revision + 1) WHERE id = 'SPACETIME_ID';
 --    -- Number of registered maps
 --    UPDATE STDS_metadata SET number_of_maps = 
 --           (SELECT count(id) FROM  SPACETIME_NAME_GRASS_MAP_register)
---           WHERE id = "SPACETIME_ID";
+--           WHERE id = 'SPACETIME_ID';
 --    -- Update the temporal extent
 --    UPDATE STDS_absolute_time SET start_time = 
 --           (SELECT min(start_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_absolute_time SET end_time = 
 --           (SELECT max(end_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    -- Update the spatial extent
 --    UPDATE STDS_spatial_extent SET north = 
 --           (SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET south = 
 --           (SELECT min(south) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET east = 
 --           (SELECT max(east) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET west = 
 --           (SELECT min(west) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET top = 
 --           (SELECT max(top) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET bottom = 
 --           (SELECT min(bottom) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE STDS_spatial_extent SET proj = 
 --           (SELECT min(proj) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
 --			(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --  END;
 --

Modified: grass/trunk/lib/temporal/stds_raster3d_register_trigger_template.sql
===================================================================
--- grass/trunk/lib/temporal/stds_raster3d_register_trigger_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/stds_raster3d_register_trigger_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -8,7 +8,7 @@
 -- SPACETIME_NAME is a placeholder for specific stds name (SQL compliant): name_mapset
 -- SPACETIME_ID is a placeholder for specific stds id: name at mapset
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- Triggers are disabled due to huge performance issues
 --CREATE TRIGGER SPACETIME_NAME_raster3d_metadata_register_insert_trigger AFTER INSERT ON SPACETIME_NAME_raster3d_register 
@@ -17,44 +17,44 @@
 --    UPDATE str3ds_metadata SET min_min = 
 --           (SELECT min(min) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET min_max = 
 --           (SELECT max(min) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET max_min = 
 --           (SELECT min(max) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET max_max = 
 --           (SELECT max(max) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    -- Update the resolution
 --    UPDATE str3ds_metadata SET nsres_min = 
 --           (SELECT min(nsres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET nsres_max = 
 --           (SELECT max(nsres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET ewres_min = 
 --           (SELECT min(ewres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET ewres_max = 
 --           (SELECT max(ewres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET tbres_min = 
 --           (SELECT min(tbres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET tbres_max = 
 --           (SELECT max(tbres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --  END;
 --
 --CREATE TRIGGER SPACETIME_NAME_raster3d_metadata_register_delete_trigger AFTER DELETE ON SPACETIME_NAME_raster3d_register 
@@ -63,44 +63,44 @@
 --    UPDATE str3ds_metadata SET min_min = 
 --           (SELECT min(min) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET min_max = 
 --           (SELECT max(min) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET max_min = 
 --           (SELECT min(max) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET max_max = 
 --           (SELECT max(max) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    -- Update the resolution
 --    UPDATE str3ds_metadata SET nsres_min = 
 --           (SELECT min(nsres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET nsres_max = 
 --           (SELECT max(nsres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET ewres_min = 
 --           (SELECT min(ewres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET ewres_max = 
 --           (SELECT max(ewres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET tbres_min = 
 --           (SELECT min(tbres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE str3ds_metadata SET tbres_max = 
 --           (SELECT max(tbres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster3d_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --  END;
 --
 --

Modified: grass/trunk/lib/temporal/stds_raster_register_trigger_template.sql
===================================================================
--- grass/trunk/lib/temporal/stds_raster_register_trigger_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/stds_raster_register_trigger_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -8,7 +8,7 @@
 -- SPACETIME_NAME is a placeholder for specific stds name (SQL compliant): name_mapset
 -- SPACETIME_ID is a placeholder for specific stds id: name at mapset
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- Triggers are disabled due to huge performance issues
 --CREATE TRIGGER SPACETIME_NAME_raster_metadata_register_insert_trigger AFTER INSERT ON SPACETIME_NAME_raster_register 
@@ -17,36 +17,36 @@
 --    UPDATE strds_metadata SET min_min = 
 --           (SELECT min(min) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET min_max = 
 --           (SELECT max(min) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET max_min = 
 --           (SELECT min(max) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET max_max = 
 --           (SELECT max(max) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    -- Update the resolution
 --    UPDATE strds_metadata SET nsres_min = 
 --           (SELECT min(nsres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET nsres_max = 
 --           (SELECT max(nsres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET ewres_min = 
 --           (SELECT min(ewres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET ewres_max = 
 --           (SELECT max(ewres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --  END;
 --
 --CREATE TRIGGER SPACETIME_NAME_raster_metadata_register_delete_trigger AFTER DELETE ON SPACETIME_NAME_raster_register 
@@ -55,36 +55,36 @@
 --    UPDATE strds_metadata SET min_min = 
 --           (SELECT min(min) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET min_max = 
 --           (SELECT max(min) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET max_min = 
 --           (SELECT min(max) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET max_max = 
 --           (SELECT max(max) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    -- Update the resolution
 --    UPDATE strds_metadata SET nsres_min = 
 --           (SELECT min(nsres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET nsres_max = 
 --           (SELECT max(nsres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET ewres_min = 
 --           (SELECT min(ewres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --    UPDATE strds_metadata SET ewres_max = 
 --           (SELECT max(ewres) FROM raster_metadata WHERE raster_metadata.id IN 
 --			(SELECT id FROM SPACETIME_NAME_raster_register)
---           ) WHERE id = "SPACETIME_ID";
+--           ) WHERE id = 'SPACETIME_ID';
 --  END;
 --
 --

Modified: grass/trunk/lib/temporal/stds_tables_template.sql
===================================================================
--- grass/trunk/lib/temporal/stds_tables_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/stds_tables_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -7,7 +7,7 @@
 
 -- STDS is a placeholder for specific space-time dataset type: strds, str3ds, stvds
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 CREATE TABLE  STDS_base (
   id VARCHAR NOT NULL,                 -- Id of the space-time dataset, name at mapset this is the primary key
@@ -17,8 +17,9 @@
   temporal_type VARCHAR NOT NULL,      -- The temporal type of the dataset "absolute" or "relative" 
   semantic_type VARCHAR NOT NULL,      -- The semantic data description used for aggregation/decomposition algorithm selection
   creation_time TIMESTAMP NOT NULL,    -- The time of creation of the space-time dataset
-  modification_time TIMESTAMP NOT NULL,-- The time of the last modification of the space-time dataset
-  revision SMALLINT NOT NULL,          -- The revision number
+-- Uncommented due to performance issues
+--  modification_time TIMESTAMP NOT NULL,  -- The time of the last modification of the grass map
+--  revision SMALLINT NOT NULL,           -- The revision number        -- The revision number
   PRIMARY KEY (id)
 );
 
@@ -26,7 +27,7 @@
   id VARCHAR NOT NULL,            -- Id of the space-time dataset, this is the primary foreign key
   start_time DOUBLE PRECISION,    -- The relative valid start time in [days]
   end_time DOUBLE PRECISION,      -- The relative valid end time in [days]
-  granularity DOUBLE,             -- The granularity in [days]
+  granularity DOUBLE PRECISION,             -- The granularity in [days]
   PRIMARY KEY (id),  
   FOREIGN KEY (id) REFERENCES  STDS_base (id) ON DELETE CASCADE
 );
@@ -49,28 +50,28 @@
   west DOUBLE PRECISION,    -- The spatial west extent, derived from the registered maps
   top DOUBLE PRECISION,     -- The spatial top extent, derived from the registered maps
   bottom DOUBLE PRECISION,  -- The spatial bottom extent, derived from the registered maps
-  proj DOUBLE VARCHAR,      -- The projection of the space time dataset (XY of LL)
+  proj VARCHAR,      -- The projection of the space time dataset (XY of LL)
   PRIMARY KEY (id),  
   FOREIGN KEY (id) REFERENCES  STDS_base (id) ON DELETE CASCADE
 );
 
 -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated 
+-- Uncommented due to performance issues
+--CREATE TRIGGER update_STDS_abs_time AFTER UPDATE ON STDS_absolute_time 
+--  BEGIN
+--    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;
 
-CREATE TRIGGER update_STDS_abs_time AFTER UPDATE ON STDS_absolute_time 
-  BEGIN
-    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
+--CREATE TRIGGER update_STDS_rel_time AFTER UPDATE ON STDS_relative_time 
+--  BEGIN
+--    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;
 
-CREATE TRIGGER update_STDS_rel_time AFTER UPDATE ON STDS_relative_time 
-  BEGIN
-    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
+--CREATE TRIGGER update_STDS_spatial_extent AFTER UPDATE ON STDS_spatial_extent 
+--  BEGIN
+--    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--   UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;
 
-CREATE TRIGGER update_STDS_spatial_extent AFTER UPDATE ON STDS_spatial_extent 
-  BEGIN
-    UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE STDS_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-

Modified: grass/trunk/lib/temporal/str3ds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/str3ds_metadata_table.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/str3ds_metadata_table.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -5,7 +5,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 CREATE TABLE  str3ds_metadata (
   id VARCHAR NOT NULL,          -- Id of the space-time raster3d dataset, this is the primary foreign key
@@ -30,9 +30,11 @@
 
 CREATE VIEW str3ds_view_abs_time AS SELECT 
             A1.id, A1.name, A1.mapset, A1.temporal_type,
-            A1.creator, A1.semantic_type,  
-            A1.creation_time, A1.modification_time,
-            A1.revision,
+            A1.semantic_type, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.timezone, A2.granularity,
 	    A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.raster3d_register,
@@ -49,9 +51,11 @@
 
 CREATE VIEW str3ds_view_rel_time AS SELECT 
             A1.id, A1.name, A1.mapset, A1.temporal_type,
-            A1.creator, A1.semantic_type,  
-            A1.creation_time, A1.modification_time,
-            A1.revision,
+            A1.semantic_type, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.granularity,
 	    A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.raster3d_register,
@@ -68,20 +72,9 @@
 
 
 -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated 
-
-CREATE TRIGGER update_str3ds_metadata AFTER UPDATE ON str3ds_metadata 
-  BEGIN
-    UPDATE str3ds_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE str3ds_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-
--- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
-
-CREATE TRIGGER delete_str3ds_base AFTER DELETE ON str3ds_base
-  BEGIN
-    DELETE FROM str3ds_absolute_time WHERE id = old.id;
-    DELETE FROM str3ds_relative_time WHERE id = old.id;
-    DELETE FROM str3ds_spatial_extent WHERE id = old.id;
-    DELETE FROM str3ds_metadata WHERE id = old.id;
-  END;
-
+-- Uncommented due to performance issues
+--CREATE TRIGGER update_str3ds_metadata AFTER UPDATE ON str3ds_metadata 
+--  BEGIN
+--    UPDATE str3ds_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE str3ds_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;

Modified: grass/trunk/lib/temporal/strds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/strds_metadata_table.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/strds_metadata_table.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -5,7 +5,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 CREATE TABLE  strds_metadata (
   id VARCHAR NOT NULL,          -- Id of the space-time dataset, this is the primary foreign key
@@ -28,9 +28,11 @@
 
 CREATE VIEW strds_view_abs_time AS SELECT 
             A1.id, A1.name, A1.mapset, A1.temporal_type,
-            A1.creator, A1.semantic_type,  
-            A1.creation_time, A1.modification_time,
-            A1.revision,
+            A1.semantic_type, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.timezone, A2.granularity,
 	    A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.raster_register,
@@ -46,9 +48,11 @@
 
 CREATE VIEW strds_view_rel_time AS SELECT 
             A1.id, A1.name, A1.mapset, A1.temporal_type,
-            A1.creator, A1.semantic_type,  
-            A1.creation_time, A1.modification_time,
-            A1.revision,
+            A1.semantic_type, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.granularity,
 	    A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.raster_register,
@@ -64,20 +68,9 @@
 
 
 -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated 
-
-CREATE TRIGGER update_strds_metadata AFTER UPDATE ON strds_metadata 
-  BEGIN
-    UPDATE strds_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE strds_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-
--- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
-
-CREATE TRIGGER delete_strds_base AFTER DELETE ON strds_base
-  BEGIN
-    DELETE FROM strds_absolute_time WHERE id = old.id;
-    DELETE FROM strds_relative_time WHERE id = old.id;
-    DELETE FROM strds_spatial_extent WHERE id = old.id;
-    DELETE FROM strds_metadata WHERE id = old.id;
-  END;
-
+-- Uncommented due to performance issues
+--CREATE TRIGGER update_strds_metadata AFTER UPDATE ON strds_metadata 
+--  BEGIN
+--    UPDATE strds_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE strds_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;

Modified: grass/trunk/lib/temporal/stvds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/stvds_metadata_table.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/stvds_metadata_table.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -5,7 +5,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 CREATE TABLE  stvds_metadata (
   id VARCHAR NOT NULL,                -- Name of the space-time vector dataset, this is the primary foreign key
@@ -20,9 +20,11 @@
 
 CREATE VIEW stvds_view_abs_time AS SELECT 
             A1.id, A1.name, A1.mapset, A1.temporal_type,
-            A1.creator, A1.semantic_type,  
-            A1.creation_time, A1.modification_time,
-            A1.revision,
+            A1.semantic_type, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.timezone,
             A2.granularity,
 	    A3.north, A3.south, A3.east, A3.west, A3.proj,
@@ -35,9 +37,11 @@
 
 CREATE VIEW stvds_view_rel_time AS SELECT 
             A1.id, A1.name, A1.mapset, A1.temporal_type,
-            A1.creator, A1.semantic_type,  
-            A1.creation_time, A1.modification_time,
-            A1.revision,
+            A1.semantic_type, 
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.granularity,
 	    A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.vector_register,
@@ -49,20 +53,9 @@
 
 
 -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated 
-
-CREATE TRIGGER update_stvds_metadata AFTER UPDATE ON stvds_metadata 
-  BEGIN
-    UPDATE stvds_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE stvds_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-
--- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
-
-CREATE TRIGGER delete_stvds_base AFTER DELETE ON stvds_base
-  BEGIN
-    DELETE FROM stvds_absolute_time WHERE id = old.id;
-    DELETE FROM stvds_relative_time WHERE id = old.id;
-    DELETE FROM stvds_spatial_extent WHERE id = old.id;
-    DELETE FROM stvds_metadata WHERE id = old.id;
-  END;
-
+-- Uncommented due to performance issues
+--CREATE TRIGGER update_stvds_metadata AFTER UPDATE ON stvds_metadata 
+--  BEGIN
+--    UPDATE stvds_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE stvds_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;

Modified: grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql
===================================================================
--- grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -12,55 +12,55 @@
 -- GRASS_MAP is a placeholder for specific map type: raster, raster3d or vector
 -- STDS is a placeholder for specific space-time dataset type: strds, str3ds, stvds
 
-UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = "SPACETIME_ID";
-UPDATE STDS_base SET revision = (revision + 1) WHERE id = "SPACETIME_ID";
+-- UPDATE STDS_base SET modification_time = datetime("NOW") WHERE id = 'SPACETIME_ID';
+-- UPDATE STDS_base SET revision = (revision + 1) WHERE id = 'SPACETIME_ID';
 -- Number of registered maps
 UPDATE STDS_metadata SET number_of_maps = 
        (SELECT count(id) FROM SPACETIME_NAME_GRASS_MAP_register)
-       WHERE id = "SPACETIME_ID";
+       WHERE id = 'SPACETIME_ID';
 -- Update the temporal extent
 UPDATE STDS_absolute_time SET start_time = 
        (SELECT min(start_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_absolute_time SET end_time = 
        (SELECT max(end_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_relative_time SET start_time =
        (SELECT min(start_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_relative_time SET end_time =
        (SELECT max(end_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 -- Update the spatial extent
 UPDATE STDS_spatial_extent SET north = 
        (SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_spatial_extent SET south = 
        (SELECT min(south) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_spatial_extent SET east = 
        (SELECT max(east) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_spatial_extent SET west = 
        (SELECT min(west) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_spatial_extent SET top = 
        (SELECT max(top) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_spatial_extent SET bottom = 
        (SELECT min(bottom) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE STDS_spatial_extent SET proj = 
        (SELECT min(proj) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN 
     		(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';

Modified: grass/trunk/lib/temporal/update_str3ds_metadata_template.sql
===================================================================
--- grass/trunk/lib/temporal/update_str3ds_metadata_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/update_str3ds_metadata_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -11,41 +11,41 @@
 UPDATE str3ds_metadata SET min_min = 
        (SELECT min(min) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET min_max = 
        (SELECT max(min) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET max_min = 
        (SELECT min(max) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET max_max = 
        (SELECT max(max) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 -- Update the resolution
 UPDATE str3ds_metadata SET nsres_min = 
        (SELECT min(nsres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET nsres_max = 
        (SELECT max(nsres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET ewres_min = 
        (SELECT min(ewres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET ewres_max = 
        (SELECT max(ewres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET tbres_min = 
        (SELECT min(tbres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE str3ds_metadata SET tbres_max = 
        (SELECT max(tbres) FROM raster3d_metadata WHERE raster3d_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster3d_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';

Modified: grass/trunk/lib/temporal/update_strds_metadata_template.sql
===================================================================
--- grass/trunk/lib/temporal/update_strds_metadata_template.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/update_strds_metadata_template.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -11,33 +11,33 @@
 UPDATE strds_metadata SET min_min = 
        (SELECT min(min) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE strds_metadata SET min_max = 
        (SELECT max(min) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE strds_metadata SET max_min = 
        (SELECT min(max) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE strds_metadata SET max_max = 
        (SELECT max(max) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 -- Update the resolution
 UPDATE strds_metadata SET nsres_min = 
        (SELECT min(nsres) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE strds_metadata SET nsres_max = 
        (SELECT max(nsres) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE strds_metadata SET ewres_min = 
        (SELECT min(ewres) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';
 UPDATE strds_metadata SET ewres_max = 
        (SELECT max(ewres) FROM raster_metadata WHERE raster_metadata.id IN 
     		(SELECT id FROM SPACETIME_NAME_raster_register)
-       ) WHERE id = "SPACETIME_ID";
+       ) WHERE id = 'SPACETIME_ID';

Modified: grass/trunk/lib/temporal/vector_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/vector_metadata_table.sql	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/lib/temporal/vector_metadata_table.sql	2011-10-06 12:42:10 UTC (rev 48662)
@@ -5,7 +5,7 @@
 -- Author: Soeren Gebbert soerengebbert <at> googlemail <dot> com
 --#############################################################################
 
-PRAGMA foreign_keys = ON;
+--PRAGMA foreign_keys = ON;
 
 -- The metadata table 
 
@@ -21,8 +21,10 @@
 CREATE VIEW vector_view_abs_time AS SELECT 
             A1.id, A1.mapset,
             A1.name, A1.temporal_type,
-            A1.creation_time, A1.modification_time,
-            A1.revision, A1.creator,
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time, A2.timezone,
             A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.stvds_register
@@ -33,8 +35,10 @@
 CREATE VIEW vector_view_rel_time AS SELECT 
             A1.id, A1.mapset,
             A1.name, A1.temporal_type,
-            A1.creation_time, A1.modification_time,
-            A1.revision, A1.creator,
+            A1.creation_time, 
+-- Uncommented due to performance issues
+--            A1.modification_time, A1.revision, 
+            A1.creator, 
 	    A2.start_time, A2.end_time,
             A3.north, A3.south, A3.east, A3.west, A3.proj,
 	    A4.stvds_register
@@ -43,20 +47,9 @@
 	    WHERE A1.id = A2.id AND A1.id = A3.id AND A1.id = A4.id;
 
 -- Create a trigger to update the modification time and revision number in case the metadata or timestanps have been updated 
-
-CREATE TRIGGER update_vector_metadata AFTER UPDATE ON vector_metadata 
-  BEGIN
-    UPDATE vector_base SET modification_time = datetime("NOW") WHERE id = old.id;
-    UPDATE vector_base SET revision = (revision + 1) WHERE id = old.id;
-  END;
-
--- Create trigger for automated deletion of dependent rows, this should normally be done using foreign keys 
-
-CREATE TRIGGER delete_vector_base AFTER DELETE ON vector_base
-  BEGIN
-    DELETE FROM vector_absolute_time WHERE id = old.id;
-    DELETE FROM vector_relative_time WHERE id = old.id;
-    DELETE FROM vector_spatial_extent WHERE id = old.id;
-    DELETE FROM vector_metadata WHERE id = old.id;
-  END;
-
+-- Uncommented due to performance issues
+--CREATE TRIGGER update_vector_metadata AFTER UPDATE ON vector_metadata 
+--  BEGIN
+--    UPDATE vector_base SET modification_time = datetime("NOW") WHERE id = old.id;
+--    UPDATE vector_base SET revision = (revision + 1) WHERE id = old.id;
+--  END;

Modified: grass/trunk/temporal/t.list/t.list.py
===================================================================
--- grass/trunk/temporal/t.list/t.list.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/temporal/t.list/t.list.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -116,9 +116,6 @@
     dbif = tgis.sql_database_interface()
     dbif.connect()
 
-    # Insert content from db
-    sp.select(dbif)
-
     # Create the sql selection statement
     # Table name
     if temporaltype == "absolute":

Modified: grass/trunk/temporal/tr.extract/test.tr.extract.sh
===================================================================
--- grass/trunk/temporal/tr.extract/test.tr.extract.sh	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/temporal/tr.extract/test.tr.extract.sh	2011-10-06 12:42:10 UTC (rev 48662)
@@ -20,7 +20,7 @@
 # The first @test
 # We create the space time raster datasets and register the raster maps with absolute time interval
 
-tr.extract --o input=precip_abs1 output=precip_abs2 where='start_time > "2001-06-01"' expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec
+tr.extract --o input=precip_abs1 output=precip_abs2 where="start_time > '2001-06-01'" expression=" if(precip_abs1 > 400, precip_abs1, null())" base=new_prec
 
 t.info type=strds dataset=precip_abs2
 

Modified: grass/trunk/temporal/tr.extract/tr.extract.py
===================================================================
--- grass/trunk/temporal/tr.extract/tr.extract.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/temporal/tr.extract/tr.extract.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -91,8 +91,8 @@
     if sp.is_in_db() == False:
         grass.fatal(_("Dataset <%s> not found in temporal database") % (id))
 
-    if expression and base == None:
-        grass.fatal(_("A raster map base name must be provided"))
+    if expression and not base:
+        grass.fatal(_("Please specify base="))
 
     dbif = tgis.sql_database_interface()
     dbif.connect()
@@ -109,6 +109,7 @@
     if new_sp.is_in_db():
         if grass.overwrite() == True:
             new_sp.delete(dbif)
+	    new_sp = tgis.space_time_raster_dataset(out_id)
         else:
             grass.fatal(_("Space time raster dataset <%s> is already in database, use overwrite flag to overwrite") % out_id)
 
@@ -119,9 +120,15 @@
     rows = sp.get_registered_maps(dbif, where, "start_time")
 
     if rows:
+	num_rows = len(rows)
+	
+	grass.percent(0, num_rows, 1)
+	
         count = 0
         for row in rows:
             count += 1
+	    
+	    grass.percent(count, num_rows, 1)
 
             old_map = sp.get_new_map_instance(row["id"])
             old_map.select(dbif)
@@ -150,9 +157,9 @@
                 grass.verbose(_("Apply r.mapcalc expression: \"%s\"") % expr)
 
                 if grass.overwrite() == True:
-                    ret = grass.run_command("r.mapcalc", expression=expr, overwrite=True)
+                    ret = grass.run_command("r.mapcalc", expression=expr, overwrite=True, quiet=True)
                 else:
-                    ret = grass.run_command("r.mapcalc", expression=expr, overwrite=False)
+                    ret = grass.run_command("r.mapcalc", expression=expr, overwrite=False, quiet=True)
 
                 if ret != 0:
                     grass.error(_("Error while r.mapcalc computation, continue with next map"))
@@ -183,6 +190,8 @@
 
         # Update the spatio-temporal extent and the raster metadata table entries
         new_sp.update_from_registered_maps(dbif)
+	
+	grass.percent(num_rows, num_rows, 1)
         
     dbif.close()
 

Modified: grass/trunk/temporal/tr.register/register_ECAD_maps_temp_mean_1995_2010.py
===================================================================
--- grass/trunk/temporal/tr.register/register_ECAD_maps_temp_mean_1995_2010.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/temporal/tr.register/register_ECAD_maps_temp_mean_1995_2010.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -6,11 +6,14 @@
 # Create the space time raster dataset with t.create
 dataset = "temp_mean_1995_2010_daily"
 
-grass.run_command("t.create", type="strds", dataset=dataset, granularity="1 days", semantic="continuous", temporal="absolute", title="European mean temperature 1995-2010", description="The european daily mean temperature 1995 - 2010 from ECA&D ")
+grass.run_command("t.create", type="strds", dataset=dataset, granularity="1 days", \
+                  semantic="continuous", temporal="absolute", \
+		  title="European mean temperature 1995-2010", \
+		  description="The european daily mean temperature 1995 - 2010 from ECA&D ", \
+		  overwrite=True)
 
 name = "temp_mean."
 maps=""
-#for i in range(6025):
 for i in range(5844):
     inc = i + 1
     map_name = name + str(inc)
@@ -20,4 +23,4 @@
         maps += "," + map_name
     
 # Register all maps at once
-grass.run_command("tr.register", flags="i", dataset=dataset, maps=maps, start="1995-01-01", increment="1 days")
+grass.run_command("tr.register", flags="i", dataset=dataset, maps=maps, start="1995-01-01", increment="1 days", overwrite=True)

Modified: grass/trunk/temporal/tr.series/test.tr.series.sh
===================================================================
--- grass/trunk/temporal/tr.series/test.tr.series.sh	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/temporal/tr.series/test.tr.series.sh	2011-10-06 12:42:10 UTC (rev 48662)
@@ -24,7 +24,7 @@
 
 tr.register --v dataset=precip_abs maps=prec_1,prec_2,prec_3,prec_4,prec_5,prec_6 start="2001-01-01" increment="1 months"
 
-tr.series --o input=precip_abs method=average output=prec_average where='start_time > "2001-03-01"'
+tr.series --o input=precip_abs method=average output=prec_average where="start_time > '2001-03-01'"
 tr.series --o -t input=precip_abs method=maximum output=prec_max sort=start_time
 tr.series --o -t input=precip_abs method=sum output=prec_sum
 

Modified: grass/trunk/temporal/tr.series/tr.series.py
===================================================================
--- grass/trunk/temporal/tr.series/tr.series.py	2011-10-06 11:43:15 UTC (rev 48661)
+++ grass/trunk/temporal/tr.series/tr.series.py	2011-10-06 12:42:10 UTC (rev 48662)
@@ -110,9 +110,9 @@
         file.close()
 
         if grass.overwrite() == True:
-            grass.run_command("r.series", file=filename, output=output, overwrite=True, method=method)
+            grass.run_command("r.series", flags="z", file=filename, output=output, overwrite=True, method=method)
         else:
-            grass.run_command("r.series", file=filename, output=output, overwrite=False, method=method)
+            grass.run_command("r.series", flags="z", file=filename, output=output, overwrite=False, method=method)
 
     if add_time:
 	# Create the time range for the output map



More information about the grass-commit mailing list