From Eclipsepedia

Jump to: navigation, search


ProjectInfo Database Schema

The following is the schema for a pair of tables to replace the existing project-info.xml system and other database and XML files associated with project data. See Key Definitions for a list of they keys and the data they hold.

There is a master table (ProjectInfo) which stores all of the keys which link into the sub-table (ProjectInfoValues). The two tables are tied together by an auto-generated sequence ProjectInfoID which is created by inserting the record into the ProjectInfo table. Having a secondary table allows for multiple values to be associated with a single key. The values table can also contain SubKeys as necessary to further classify the value.

ProjectInfo can have multiple rows for each MainKey for each ProjectID, and ProjectInfoValues can have multiple rows for each row in ProjectInfo.


ProjectInfo Database Example

Here is a mock-up of some partial data for the tools.ajdt project:


The MainKeys and SubKeys are highlighted in blue to indicate that these are the values on which you would generally query these tables. The ProjectInfoID is only used as a mapping between all of the values in the ProjectInfoValues table.

This can quite easily be queried via SQL. A number of rows together form one record which will need to be assembled as needed by the code calling the query, much as it is today from the XML files, but with a much simpler interface.

Using the ProjectInfo Database on your Phoenix pages

Two new classes have been defined for consumption by Phoenix developers. To use these classes a new function has been added to the $App Class and can be called by using the following function


This function will include the following two classes.


This class will gather and hold all of the info for a project upon creation.

    $projectInfo = new ProjectInfo('tools.ajdt');

The data that is gathered is stored in an array of ProjectInfoValue class objects. These object can be retrieved through two functions

    $projectInfo->GetValue("MainKey" [,"SubKey"]);  //This function will return the data stored in Value for the matching MainKey / SubKey
    $projectInfo->GetValueList("MainKey" [,"SubKey"]);  //This function will return an array of ProjectInfoValue objects for the matching MainKey / SubKey

There is an addition function that will flatten the data for a given ProjectInfoID. This function will return a hashed array of key / value pairs.

    $returnValue = $projectInfo->GetHashedValueList($projectInfoID);
    $name = $returnValue['name'];
    $description = $returnValue['description'];


This class is used to gather a list of ProjectInfo class objects. This class is useful when you want to gather a set or ProjectInfo that meet a certain set of criteria.

    $projectInfoList = new ProjectInfoList();

The main worker function in this class is selectProjectInfoList.

    selectProjectInfoList($ProjectInfoID [, $MainKey [, $SubKey [,$Value [,$ProjectInfoID [, $orderBy]]]]]);


    selectProjectInfoList(NULL, "mailinglist"); //This will return a list of ProjectInfo objects that have a MainKey = "mailinglist"
    selectProjectInfoList(NULL, "categories", NULL, "ENT");  //This will return a list of ProjectInfo objects that have MainKey = "categories" and Value = "ENT"

Once selectProjectInfoList has been called the ProjectInfoList object can be iterated using the getItemAt($i) and getCount() functions.

    $count = $projectInfoList->getCount();
    for ($i = 0; $i < $count; $i++) {
         $projectInfoIterator = $projectInfoList->getItemAt($i);
         $projectName = $projectInfoIterator->GetValue("projectname");