schema_add_custom_object


Description:

public bool schema_add_custom_object (string xml_description) throws Error

The internal database used by this can be 'augmented' with some user-defined database objects (such as tables or views).

This method allows one to add a new database object.

If the internal database already contains the object, then: <itemizedlist> <listitem><para>if the object is equal to the provided description then TRUE is returned</para></listitem> <listitem><para>if the object exists but differs from the provided description, then FALSE is returned, with the GDA_META_STORE_SCHEMA_OBJECT_CONFLICT_ERROR error code</para></listitem> </itemizedlist>

The xml_description defines the table of view's definition, for example: <programlisting><![CDATA[<table name="mytable"> <column name="id" pkey="TRUE"/> <column name="value"/> </table>]]></programlisting>

The partial DTD for this XML description of the object to add is the following (the top node must be a &lt;table&gt; or a &lt;view &gt;): <programlisting><![CDATA[<!ELEMENT table (column*,check*,fkey*)> <!ATTLIST table name NMTOKEN REQUIRED >

<!ELEMENT column EMPTY> <!ATTLIST column name NMTOKEN REQUIRED type CDATA IMPLIED pkey (TRUE|FALSE) IMPLIED autoinc (TRUE|FALSE) IMPLIED nullok (TRUE|FALSE) IMPLIED>

<!ELEMENT check (PCDATA)>

<!ELEMENT fkey (part+)> <!ATTLIST fkey ref_table NMTOKEN REQUIRED>

<!ELEMENT part EMPTY> <!ATTLIST part column NMTOKEN IMPLIED ref_column NMTOKEN IMPLIED>

<!ELEMENT view (definition)> <!ATTLIST view name NMTOKEN REQUIRED descr CDATA IMPLIED>

<!ELEMENT definition (PCDATA)>]]></programlisting>

Parameters:

this

a MetaStore object

xml_description

an XML description of the table or view to add to this

Returns:

TRUE if the new object has successfully been added