View source
From TaskDepender
for
Tdd create
Jump to:
navigation
,
search
{{#customtitle:'''<tt>tdd_create()</tt>'''}} ''Function to create a new TaskDepender™ database.'' == Function prototype == <syntaxhighlight lang="c"> /* * Creates the TaskDepender database in the specified file. */ HANDLE tdd_create ( char *filename // Filename of the database file to create. ) </syntaxhighlight> == Design == To create a TaskDepender database the following steps are taken. # Create a new database and open it for reading and writing. # Create the [[Tasks database table|tasks table]]. # Create the [[Deliverables database table|deliverables table]]. # Create the [[Connections database table|connections table]]. # Create the temporary [[Task list database table|task-list table]]. # Create the temporary [[Deliverable list database table|deliverable-list table]]. # Create the temporary [[Connection list database table|connection-list table]]. To open and create a new database, the <tt>[http://www.sqlite.org/c3ref/open.html sqlite3_open_v2()]</tt> is used. == Implementation == <syntaxhighlight lang="c"> HANDLE tdd_create ( char *filename // Filename of the database file to create. ) { sqlite3 *db; rc = sqlite3_open_v2(filename,&db,SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE,NULL); if(rc) { sqlite3_close(db); return &db; } // -- Create tasks table -- rc = sqlite3_exec(db, TDD_CREATE_TASKS_TABLE, NULL, NULL, &dbError ); // -- Create deliverables table -- rc = sqlite3_exec(db, TDD_CREATE_DELIVERABLES_TABLE, NULL, NULL, &dbError ); // -- Create the connections table -- rc = sqlite3_exec(db, TDD_CREATE_CONNECTIONS_TABLE, NULL, NULL, &dbError ); // -- Create the temporary task-list table -- rc = sqlite3_exec(db, TDD_CREATE_TASKLIST_TABLE, NULL, NULL, &dbError ); // -- Create the temporary deliverable-list table -- rc = sqlite3_exec(db, TDD_CREATE_TASKS_TABLE, NULL, NULL, &dbError ); // -- Create the temporary connection-list table -- rc = sqlite3_exec(db, TDD_CREATE_TASKS_TABLE, NULL, NULL, &dbError ); return &db; } </syntaxhighlight> ---- * [[Database]]
Return to
Tdd create
.
Views
Page
Discussion
View source
History
Personal tools
Log in
Navigation
Main page
Recent changes
Help
Search
Toolbox
What links here
Related changes
Special pages