Open project

From TaskDepender
Jump to: navigation, search
(Implementation)
 
Line 1: Line 1:
''This page describes the method used by the [[Administration]] to open a new project.''
+
''This page describes the method to start a new project.''
  
== Introduction ==
+
== Description ==
  
To create a new project, the [[Administration]] in first instance creates a temporary database file in memory.
+
Opening a project can be a new or existing project.
  
Since only one project can be edited in the program, it must first be check whether the current database still has uncommitted actions. If this is the case, the Administration returns an error which first needs to be handled by the caller, e.g. by displaying a message box with "Save changes to the current project?".
+
The user of the [[Administration]] can request to start a new project. No name or location is to be specified for the project file yet. However, this method must handle situations in which there are still uncommitted changes in the current project since only
  
  
 +
To open an existing project, the caller must supply the filename, including the path. The Administration must handle the situation in which the file can not be found, in which case an error must be returned.
  
 
== Design ==
 
== Design ==
  
 +
== Implementation ==
 +
 +
The implementation uses the [http://www.sqlite.org/c3ref/open.html <tt>sqlite3_open_v2</tt>] function.
 +
 +
If the filename is an empty string, then a private, temporary on-disk database will be created. This private database will be automatically deleted as soon as the database connection is closed.
 +
 +
<syntaxhighlight lang="cpp">
 +
int Admin::Open(char *filename)
 +
{
 +
  int returnValue;
 +
  if( filename == NULL )
 +
  {
 +
    // Open a new project.
 +
  }
 +
  else
 +
  {
 +
    // Try to open the database.
 +
    returnValue = sqlite3_open_v2( xx, xx, xx );
 +
    if( returnValue == SQL_OK )
 +
 
 +
  }
 +
}
 +
</syntaxhighlight>
 +
 +
The following errors can be returned by the SQL-open function.
 +
 +
http://www.sqlite.org/c3ref/c_abort.html
 +
 +
The following table converts the possible SQLITE error-codes into error-codes for the [[Administration]]
 +
 +
== Design ==
 +
 +
To create a new project, the [[Administration]] in first instance creates a temporary database file in memory.
 +
 +
Since only one project can be edited in the program, it must first be check whether the current database still has uncommitted actions. If this is the case, the Administration returns an error which first needs to be handled by the caller, e.g. by displaying a message box with "''Save changes to the current project?''".
  
  
 
== Implementation ==
 
== Implementation ==

Latest revision as of 09:47, 23 October 2011

Personal tools