DConfig 
SourceForge.net Logo PHP Logo

Dynamic Configuration Toolkit

Database Setup

DConfig Table Diagram
DConfig Schema
Create DConfig Tables

DConfig Table Diagram      

dconfig schema

DConfig Schema      

Table: dconfig_key
Field Type Null Key Default Extra
idint(11)PRIMARYauto_increment
key_namevarchar(500)Unique
inheritedchar(1)YES'N'
date_createdtimestampCURRENT_TIMESTAMP
date_modifiedtimestampCURRENT_TIMESTAMP


Table: dconfig_attribute
Field Type Null Key Default Extra
idint, int(11)PRIMARYauto_increment
key_idint, int(11)
attribute_namevarchar(100)
data_type_aliasvarchar(10)
referencechar(1)YES'N'
attribute_valuevarchar(5000)/textYESNULL&^#; is the array element delimiter
commentsvarchar(500)/textYESNULL
date_createdtimestampCURRENT_TIMESTAMP
date_modifiedtimestampCURRENT_TIMESTAMP


Table: dconfig_datatype
Field Type Null Key Default Extra
aliasvarchar(10)PRIMARY
data_type_namevarchar(20)


Table: dconfig_system
Field Type Null Key Default Extra
attribute_namevarchar(100)PRIMARY
attribute_valuevarchar(500)/textYESNULL
date_createdtimestampCURRENT_TIMESTAMP
date_modifiedtimestampCURRENT_TIMESTAMP



Create DConfig Tables      

You can easily create DConfig tables using supplied db scripts. After download the binaries or the source code, unzip it to a local folder.

Sample db scripts (*.sql) locates under /path/to/unzipped/folder/dconfig-db/src/sql/1.0. It begins with database name and followed by tested db version. For example, derby_10.1.3.1.sql means that the script should normally work with Derby v.10.1.3.1 or later. The following is a list of db scripts bundled with the downloadable zip files.

dconfig-db/src/sql/1.0
	derby_10.1.3.1.sql
	hsqldb_1.7.3.3.sql
	h2_1.0.sql
	mysql_5.0.16.sql
	oracle_10g.sql
	postgres_8.1.5.sql
	sqlserver_2000.sql

To create DConfig tables using scripts, logon to the database as a DBA or an admin user, execute the proper db script for your database.

Create a user account 'dcfg' (Optional), and GRANT proper permissions to this account.

For example,
CREATE USER dcfg WITH LOGIN PASSWORD 'dconfig';
Grant SELECT, INSERT, UPDATE, DELETE, EXECUTE ON TABLE dconfig_key to dcfg;
Grant SELECT, INSERT, UPDATE, DELETE ON TABLE dconfig_attribute to dcfg;
Grant SELECT, INSERT, UPDATE, DELETE ON TABLE dconfig_datatype to dcfg;

If your db version is different from the version supported or if you couldn't find the scripts for your database, you may need to change the scripts in order to work.
Addtional scripts for other databases will be included in the future releases.

There are four tables in the DConfig toolkit.

Table name          Comments
----------------------------------------------------------------------------
dconfig_datatype    Saves the data types supported by DConfig toolkit
dconfig_key         DConfig keys are saved in this table
dconfig_attribute   Saves the DConfig attributes for keys
dconfig_system      Saves DConfig system values
A configuration entry consists of a dot-separated key and a set of attributes. Keys like app, db.datasource, config.view are valid. Key does not allow '.'; Other printable characters and numbers are allowed.