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:

  • if the object is equal to the provided description then TRUE is returned
  • 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

The xml_description defines the table of view's definition, for example:

<table name="mytable">
<column name="id" pkey="TRUE"/>
<column name="value"/>
</table>

The partial DTD for this XML description of the object to add is the following (the top node must be a <table> or a <view>):

<!ELEMENT table (column*,check*,fkey*,unique*)>
<!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 unique (column)>

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

<!ELEMENT definition (#PCDATA)>

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




2022 vala-language.org