This is an old revision of the document!
addAttribute
From Version 5.21.0
See Also
Structured Schema Management
Column Attributes Reference
Syntax
obj addAttribute( mixed $attribute, optional string $platform='', optional integer $priority = -1; )
The method addAttribute()
is part of the Structured Schema Management suite, and adds an attribute to the current metaObjectStructure object.
An attribute can be added to any of the available structure types, table,column,index or index-item.
Parameters
$attribute
The attribute can be provided as a string, a numeric or associative array, and can describe any parameter understood by the DBMS. For example, it might be necessary to add an option to tell the DBMS what type of database engine to use.
Platform
The platform parameter can be any parameter recognized by the Platform keyword.
Priority
The priority parameter can optionally force the system to process the attributes in a specific order. If not provided, the attributes are processed in the order provided.
$t = new metaObjectStructure($dict,'employees'); $t->addAttribute('ENGINE INNODB','mysql'); /* * Add another platform option, for IBM DB2 */ $t->addAttribute(array('TABLESPACE'=>'LARGE1'),'db2');
Alternatively, we can write the definition as:
$t = new metaObjectStructure($dict,'employees'); $t->addAttribute('ENGINE INNODB','mysql') ->addAttribute(array('TABLESPACE'=>'LARGE1'),'db2');