Application Server Database Instances
Each application server has its own database instance and table space. It is referred to, by its unique application server database name. Application server and content database names should be equal to avoid confusion.
Hierarchical Content Database Data Model
An object oriented data model is applied, that allows to store content and server side scripts in a common relational database. Content is then generated by content generation functions of the server and the plugged-in application software. The Maxscape server API provides a convenient way to make use of the server features, hiding and encapsulating details to the application scripts. The data model implements a hierarchical view on an application sites content. Like in a usual file approach, pages are structured in a hierarchical page tree, whereas pages compares to files and categories to directories. In addition to the properties of directories and files, database categories and pages may contain text and script elements, by all means. For example you may:
- inherit properties, content and scripts to subtrees
- distinguish categories with the same name by arbitrary parameters
- give a page and a category the same name in the same category
- import arbitrary elements into the page to be displayed
- have two pages with same name distinguish by e.g. a user group
- nest page and template elements to implement a particular layout
- you name it...
So far, category, page and template elements may contain plain text, HTML/CSS, XML,
Javascript with embedded script variables, as well as functions calls
or solely Perl scripts. Any content is thinkable, as the database element fields are
of type binary. Page elements can be embedded within templates elements and vice versa,
whatever is most convenient.
The NODE table contains the information to construct the page tree.
The content of a page is stored in the DATABASE_FILE and the ELEMENTS
tables. Templates used by a page are stored in the TEMPLATES table. The NODE
table is indexed by it's NODE_CATEGORY, NODE_NAME and the unique NODE_NUMBER
fields, what speeds up execution time, dramatically. Besides the NODE_CATEGORY and the
NODE_NAME table fields, which are related to the CGI variables Category and Page,
the NODE_NUMBER of a page, is used to refer to the location of a pages, its elements
and the pages template generation method in the content database.
Application Table Definitions
Maxscape tries to make it as easy to handle database tables within application
content. To create a table in the content database, add that table's definition
in the file:
/maxscape/lib/perl/Maxscape/Database/SiteTableDefinitions.pm
to the '%::UserTableDefinitions' Perl hash, for example:
%::UserTableDefinitions = ( COMMENTS => { TableDescription => 'Comments to pages', TableColumns => [ ['COMMENTS_GROUP', 'CHAR(255) not null'], ['NUMBER', "$Integer NOT NULL AUTO_INCREMENT" ], ['CREATION_TIME', 'datetime'], ['MODIFICATION_TIME', 'datetime'], ['REPLAY', "$Integer"], ['SENDER', "char(32) $DataBase::Binary"], ['NAME', 'char(128)'], ['ATTRIBUTE', "$smallVarChar"], ['CONTENT', "$DynamicChar"], ['PRIMARY KEY', '(NUMBER, COMMENTS_GROUP)'], ], TableIndices => [ { IndexColumnName => 'COMMENTS_GROUP_KEY', keyedColumns => 'COMMENTS_GROUP, NUMBER', }, ], }, ), ...
Then issue, logged in as UNIX user maxscape:
> MaxAdmin -w 'application server name' create Table COMMENTS
to create the table. The table definitions can now be viewed via the administration server's database query interface and be dumped to a text file in the application server's 'tables' directory ('/maxscape/server/'application server'/tables').
> MaxAdmin -w 'application server name' dump Table COMMENTS
Unconventionally, a table's dump may be altered with a text editor and then be reloaded into the content database. Of course, the functions to handle an application table needs to be implemented. Maxscape supports this with a bundle of classes to create, display, edit and delete database tables.
Database Tools
There are a lot of tools out there, to administrate a rational database and to manipulate the database content. Naturally, all this tools are at your choice.