Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > c6d53a940aaf17b7a09d2018729b338f > files > 12

php-pear-MDB2_Schema-0.7.2-8.noarch.rpm

<html>
<head>
<title>MDB2 XML Schema documentation</title>
</head>
<body>
<center><h1>MDB2 XML Schema documentation</h1></center>
<p align="center">Manuel Lemos (<a href="mailto:&#109;&#108;e&#109;&#111;&#115;&#64;&#97;&#99;m&#46;&#111;&#114;&#103;">&#109;&#108;&#101;&#109;&#111;&#115;&#64;&#97;&#99;m&#46;o&#114;g</a>)</p>
<p align="center">Igor Feghali (<a href="mailto:&#105;&#102;&#101;&#103;&#104;&#97;li&#64;p&#104;&#112;.&#110;&#101;&#116;">&#105;&#102;&#101;&#103;&#104;&#97;&#108;&#105;&#64;p&#104;&#112;&#46;&#110;&#101;&#116;</a>)</p>
<p><b>Version control:</b> <tt>@(#) $Id: xml_schema_documentation.html,v 1.9 2006/10/21 20:45:08 ifeghali Exp $</tt></p>
<h2>Contents</h2>

<ul>
    <li><a href="#1.0.0">Introduction to XML</a></li>
    <li><a href="#2.0.0">Schema description format and XML</a></li>
    <li><a href="#3.0.0">Schema description data structure</a>
        <ul>
        <li><a href="#3.1.0">database</a></li>
        <li><a href="#3.2.0">table</a>
            <ul>
                <li><a href="#3.2.1">declaration</a></li>
                <li><a href="#3.2.2">initialization</a></li>
            </ul>
        </li>
        <li><a href="#3.3.0">sequence</a></li>
        <li><a href="#3.4.0">variable</a></li>
        </ul>
    </li>
    <li><a href="#4.0.0">Schema overview data structure</a>
        <ul>
        <li><a href="#4.1.0">Main structure</a></li>
        <li><a href="#4.2.0">Common elements</a></li>
        <li><a href="#4.3.0">Legend</a></li>
        </ul>
    </li>
</ul>


<!-- SECTION 1 -->
<h2><a name="1.0.0">Introduction to <i>XML</i></a></h2>
<p>The schema description format is based on <i>XML</i> (<i>eXtensible Markup Language</i>).  For those that are not familiar with it, <i>XML</i> is standard that specifies rules to define abstract data formats based on tagged text.</p>
<p>Like <i>HTML</i> (<i>HyperText Markup Language</i>), <i>XML</i> is also based on <i>SGML</i> (<i>Standard Generalized Markup Language</i>).  <i>SGML</i> defines rules to structure data using special text tags.</p>
<p><i>SGML</i> tags may be used to delimit data sections.  Section begin tags are of the form <tt>&lt;name attributes... &gt;</tt> and end tags are of the form <tt>&lt;/name&gt;</tt>. <tt>name</tt> is the name of the tag and <tt>attributes</tt> is a set of zero or more pairs of attribute names and the values associated with the respective tag.</p>
<p><i>XML</i> is a little stricter in the way tags may be used. While with many <i>SGML</i> formats some end tags are optional, in <i>XML</i> end tags are always required.  Also, when tag attributes are used, attribute values must be specified always between quotes.  These <i>XML</i> requirements are usually known as <b>well-formedness</b>.</p>
<p>Another important detail about XML strictness is that tag names and attributes are case sensitive.  This means that tags in upper case are distinct from tags in lower case.</p>

<!-- SECTION 2 -->
<h2><a name="2.0.0">Schema description format and <i>XML</i></a></h2>
<p>Unlike a common (but mistaken) belief, <i>XML</i> is not meant just for describing data in documents that are meant to be displayed or printed.  <i>XML</i> is a standard that defines rules for describing abstract data may be used to for any purpose.</p>
<p>Even though it may be used to schemas that may be displayed or printed, <b>Metabase</b> schema description format is meant to provide a way for developers to design their database schemas using a <i>DBMS</i> independent file format.  Using this format, developers may describe relations and properties of tables, field, indexes, sequences, etc..</p>
<p>This format uses just a subset of the <i>XML</i> known as <i>SML</i> (<i>Simplified Markup Language</i>).  <i>SML</i> formats complies with the same rules as any <i>XML</i> format but it does not use all its possibilities to make it simpler for users to write and understand the data.  For instance, files written on <i>SML</i> do not use any tag attributes.</p>
<p><b>Metabase</b> schema description format is also simpler to edit by hand because tags and constant data values should always be in lower case to save the user from holding frequently the keyboard shift key.</p>

<!-- SECTION 3 -->
<h2><a name="3.0.0">Schema description data structure</a></h2>
<p>The <b>Metabase</b> schema description format lets the developers describe a set of database schema objects following the database objects hierarchy.  This means that a database may contain tables and sequence objects, tables may contain fields and index objects and all these objects have their own attributes.</p>
<p>The definition of each database schema object contained within the begin and end tags of the respective container object. Therefore, the definition of each table and sequence has to be specified between the main database begin and end tags. Likewise, the definition of fields and indexes has to be specified between the respective table begin and end tags.</p>
<p>The properties of each schema object are also defined between the respective begin and end tags.  The values of each property are also defined between the respective property being and end tags.</p>
<p>The values of the properties are subject of validation according to the type of each property and the context within which they are being defined.</p>
<p>Some properties define names of database schema objects.  There are names that are accepted as valid for some <i>DBMS</i> that are not accepted by other <i>DBMS</i>.  <b>Metabase</b> schema parser may optionally fail if such names are used to reduce the potential problems when using the same <b>Metabase</b> based application with different <i>DBMS</i>.</p>
<p>The schema object description tags are defined as follows:</p>

<!-- DATABASE -->
<h3><a name="3.1.0"><tt>database</tt></a></h3>
<p>The <tt>database</tt> tag should be always at the top of the schema object hierarchy.  Currently it may contain the definition of two types of objects:  <tt>table</tt> and <tt>sequence</tt>.</p>
<p>The <tt>database</tt> schema object may have the following properties:</p>

<ul>

<p><li><tt>name</tt></li> (required)</p>
<p>Name of the database that is meant to be created when it is installed for the first time.</p>
<p><b>Default:</b> none</p>

<p><li><tt>create</tt></li></p>
<p>Boolean flag that indicates whether the database manager class should create the specified database or use a previously installed database of the same name.</p>
<p>This property may have to be set to <tt>0</tt> if you are splitting your database definition in multiple schema description files and only the installation of the first description file is supposed to lead to the actual database creation operation.</p>
<p>Another circumstance on which this property may have to be set to <tt>0</tt> is when the <i>DBMS</i> driver does not support database creation or if this operation requires special database administrator permissions that may not be available to the database user.</p>
<p><b>Default:</b> <tt>0</tt></p>

<p><li><tt>overwrite</tt></li></p>
<p>Boolean flag that indicates whether the database manager class should overwrite previously created structures.</p>
<p><b>Default:</b> <tt>0</tt></p>

<p><li><tt>description</tt></li></p>
<p>Free text property meant for describing the purpose of the database. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
<p><b>Default:</b> none</p>

<p><li><tt>comments</tt></li></p>
<p>Additional database comments. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
<p><b>Default:</b> none</p>

</ul>

<!-- TABLE -->
<h3><a name="3.2.0"><tt>table</tt></a></h3>
<p>The <tt>table</tt> is one of the main database schema objects.  It may be used in a schema description multiple times, once per each table that is contained the database being described.</p>
<p>The <tt>table</tt> object definition may contain the <tt>declaration</tt> and <tt>initialization</tt> sections besides the properties.  The <tt>table</tt> schema object may have the following properties:</p>

<ul>

<p><li><tt>name</tt></li> (required)</p>
<p>Name of the table.</p>
<p><b>Default:</b> none</p>

<p><li><tt>was</tt></li></p>
<p>Name that the table had before the last time it was renamed. This property is only meant to be used when the database is being upgraded and the table is meant to be renamed.</p>
<p>Beware that if this property is not specified and the <tt>name</tt> is changed, that is intended as if it is meant to drop the table with the previous name and create a new table without keeping the data that was previously stored in the table.</p>
<p><b>Default:</b> none</p>

<p><li><tt>description</tt></li></p>
<p>Free text property meant for describing the purpose of the table. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
<p><b>Default:</b> none</p>

<p><li><tt>comments</tt></li></p>
<p>Additional table comments. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
<p><b>Default:</b> none</p>

</ul>

<h4>Example</h4>
<ul>
<p><tt>&lt;table&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;users&lt;/name&gt;</tt></p>
<p><tt>&lt;declaration&gt;</tt></p>
<ul>
<p><tt>&lt;field&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;id&lt;/name&gt;</tt><br />
 <tt>&lt;type&gt;integer&lt;/type&gt;</tt><br />
 <tt>&lt;notnull&gt;1&lt;/notnull&gt;</tt><br />
 <tt>&lt;default&gt;0&lt;/default&gt;</tt></p>
</ul>
<p><tt>&lt;/field&gt;</tt><br />
 <tt>&lt;field&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;name&lt;/name&gt;</tt><br />
 <tt>&lt;type&gt;text&lt;/type&gt;</tt><br />
 <tt>&lt;length&gt;&lt;variable&gt;user_name_length&lt;/variable&gt;&lt;/length&gt;</tt></p>
</ul>
<p><tt>&lt;/field&gt;</tt></p>
</ul>
<p><tt>&lt;/declaration&gt;</tt><br />
 <tt>&lt;initialization&gt;</tt></p>
<ul>
<p><tt>&lt;insert&gt;</tt></p>
<ul>
<p><tt>&lt;field&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;id&lt;/name&gt;</tt><br />
 <tt>&lt;value&gt;1&lt;/value&gt;</tt></p>
</ul>
<p><tt>&lt;/field&gt;</tt><br />
 <tt>&lt;field&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;name&lt;/name&gt;</tt><br />
 <tt>&lt;value&gt;administrator&lt;/value&gt;</tt></p>
</ul>
<p><tt>&lt;/field&gt;</tt></p>
</ul>
<p><tt>&lt;/insert&gt;</tt></p>
</ul>
<p><tt>&lt;/initialization&gt;</tt></p>
</ul>
<p><tt>&lt;/table&gt;</tt></p>
</ul>

<!-- DECLARATION -->
<h3><a name="3.2.1"><tt>declaration</tt></a></h3>
<p><tt>declaration</tt> is one of the sections that is part of the table definition.  This section is required because it must contain the definition of the table <tt>field</tt> and <tt>index</tt> objects.</p>

<h4><tt>field</tt></h4>
<p><tt>field</tt> is one of the types of table definition object. It should be specified within the table declaration section for each field that the table should contain.</p>
<p>The <tt>field</tt> schema object may have the following properties:</p>

<ul>
    <p><li><tt>name</tt> (required)</li></p>
    <p>Name of the field.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>was</tt></li></p>
    <p>Name that the field had before the last time it was renamed. This property is only meant to be used when the database is being upgraded and the field is meant to be renamed.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>type</tt> (required)</li></p>
    <p>Type of the field.  Valid type values are: <tt>integer</tt>, <tt>text</tt>, <tt>boolean</tt>, <tt>date</tt>, <tt>timestamp</tt>, <tt>time</tt>, <tt>float</tt>, <tt>decimal</tt>, <tt>clob</tt> and <tt>blob</tt>.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>default</tt></li></p>
    <p>Default value for the field.  The allowed values depend on the type of the field.  If this property is not specified the default value is assumed to be <tt>NULL</tt>.  If there is a table index on the field being declared, the <tt>default</tt> value must be specified because indexes can not be created on table fields with <tt>NULL</tt> values.</p>
    <p>Notice that some low end <i>DBMS</i> do not support specifying default values in the field definition.  Make sure that the you either specify all the values for each new row that is inserted in the tables or that the <i>DBMS</i> actually supports default values.</p>
    <p>Only some <i>DBMS</i> support default values for large object fields. For this reason it is not allowed to specify default values on the definition of this type of field.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>notnull</tt></li></p>
    <p>Boolean flag property that specifies whether the table field should be created with the constraint <tt>NOT NULL</tt>.  As it suggests, this implies that it is not allowed to set this field value with <tt>NULL</tt>.  The parser does not allow that an index is declared on a field that is not declared with the <tt>notnull</tt> flag property.</p>
    <p><b>Default:</b> <tt>0</tt></p>

    <p><li><tt>autoincrement</tt></li></p>
    <p>Boolean flag property that specifies whether the field should be an auto incrementing not null integer field with a primary key. Note that some <i>DBMS</i> do not support auto increment natively in which case this is emulated with a trigger that updates a sequence.</p>
    <p><b>Default:</b> <tt>0</tt></p>

    <p><li><tt>unsigned</tt></li></p>
    <p>Boolean flag property that specifies whether an integer field should be declared as unsigned integer. Note that some <i>DBMS</i> do not support unsigned integer fields.  In such case the <i>DBMS</i> driver will ignore this property but it issues a warning.</p>
    <p><b>Default:</b> <tt>0</tt></p>

    <p><li><tt>length</tt></li></p>
    <p>Unsigned integer property that specifies the length of a text.  If this property is specified the text field may not have a longer length.  Text values shorter than the length are not padded.  If this property is not specified the length limit is determined by the <i>DBMS</i>.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>description</tt></li></p>
    <p>Free text property meant for describing the purpose of the field. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>comments</tt></li></p>
    <p>Additional field comments. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
    <p><b>Default:</b> none</p>
</ul>

<h5>Example</h5>
<ul>
<p><tt>&lt;field&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;id&lt;/name&gt;</tt><br />
 <tt>&lt;type&gt;integer&lt;/type&gt;</tt><br />
 <tt>&lt;notnull&gt;1&lt;/notnull&gt;</tt><br />
 <tt>&lt;default&gt;0&lt;/default&gt;</tt></p>
</ul>
<p><tt>&lt;/field&gt;</tt><br />
</p>
</ul>

<h4><tt>index</tt></h4>
<p><tt>index</tt> is another type of table definition object. It should also be specified within the table declaration section for each field that the table should contain.</p>
<p>The <tt>index</tt> schema object may have the following properties:</p>

<ul>
    <p><li><tt>name</tt> (required)</li></p>
    <p>Name of the index.</p>
    <p>Only some <i>DBMS</i> support indexes on large object fields. For this reason it is not allowed to specify a large object field for indexes.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>was</tt></li></p>
    <p>Name that the index had before the last time it was renamed. This property is only meant to be used when the database is being upgraded and the field is meant to be renamed.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>unique</tt></li></p>
    <p>Boolean flag property that specifies whether the combination of the values of the index fields on each row of the table should unique.</p>
    <p><b>Default:</b> <tt>0</tt></p>

    <p><li><tt>primary</tt></li></p>
    <p>Boolean flag property that specifies whether the combination of the values of the index fields on each row of the table should be a primary key.</p>
    <p><b>Default:</b> <tt>0</tt></p>
</ul>

<h5>index <tt>field</tt></h5>
<p><tt>field</tt> is a section that is part of the table index declaration.  It should be used once per each field on which the index should be created.</p>
<p>The index <tt>field</tt> declaration may have the following properties:</p>

<ul>
    <p><li><tt>name</tt> (required)</li></p>
    <p>Name of the field on which the index should be created.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>sorting</tt></li></p>
    <p>Type of field sorting that should be assumed when the index is created.  On <i>DBMS</i> that support index sorting, queries that search tables on the fields specified by the given index may execute faster if the specified sorting type is chosen adequately.  <i>DBMS</i> that do not support index sorting will ignore this property.</p>
    <p>Valid sorting types are <tt>ascending</tt> and <tt>descending</tt>.</p>
    <p><b>Default:</b> none</p>
</ul>

<h5>Example</h5>
<ul>
<p><tt>&lt;index&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;users_index&lt;/name&gt;</tt><br />
 <tt>&lt;field&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;id&lt;/name&gt;</tt><br />
 <tt>&lt;sorting&gt;ascending&lt;/sorting&gt;</tt></p>
</ul>
<p><tt>&lt;/field&gt;</tt></p>
</ul>
<p><tt>&lt;/index&gt;</tt><br />
</p>
</ul>

<!-- INITIALIZATION -->
<h3><a name="3.2.2"><tt>initialization</tt></a></h3>
<p><tt>initialization</tt> is another section that is part of the table definition.  This section is optional and may contain the definition of actions that should be executed when installing the database for the first time. <tt>update</tt> and <tt>delete</tt> was added in Schema version 0.7.0.</p>
<p>The available actions, in the execution order, are: </p>

<!-- INSERT -->
<h4><tt>insert</tt></h4>
<p><tt>insert</tt> is a table initialization command that specifies the values of the fields of rows that should be inserted in the respective table after the database is created for the first time.</p>
<p>The <tt>insert</tt> initialization object do not have any property.</p>

<h5>insert <tt>field</tt></h5>
<p><tt>field</tt> is a section that is part of the table insert initialization.  It should be used once per each field which should be filled with data.</p>
<p>It may have only the property <tt>name</tt>.</p>
<p>One, and only one, of the following objects should be used to specify the initial data:</p>
<ul>
    <p><li><tt>null</tt></li></p>
    <p>NULL value. Anything inside <tt>null</tt> will be ignored.</p>

    <p><li><tt>value</tt></li></p>
    <p>Plain text data.</p>

    <p><li><tt>column</tt></li></p>
    <p>Take data from the specified column of the respective table.</p>

    <p><li><tt>function</tt></li></p>
    <p>Take the output of the specified <i>DBMS</i> function.</p>

    <p><li><tt>expression</tt></li></p>
    <p>Recursive structure capable of mixing all of the above objects.</p>
</ul>

<p>When doing an <tt>insert</tt> missing fields are implicitly initialized by the <i>DBMS</i> with the respective default values.</p>

<h5>Example</h5>
<ul>
 <p><tt>&lt;insert&gt;</tt></p>
  <ul>
  <p><tt>&lt;field&gt;</tt></p>
  <ul>
   <p><tt>&lt;name&gt;foo&lt;/name&gt;</tt></p>
   <p><tt>&lt;value&gt;1601&lt;/value&gt;</tt></p>
  </ul>
  <p><tt>&lt;/field&gt;</tt></p>
  <p><tt>&lt;field&gt;</tt></p>
  <ul>
   <p><tt>&lt;name&gt;creation&lt;/name&gt;</tt></p>
   <p><tt>&lt;function&gt;</tt></p>
   <ul>
    <p><tt>&lt;name&gt;NOW&lt;/name&gt;</tt></p>
   </ul>
   <p><tt>&lt;/function&gt;</tt></p>
  </ul>
  <p><tt>&lt;/field&gt;</tt></p>
  </ul>
 <p><tt>&lt;/insert&gt;</tt></p>
</ul>

<!-- UPDATE -->
<h4><tt>update</tt></h4>
<p><tt>update</tt> is a table initialization command that replaces the values of the fields of rows, matched by a condition, in the respective table after the database is created for the first time.</p>
<p>The <tt>update</tt> initialization object do not have any property.</p>

<h5>update <tt>field</tt></h5>
<p>The update <tt>field</tt> object is defined exactly the same way as insert <tt>field</tt></p>

<h5>update <tt>where</tt></h5>
<p>The update <tt>where</tt> object, that is not required, must contain only one <tt>expression</tt> object.</p>
<p>In that case the <tt>expression</tt> object usually links operants by logical operators like AND, OR and others.</p>

<h5>Example</h5>
<ul>
 <p><tt>&lt;update&gt;</tt></p>
  <ul>
  <p><tt>&lt;field&gt;</tt></p>
  <ul>
   <p><tt>&lt;name&gt;id&lt;/name&gt;</tt><br/>
   <tt>&lt;expression&gt;</tt></p>
   <ul>
    <p><tt>&lt;column&gt;id&lt;/column&gt;</tt><br/>
    <tt>&lt;operator&gt;MINUS&lt;/operator&gt;</tt><br/>
    <tt>&lt;value&gt;10&lt;/value&gt;</tt></p>
   </ul>
   <p><tt>&lt;/expression&gt;</tt></p>
  </ul>
  <p><tt>&lt;/field&gt;</tt></p>
  </ul>
 <p><tt>&lt;/update&gt;</tt></p>
</ul>

<!-- DELETE -->
<h4><tt>delete</tt></h4>
<p><tt>delete</tt> is a table initialization command that removes rows, matched by a condition, in the respective table after the database is created for the first time.</p>
<p>The <tt>delete</tt> command definition only contains one more <tt>where</tt> section used to select the rows to be deleted.</p>
<p>The <tt>delete</tt> initialization object do not have any property.</p>

<h5>delete <tt>where</tt></h5>
<p>The delete <tt>where</tt> object must contain only one <tt>expression</tt> object.</p>
<p>In that case the <tt>expression</tt> object usually links operants by logical operators like AND, OR and others.</p>

<h5>Example</h5>
<ul>
 <p><tt>&lt;delete&gt;</tt></p>
  <ul>
  <p><tt>&lt;where&gt;</tt></p>
  <ul>
   <p><tt>&lt;expression&gt;</tt></p>
   <ul>
    <p><tt>&lt;expression&gt;</tt></p>
    <ul>
     <ul>
      <p><tt>&lt;column&gt;id&lt;/column&gt;</tt><br/>
      <tt>&lt;operator&gt;GREATER THAN&lt;/operator&gt;</tt><br/>
      <tt>&lt;value&gt;10&lt;/value&gt;</tt></p>
     </ul>
    </ul>
    <p><tt>&lt;/expression&gt;</tt><br/>
    <tt>&lt;operator&gt;AND&lt;/operator&gt;</tt><br/>
    <tt>&lt;expression&gt;</tt></p>
    <ul>
     <ul>
      <p><tt>&lt;column&gt;id&lt;/column&gt;</tt><br/>
      <tt>&lt;operator&gt;NOT EQUAL&lt;/operator&gt;</tt><br/>
      <tt>&lt;value&gt;15&lt;/value&gt;</tt></p>
     </ul>
    </ul>
    <p><tt>&lt;/expression&gt;</tt></p>
   </ul>
   <p><tt>&lt;/expression&gt;</tt></p>
  </ul>
  <p><tt>&lt;/where&gt;</tt></p>
  </ul>
 <p><tt>&lt;/delete&gt;</tt></p>
</ul>

<!-- INITIALIZATION OBJECTS -->
<h4>Complex initialization objects</h4>

<h5><tt>function</tt></h5>
<p>The <tt>function</tt> object will bind to a <i>DBMS</i> function, that can be called with any number of arguments.
<p>It may have only the property <tt>name</tt>.</p>
<p>Any of the following objects should be used, how many times it is necessary, to provide the arguments:</p>
<ul>
    <p><li><tt>value</tt></li></p>
    <p>Plain text data.</p>

    <p><li><tt>column</tt></li></p>
    <p>Take data from the specified column of the respective table.</p>

    <p><li><tt>function</tt></li></p>
    <p>You can pass a new function as an argument, although this isn't supported in the current release yet.</p>

    <p><li><tt>expression</tt></li></p>
    <p>Recursive structure capable of mixing all of the above objects.</p>
</ul>

<h5><tt>expression</tt></h5>
<p>The <tt>expression</tt> object is a recursive structure used to relate pairs of <tt>value</tt>, <tt>column</tt>, <tt>function</tt> and <tt>expression</tt> objects.
<p>The <tt>expression</tt> object do not have any property and has the exact form <tt>operant</tt> <tt>operator</tt> <tt>operant</tt>.</p>

<h6>expression <tt>operant</tt></h6>
<p>The expression <tt>operant</tt> isn't a object itself but may be represented by one of the following objects:
<ul>
    <p><li><tt>value</tt></li></p>
    <p>Plain text data.</p>

    <p><li><tt>column</tt></li></p>
    <p>Take data from the specified column of the respective table.</p>

    <p><li><tt>function</tt></li></p>
    <p>Take the output of the specified <i>DBMS</i> function.</p>

    <p><li><tt>expression</tt></li></p>
    <p>Expressions are recursive, although this isn't supported in the current release yet.</p>
</ul>

<h6>expression <tt>operator</tt></h6>
<p>Operators aren't implemented in a portable way yet. Currently the following descriptive operators are always binded to the same operators:
<table>
 <tr>
  <td>Operator</td><td>Binding</td>
 </tr>
 <tr><td>PLUS</td><td>+</td></tr>
 <tr><td>MINUS</td><td>-</td></tr>
 <tr><td>TIMES</td><td>*</td></tr>
 <tr><td>DIVIDED</td><td>/</td></tr>
 <tr><td>EQUAL</td><td>=</td></tr>
 <tr><td>NOT EQUAL</td><td>!=</td></tr>
 <tr><td>LESS THAN</td><td>&lt;</td></tr>
 <tr><td>GREATER THAN</td><td>&gt;</td></tr>
 <tr><td>LESS THAN OR EQUAL</td><td>&lt;=</td></tr>
 <tr><td>GREATER THAN OR EQUAL</td><td>&gt;=</td></tr>
</table>
<p>Any other value given to <tt>operator</tt> will be parsed with no translation.</p>
<p>Future versions of Schema may provide a common set of descriptive operators that are translated to the respective operator for your <i>DBMS</i></p>

<!-- SEQUENCE -->
<h3><a name="3.3.0"><tt>sequence</tt></a></h3>
<p>The <tt>sequence</tt> is another main database schema object.  It may be used in a schema description multiple times, once per each sequence that is contained the database being described.</p>
<p>A <tt>sequence</tt> is an object that only contains an integer value.  A sequence value is automatically incremented after every time it is fetch the next sequence value.  The fetch and increment actions constitute an atomic operation.  This means that if two concurrent accesses to the database fetch the next sequence value, they will always different values.</p>
<p>Sequences are useful to generate integer numbers that may be used to store in fields that must contain unique numbers.</p>
<p>The <tt>sequence</tt> object definition may contain one <tt>on</tt> section besides the properties.  The <tt>sequence</tt> schema object may have the following properties:</p>

<ul>
    <p><li><tt>name</tt></li> (required)</p>
    <p>Name of the sequence.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>was</tt></li></p>
    <p>Name that the sequence had before the last time it was renamed. This property is only meant to be used when the database is being upgraded and the sequence is meant to be renamed.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>start</tt></li></p>
    <p>Integer property that specifies the value that the sequence will return when it is fetched the next sequence value.</p>
    <p><b>Default:</b>1</p>

    <p><li><tt>description</tt></li></p>
    <p>Free text property meant for describing the purpose of the sequence. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
    <p><b>Default:</b> none</p>

    <p><li><tt>comments</tt></li></p>
    <p>Additional sequence comments. This field is not processed by the schema parser. It may contain text or other XML well formed tags that may be useful for embedding additional data structures for documentation applications or other purposes.</p>
    <p><b>Default:</b> none</p>
</ul>

<h4>sequence <tt>on</tt></h4>
<p>The sequence <tt>on</tt> <tt>table</tt> <tt>field</tt> section specifies a table field on which the sequence value should be synchronized.</p>
<p>This information is meant to be used only by the database manager class when it is added a sequence later after the database has been installed for the first time.  If the sequence <tt>on</tt> is specified, the database manager class will override the sequence <tt>start</tt> value with a value that is higher than the highest value in the specified field table.  Therefore, the specified field table type must be integer.</p>

<h4>Example</h4>
<ul>
<p><tt>&lt;sequence&gt;</tt></p>
<ul>
<p><tt>&lt;name&gt;users_sequence&lt;/name&gt;</tt><br />
 <tt>&lt;start&gt;1&lt;/start&gt;</tt><br />
 <tt>&lt;on&gt;</tt></p>
<ul>
<p><tt>&lt;field&gt;id&lt;/field&gt;</tt><br />
 <tt>&lt;table&gt;users&lt;/table&gt;</tt></p>
</ul>
<p><tt>&lt;/on&gt;</tt></p>
</ul>
<p><tt>&lt;/sequence&gt;</tt><br />
</p>
</ul>

<!-- VARIABLE -->
<h3><a name="3.4.0"><tt>variable</tt></a></h3>
<p>The <tt>variable</tt> tag is not meant to define any database schema object but rather a means to replace property values with variables defined at parsing time.</p>
<p>For instance, if you have several tables that store user names in text fields with the same length limit, instead of hard coding the length value in all field definitions, you may use a variable reference.  The parser will replace variable references found in property definitions by the text values of the respective values passed to the parser.</p>
<p>The parser will issue an error if it find a reference for a variable that is not defined.</p>

<!-- SECTION 4 -->
<h2><a name="4.0.0">Schema overview data structure</a></h2>
<h3><a name="4.1.0">Main structure</a></h3>
<ul><p><tt>&lt;database&gt;</tt></p>
<ul><p>
 <tt>&lt;name/&gt;</tt><br/>
 <tt>&lt;create/&gt;?</tt><br/>
 <tt>&lt;overwrite/&gt;?</tt><br/>
 <tt>&lt;description/&gt;?</tt><br/>
 <tt>&lt;comments/&gt;?</tt><br/>
 <br/>
 <tt>&lt;table&gt;</tt><br/>
 <ul><p>
  <tt>&lt;name/&gt;</tt><br/>
  <tt>&lt;was/&gt;</tt><br/>
  <tt>&lt;description/&gt;</tt><br/>
  <tt>&lt;comments/&gt;</tt><br/>
  <br/>
  <tt>&lt;declaration&gt;</tt><br/>
  <ul><p>
   <tt>&lt;field&gt;</tt><br/>
   <ul><p>
    <tt>&lt;name/&gt;</tt><br/>
    <tt>&lt;was/&gt;</tt><br/>
    <tt>&lt;type/&gt;</tt><br/>
    <tt>&lt;default/&gt;</tt><br/>
    <tt>&lt;notnull/&gt;</tt><br/>
    <tt>&lt;autoincrement/&gt;</tt><br/>
    <tt>&lt;unsigned/&gt;</tt><br/>
    <tt>&lt;description/&gt;</tt><br/>
    <tt>&lt;comments/&gt;</tt><br/>
    <tt>&lt;length/&gt;</tt><br/>
   </ul></p>
   <tt>&lt;/field&gt;+</tt><br/>
   <tt>&lt;index&gt;</tt><br/>
   <ul><p>
    <tt>&lt;name/&gt;</tt><br/>
    <tt>&lt;was/&gt;?</tt><br/>
    <tt>&lt;unique/&gt;?</tt><br/>
    <tt>&lt;primary/&gt;?</tt><br/>
    <tt>&lt;field&gt;</tt><br/>
    <ul><p>
     <tt>&lt;name/&gt;</tt><br/>
     <tt>&lt;sorting/&gt;</tt><br/>
    </ul></p>
    <tt>&lt;/field&gt;+</tt><br/>
   </ul></p>
   <tt>&lt;/index&gt;*</tt><br/>
  </ul></p>
  <tt>&lt;/declaration&gt;</tt><br/>

  <tt>&lt;initialization&gt;</tt><br/>
  <ul><p>
   <tt>&lt;insert&gt;</tt>
   <ul><p>
    <tt>{field}+</tt>
   </ul></p>
   <tt>&lt;/insert&gt;*</tt><br/>

   <tt>&lt;update&gt;</tt><br/>
   <ul><p>
    <tt>{field}+</tt><br/>
    <tt>&lt;where&gt;</tt><br/>
    <ul><p>
     <tt>{expression}</tt><br/>
    </ul></p>
    <tt>&lt;/where&gt;?</tt><br/>
   </ul></p>
   <tt>&lt;/update&gt;*</tt><br/>

   <tt>&lt;delete&gt;</tt><br/>
   <ul><p>
    <tt>&lt;where&gt;</tt><br/>
    <ul><p>
     <tt>{expression}</tt><br/>
    </ul></p>
    <tt>&lt;/where&gt;</tt><br/>
   </ul></p>
   <tt>&lt;/delete&gt;*</tt><br/>
  </ul></p>
  <tt>&lt;/initialization&gt;</tt><br/>
 </p></ul>
 <tt>&lt;/table&gt;+</tt><br/>


 <tt>&lt;sequence&gt;</tt><br/>
 <ul><p>
  <tt>&lt;name/&gt;</tt><br/>
  <tt>&lt;was/&gt;?</tt><br/>
  <tt>&lt;start/&gt;?</tt><br/>

  <tt>&lt;on&gt;</tt><br/>
  <ul><p>
   <tt>&lt;table/&gt;</tt><br/>
   <tt>&lt;field/&gt;+</tt><br/>
  </ul></p>
  <tt>&lt;/on&gt;</tt><br/>

  <tt>&lt;description/&gt;?</tt><br/>
  <tt>&lt;comments/&gt;?</tt><br/>
 </ul></p>
 <tt>&lt;/sequence&gt;?</tt><br/>

</p></ul>
<p><tt>&lt;/database&gt;</tt><br/></p>
</ul>

<h3><a name="4.2.0">Common Elements</a></h3>
<ul>
 <li>{field}</li>
 <ul>
 <p><tt>&lt;field&gt;</tt></p>
  <ul>
  <p><tt>&lt;name/&gt;<br/>
  &lt;null/&gt; or &lt;value/&gt; or &lt;column/&gt; or {function} or {expression}</tt></p>
  </ul>
 <p><tt>&lt;/field&gt;</tt></p>
 </ul>

 <li>{function}</li>
 <ul>
 <p><tt>&lt;function&gt;</tt></p>
  <ul>
  <p><tt>&lt;name/&gt;<br/>
  (&nbsp;&lt;value/&gt; or &lt;column/&gt; or {function} or {expression}&nbsp;)+</tt></t>
  </ul>
 <p><tt>&lt;/function&gt;</tt></p>
 </ul>

 <li>{expression}</li>
 <ul>
 <p><tt>&lt;expression&gt;</tt></p>
  <ul>
  <p><tt>&lt;value/&gt; or &lt;column/&gt; or {function} or {expression}<br/>
  &lt;operator/&gt;<br/>
  &lt;value/&gt; or &lt;column/&gt; or {function} or {expression}</tt></p>
  </ul>
 <p><tt>&lt;/expression&gt;</tt></p>
 </ul>
 </ul>

<h3><a name="4.3.0">Legend</a></h3>
<ul>
 <li>{tag} common element</li>
 <li>&lt;tag/&gt; stands for &lt;tag&gt;STRING&lt;/tag&gt;</li>
 <li>? Zero or one</li>
 <li>* Zero or more</li>
 <li>+ More than one</li>
</ul>

</body>
</html>