Procházet zdrojové kódy

Documentation update

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51227 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert před 13 roky
rodič
revize
e221631c2c

+ 21 - 13
lib/python/temporal/abstract_map_dataset.py

@@ -360,6 +360,10 @@ class abstract_map_dataset(abstract_dataset):
            @param dbif: The database interface to be used
            @param update: Call for each unregister statement the update from registered maps 
                           of the space time dataset. This can slow down the un-registration process significantly.
+           @param execute: If True the SQL DELETE and DROP table statements will be executed.
+                           If False the prepared SQL statements are returned and must be executed by the caller.
+
+           @return The SQL statements if execute == False, else an empty string, None in case of a failure
         """
 
         connect = False
@@ -374,9 +378,9 @@ class abstract_map_dataset(abstract_dataset):
  
             # SELECT all needed information from the database
             self.metadata.select(dbif)
-           
+
             # First we unregister from all dependent space time datasets
-            statement += self.unregister(dbif, update, False)
+            statement += self.unregister(dbif=dbif, update=update, execute=False)
 
             # Remove the strds register table
             if self.get_stds_register():
@@ -387,21 +391,12 @@ class abstract_map_dataset(abstract_dataset):
             # Delete yourself from the database, trigger functions will take care of dependencies
             statement += self.base.get_delete_statement() + ";\n"
 
-        # Remove the timestamp from the file system
-        if self.get_type() == "vect":
-	    if self.get_layer():
-		core.run_command(self.get_timestamp_module_name(), map=self.get_map_id(), layer=self.get_layer(), date="none")
-	    else:
-		core.run_command(self.get_timestamp_module_name(), map=self.get_map_id(), date="none")
-	else:
-	    core.run_command(self.get_timestamp_module_name(), map=self.get_map_id(), date="none")
-
         if execute == True:
             sql_script = ""
             sql_script += "BEGIN TRANSACTION;\n"
             sql_script += statement
             sql_script += "END TRANSACTION;"
-            print sql_script
+            # print sql_script
             try:
 		if dbmi.__name__ == "sqlite3":
 		    dbif.cursor.executescript(statement)
@@ -415,6 +410,15 @@ class abstract_map_dataset(abstract_dataset):
 
             dbif.connection.commit()
 
+        # Remove the timestamp from the file system
+        if self.get_type() == "vect":
+	    if self.get_layer():
+		core.run_command(self.get_timestamp_module_name(), map=self.get_map_id(), layer=self.get_layer(), date="none")
+	    else:
+		core.run_command(self.get_timestamp_module_name(), map=self.get_map_id(), date="none")
+	else:
+	    core.run_command(self.get_timestamp_module_name(), map=self.get_map_id(), date="none")
+
         self.reset(None)
 
         if connect == True:
@@ -432,6 +436,10 @@ class abstract_map_dataset(abstract_dataset):
            @param dbif: The database interface to be used
            @param update: Call for each unregister statement the update from registered maps 
                           of the space time dataset. This can slow down the un-registration process significantly.
+           @param execute: If True the SQL DELETE and DROP table statements will be executed.
+                           If False the prepared SQL statements are returned and must be executed by the caller.
+
+           @return The SQL statements if execute == False, else an empty string
         """
 
 	if self.get_layer():
@@ -474,7 +482,7 @@ class abstract_map_dataset(abstract_dataset):
             sql_script += "BEGIN TRANSACTION;\n"
             sql_script += statement
             sql_script += "END TRANSACTION;"
-            print sql_script
+            # print sql_script
             try:
 		if dbmi.__name__ == "sqlite3":
 		    dbif.cursor.executescript(statement)

+ 9 - 5
lib/python/temporal/abstract_space_time_dataset.py

@@ -764,9 +764,10 @@ class abstract_space_time_dataset(abstract_dataset):
            This method removes the space time dataset from the temporal database and drops its map register table
 
            @param dbif: The database interface to be used
-           @param execute: If ture the DELETE statements are executed
+           @param execute: If True the SQL DELETE and DROP table statements will be executed.
+                           If False the prepared SQL statements are returned and must be executed by the caller.
 
-           @return The DELETE SQL statements 
+           @return The SQL statements if execute == False, else an empty string
         """
         # First we need to check if maps are registered in this dataset and
         # unregister them
@@ -785,6 +786,7 @@ class abstract_space_time_dataset(abstract_dataset):
         self.metadata.select(dbif)
 
         core.verbose(_("Drop map register table: %s") %  (self.get_map_register()))
+        
         if self.get_map_register():
             rows = self.get_registered_maps("id", None, None, dbif)
             # Unregister each registered map in the table
@@ -795,7 +797,7 @@ class abstract_space_time_dataset(abstract_dataset):
 	            core.percent(count, num_maps, 1)
                     # Unregister map
                     map = self.get_new_map_instance(row["id"])
-                    statement += self.unregister_map(map, dbif, False)
+                    statement += self.unregister_map(map=map, dbif=dbif, execute=False)
                     count += 1
 	        core.percent(1, 1, 1)
                 # Safe the DROP table statement
@@ -803,6 +805,7 @@ class abstract_space_time_dataset(abstract_dataset):
 
         # Remove the primary key, the foreign keys will be removed by trigger
         statement += self.base.get_delete_statement() + ";\n"
+        
         if execute == True:
             sql_script = ""
             sql_script += "BEGIN TRANSACTION;\n"
@@ -1057,9 +1060,10 @@ class abstract_space_time_dataset(abstract_dataset):
 
            @param map: The map object to unregister
            @param dbif: The database interface to be used
-           @param execute: If ture the DELETE statements are executed
+           @param execute: If True the SQL DELETE and DROP table statements will be executed.
+                           If False the prepared SQL statements are returned and must be executed by the caller.
 
-           @return The DELETE SQL statements 
+           @return The SQL statements if execute == False, else an empty string, None in case of a failure
         """
 
         statement = ""