Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]
This class represent one XMLDB table
Copyright: | 1999 onwards Martin Dougiamas http://dougiamas.com |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 859 lines (28 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
xmldb_table:: (30 methods):
__construct()
addField()
addKey()
addIndex()
getFields()
getKeys()
getIndexes()
getField()
findFieldInArray()
orderFields()
getKey()
findKeyInArray()
orderKeys()
getIndex()
findIndexInArray()
orderIndexes()
setFields()
setKeys()
setIndexes()
deleteField()
deleteKey()
deleteIndex()
arr2xmldb_table()
calculateHash()
validateDefinition()
xmlOutput()
add_field()
add_key()
add_index()
getAllErrors()
Class: xmldb_table - X-Ref
__construct($name) X-Ref |
Creates one new xmldb_table param: string $name |
addField($field, $after=null) X-Ref |
Add one field to the table, allowing to specify the desired order If it's not specified, then the field is added at the end param: xmldb_field $field param: xmldb_object $after return: xmldb_field |
addKey($key, $after=null) X-Ref |
Add one key to the table, allowing to specify the desired order If it's not specified, then the key is added at the end param: xmldb_key $key param: xmldb_object $after |
addIndex($index, $after=null) X-Ref |
Add one index to the table, allowing to specify the desired order If it's not specified, then the index is added at the end param: xmldb_index $index param: xmldb_object $after |
getFields() X-Ref |
This function will return the array of fields in the table return: xmldb_field[] |
getKeys() X-Ref |
This function will return the array of keys in the table return: xmldb_key[] |
getIndexes() X-Ref |
This function will return the array of indexes in the table return: xmldb_index[] |
getField($fieldname) X-Ref |
Returns one xmldb_field param: string $fieldname return: xmldb_field|null |
findFieldInArray($fieldname) X-Ref |
Returns the position of one field in the array. param: string $fieldname return: int|null index of the field, or null if not found. |
orderFields() X-Ref |
This function will reorder the array of fields return: bool whether the reordering succeeded. |
getKey($keyname) X-Ref |
Returns one xmldb_key param: string $keyname return: xmldb_key|null |
findKeyInArray($keyname) X-Ref |
Returns the position of one key in the array. param: string $keyname return: int|null index of the key, or null if not found. |
orderKeys() X-Ref |
This function will reorder the array of keys return: bool whether the reordering succeeded. |
getIndex($indexname) X-Ref |
Returns one xmldb_index param: string $indexname return: xmldb_index|null |
findIndexInArray($indexname) X-Ref |
Returns the position of one index in the array. param: string $indexname return: int|null index of the index, or null if not found. |
orderIndexes() X-Ref |
This function will reorder the array of indexes return: bool whether the reordering succeeded. |
setFields($fields) X-Ref |
This function will set the array of fields in the table param: xmldb_field[] $fields |
setKeys($keys) X-Ref |
This function will set the array of keys in the table param: xmldb_key[] $keys |
setIndexes($indexes) X-Ref |
This function will set the array of indexes in the table param: xmldb_index[] $indexes |
deleteField($fieldname) X-Ref |
Delete one field from the table param: string $fieldname |
deleteKey($keyname) X-Ref |
Delete one key from the table param: string $keyname |
deleteIndex($indexname) X-Ref |
Delete one index from the table param: string $indexname |
arr2xmldb_table($xmlarr) X-Ref |
Load data from XML to the table param: array $xmlarr return: bool success |
calculateHash($recursive = false) X-Ref |
This function calculate and set the hash of one xmldb_table param: bool $recursive |
validateDefinition(xmldb_table $xmldb_table=null) X-Ref |
Validates the table restrictions (does not validate child elements). The error message should not be localised because it is intended for developers, end users and admins should never see these problems! param: xmldb_table $xmldb_table optional when object is table return: string null if ok, error message if problem found |
xmlOutput() X-Ref |
This function will output the XML text for one table return: string |
add_field($name, $type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $default=null, $previous=null) X-Ref |
This function will add one new field to the table with all its attributes defined param: string $name name of the field param: int $type XMLDB_TYPE_INTEGER, XMLDB_TYPE_NUMBER, XMLDB_TYPE_CHAR, XMLDB_TYPE_TEXT, XMLDB_TYPE_BINARY param: string $precision length for integers and chars, two-comma separated numbers for numbers param: bool $unsigned XMLDB_UNSIGNED or null (or false) param: bool $notnull XMLDB_NOTNULL or null (or false) param: bool $sequence XMLDB_SEQUENCE or null (or false) param: mixed $default meaningful default o null (or false) param: xmldb_object $previous name of the previous field in the table or null (or false) return: xmlddb_field |
add_key($name, $type, $fields, $reftable=null, $reffields=null) X-Ref |
This function will add one new key to the table with all its attributes defined param: string $name name of the key param: int $type XMLDB_KEY_PRIMARY, XMLDB_KEY_UNIQUE, XMLDB_KEY_FOREIGN param: array $fields an array of fieldnames to build the key over param: string $reftable name of the table the FK points to or null param: array $reffields an array of fieldnames in the FK table or null |
add_index($name, $type, $fields, $hints = array() X-Ref |
This function will add one new index to the table with all its attributes defined param: string $name name of the index param: int $type XMLDB_INDEX_UNIQUE, XMLDB_INDEX_NOTUNIQUE param: array $fields an array of fieldnames to build the index over param: array $hints optional index type hints |
getAllErrors() X-Ref |
This function will return all the errors found in one table looking recursively inside each field/key/index. Returns an array of errors or false |