Task list database table - TaskDepender

Task list database table

From TaskDepender
Jump to: navigation, search
(Design)
(Design)
Line 19: Line 19:
 
Furthermore, to automatically maintain consistency, a constraint must be added to the table as well so that when the original task is deleted, the corresponding task in this table is deleted as well. Otherwise, upon deleting a task from the current diagram, an explicit statement must be executed to delete the task from this table as well in addition to deleting it from the [[Tasks database table|tasks table]].
 
Furthermore, to automatically maintain consistency, a constraint must be added to the table as well so that when the original task is deleted, the corresponding task in this table is deleted as well. Otherwise, upon deleting a task from the current diagram, an explicit statement must be executed to delete the task from this table as well in addition to deleting it from the [[Tasks database table|tasks table]].
  
However, when the table is created using the <tt>AS SELECT</tt> statement, the constraint cannot implemented yet as it cannot be part of the statement as can be seen from the syntax diagram above. Therefore, after the table is created, the table must be [http://www.sqlite.org/lang_altertable.html altered] to create a reference to the original task in the [[Tasks database table|tasks table]]. However, the [www.sqlite.org SQLite] only supports a limited subset of [http://www.sqlite.org/lang_altertable.html ALTER TABLE] and (amongst other) does not allow adding constraints to a table. Therefore, to implement the constraint, an additional column <tt>Parent</tt> is added that is referenced to the <tt>Id</tt> of the [[Tasks_database_table|tasks table]]. After creating this column, it must still be filled with the same value as the <tt>Id</tt>.
+
However, when the table is created using the <tt>AS SELECT</tt> statement, the constraint cannot be implemented yet as it cannot be part of the statement as can be seen from the syntax diagram above. Therefore, after the table is created, the table must be [http://www.sqlite.org/lang_altertable.html altered] to create a reference to the original task in the [[Tasks database table|tasks table]]. However, the [www.sqlite.org SQLite] only supports a limited subset of [http://www.sqlite.org/lang_altertable.html ALTER TABLE] and (amongst other) does not allow adding constraints to a table. Therefore, to implement the constraint, an additional column <tt>Parent</tt> is added that is referenced to the <tt>Id</tt> of the [[Tasks_database_table|tasks table]]. After creating this column, it must still be filled with the same value as the <tt>Id</tt>.
  
 
Since the table is created and filled at the same time, the table must be deleted (i.e. [http://www.sqlite.org/lang_droptable.html dropped]) when the current container changes.
 
Since the table is created and filled at the same time, the table must be deleted (i.e. [http://www.sqlite.org/lang_droptable.html dropped]) when the current container changes.

Revision as of 18:16, 16 October 2011