Task list database table - TaskDepender

Task list database table

From TaskDepender
Jump to: navigation, search
(Implementation)
(Design)
Line 21: Line 21:
 
However, when the table is created using the AS-SELECT 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 AS-SELECT 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>.
  
The following section give the implementation of the required SQL-statements.
+
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.
 +
 
 +
Note that the alternative method using and [http://www.sqlite.org/lang_insert.html insert] statement would means that the columns must be explicitely defined whereby the design of the columns of the [[Tasks database table|tasks table]] need to be maintained at two locations, which is not preferable and unnecessary if the method above is used.
 +
The following section give the implementation of the required SQL statements.
  
 
== Implementation ==
 
== Implementation ==

Revision as of 18:07, 16 October 2011