Tasks database table

From TaskDepender
Jump to: navigation, search
(Paste tasks)
(Design)
 
Line 3: Line 3:
 
== Description ==
 
== Description ==
  
The task element is described in the [[Task_Management_Method#Task|"Task Management Method"]]. The tasks in the project are stored in a table in the project database. The name of a task does not have to be unique, a task has to have a unique id which can be generated as a integer primary key [http://www.sqlite.org/lang_createtable.html#rowid] by the database[http://www.sqlite.org/lang_createtable.html#rowid]. Since a task represents a graphical element, it has a position, a width and a height. The TaskDepender™ program uses a true-type font, and therefore the width and height will be determined when the task is displayed.
+
The task element is described in the [[Task_Management_Method#Task|"Task Management Method"]]. The tasks in the project are stored in a table in the project database. The name of a task does not have to be unique, a task has to have a unique id which can be generated as a integer primary key<ref name="primary_key">[http://www.sqlite.org/lang_createtable.html#rowid rowid - SQLite specification]</ref> by the database. Since a task represents a graphical element, it has a position, a width and a height. The TaskDepender&trade; program uses a true-type font, and therefore the width and height will be determined when the task is displayed.
  
 
== Constraints ==
 
== Constraints ==
Line 12: Line 12:
  
 
== Design ==
 
== Design ==
 
=== Definition ===
 
  
 
The tasks are stored in a table with the following columns:
 
The tasks are stored in a table with the following columns:
Line 49: Line 47:
 
* [[Tasks database table - Paste|Paste]]
 
* [[Tasks database table - Paste|Paste]]
  
 
+
== References ==
 
+
<references/>
=== Insert ===
+
 
+
Since a task can only be added in the current container, the <tt>ContainerId</tt> does not have to be supplied but can be retrieved from the [[State variables database table|<tt>StateVariables</tt>]] table.
+
 
+
=== Update ===
+
 
+
A task can only be updated when it is selected. The selected tasks are stored in the [[Selected tasks database table|selected tasks table]]. This means that the user does not have to supply the id when updating a selected task. To restrict the database to update more tasks when the selected tasks table contains more than one task, the update is [http://www.sqlite.org/lang_select.html limited] to the first element.
+
 
+
== Implementation ==
+
 
+
=== Interface structure ===
+
 
+
<syntaxhighlight lang="cpp">
+
typedef struct
+
{
+
  uint32 id,
+
  char*  name,
+
  char*  description,
+
  uint  resourceId,
+
  uint  x,
+
  uint  y,
+
  uint  width,
+
  uint  height,
+
  uint32 container_id
+
} tdd_task;
+
</syntaxhighlight>
+
 
+
=== Insert ===
+
 
+
<syntaxhighlight lang="sql">
+
INSERT INTO Tasks
+
(Name,Description, Resource, X, Y, Width, Height, ContainerId)
+
VALUES (%s, %s, %s, %d, %d, %d, %d, (SELECT Val FROM StateVariables WHERE Name='CurrentContainerId'))
+
</syntaxhighlight>
+
 
+
=== Update ===
+
 
+
<syntaxhighlight lang="sql">
+
UPDATE Tasks SET
+
  Name=%s,
+
  Description=%s,
+
  Resource=%s,
+
  X=%d,
+
  Y=%d,
+
  Width=%d,
+
  Height=%d
+
WHERE Id IN (SELECT Id FROM SelectedTasks LIMIT 1)
+
</syntaxhighlight>
+
  
  
 
----
 
----
 
* [[Database]]
 
* [[Database]]

Latest revision as of 06:42, 2 December 2011

Personal tools