Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Public Member Functions | |
__construct ($name, $type=null, $fields=array(), $hints=array()) | |
Creates one new xmldb_index. | |
arr2xmldb_index ($xmlarr) | |
Load data from XML to the index. | |
calculateHash ($recursive=false) | |
This function calculate and set the hash of one xmldb_index @retur nvoid, changes $this->hash. | |
checkName () | |
This function will check if one key name is ok or no (true/false) only lowercase a-z, 0-9 and _ are allowed. | |
checkNameValues ($arr) | |
This function will check that all the elements in one array have a correct name [a-z0-9_]. | |
comma2array ($string) | |
Returns one array of elements from one comma separated string, supporting quoted strings containing commas and concat function calls. | |
debug ($message) | |
This function will perform the central debug of all the XMLDB classes being called automatically every time one error is found. | |
findObjectInArray ($objectname, $arr) | |
Returns the position of one object in the array. | |
fixPrevNext (&$arr) | |
Reconstruct previous/next attributes. | |
getComment () | |
This function returns the comment of one xmldb_object. | |
getError () | |
This function will return the error detected in the object. | |
getFields () | |
Get the index fields. | |
getHash () | |
This function returns the hash of one xmldb_object. | |
getHints () | |
Returns optional index hints. | |
getName () | |
This function will return the name of the xmldb_object. | |
getNext () | |
This function will return the name of the next xmldb_object. | |
getPHP () | |
Returns the PHP code needed to define one xmldb_index. | |
getPrevious () | |
This function will return the name of the previous xmldb_object. | |
getUnique () | |
Get the index unique. | |
hasChanged () | |
This function returns true/false, if the xmldb_object has changed. | |
isLoaded () | |
This function returns true/false, if the xmldb_object has been loaded. | |
orderElements ($arr) | |
This function will order all the elements in one array, following the previous/next rules. | |
readableInfo () | |
Shows info in a readable format. | |
set_attributes ($type, $fields, $hints=array()) | |
Set all the attributes of one xmldb_index. | |
setChanged ($changed=true) | |
This function will set the changed field of the xmldb_object. | |
setComment ($comment) | |
This function will set the comment of the xmldb_object. | |
setFields ($fields) | |
Set the index fields. | |
setFromADOIndex ($adoindex) | |
This function will set all the attributes of the xmldb_index object based on information passed in one ADOindex. | |
setHash ($hash) | |
This function will set the hash of the xmldb_object. | |
setHints ($hints) | |
Set optional index hints. | |
setLoaded ($loaded=true) | |
This function will set the loaded field of the xmldb_object. | |
setName ($name) | |
This function will set the name field of the xmldb_object. | |
setNext ($next) | |
This function will set the next of the xmldb_object. | |
setPrevious ($previous) | |
This function will set the previous of the xmldb_object. | |
setUnique ($unique=true) | |
Set the index unique. | |
validateDefinition (xmldb_table $xmldb_table=null) | |
Validates the index restrictions. | |
xmlOutput () | |
This function will output the XML text for one index. | |
Public Attributes | |
max const | INDEX_COMPOSED_MAX_BYTES = 999 |
Note: | |
single const | INDEX_MAX_BYTES = 765 |
Note: | |
xmldb_index::__construct | ( | $name, | |
$type = null, | |||
$fields = array(), | |||
$hints = array() ) |
Creates one new xmldb_index.
string | $name | |
string | $type | XMLDB_INDEX_UNIQUE, XMLDB_INDEX_NOTUNIQUE |
array | $fields | an array of fieldnames to build the index over |
array | $hints | an array of optional hints |
xmldb_index::arr2xmldb_index | ( | $xmlarr | ) |
Load data from XML to the index.
$xmlarr | array |
bool |
|
inherited |
This function will check if one key name is ok or no (true/false) only lowercase a-z, 0-9 and _ are allowed.
bool |
|
inherited |
This function will check that all the elements in one array have a correct name [a-z0-9_].
array | $arr |
bool |
|
inherited |
Returns one array of elements from one comma separated string, supporting quoted strings containing commas and concat function calls.
string | $string |
array |
|
inherited |
This function will perform the central debug of all the XMLDB classes being called automatically every time one error is found.
Apart from the main actions performed in it (XMLDB agnostic) it looks for one function called xmldb_debug() and invokes it, passing both the message code and the whole object. So, to perform custom debugging just add such function to your libs.
Call to the external hook function can be disabled by request by defining XMLDB_SKIP_DEBUG_HOOK
string | $message |
|
inherited |
Returns the position of one object in the array.
string | $objectname | |
array | $arr |
mixed |
|
inherited |
Reconstruct previous/next attributes.
array | $arr |
bool | true if $arr modified |
|
inherited |
This function returns the comment of one xmldb_object.
string |
|
inherited |
This function will return the error detected in the object.
string |
xmldb_index::getFields | ( | ) |
Get the index fields.
array |
|
inherited |
This function returns the hash of one xmldb_object.
string |
xmldb_index::getHints | ( | ) |
Returns optional index hints.
array |
|
inherited |
This function will return the name of the xmldb_object.
string |
|
inherited |
This function will return the name of the next xmldb_object.
string |
xmldb_index::getPHP | ( | ) |
Returns the PHP code needed to define one xmldb_index.
string |
|
inherited |
This function will return the name of the previous xmldb_object.
string |
xmldb_index::getUnique | ( | ) |
Get the index unique.
bool |
|
inherited |
This function returns true/false, if the xmldb_object has changed.
bool |
|
inherited |
This function returns true/false, if the xmldb_object has been loaded.
bool |
|
inherited |
This function will order all the elements in one array, following the previous/next rules.
array | $arr |
array|bool |
xmldb_index::readableInfo | ( | ) |
xmldb_index::set_attributes | ( | $type, | |
$fields, | |||
$hints = array() ) |
Set all the attributes of one xmldb_index.
string | type XMLDB_INDEX_UNIQUE, XMLDB_INDEX_NOTUNIQUE | |
array | fields an array of fieldnames to build the index over | |
array | $hints | array of optional hints |
|
inherited |
This function will set the changed field of the xmldb_object.
bool | $changed |
|
inherited |
This function will set the comment of the xmldb_object.
string | $comment |
xmldb_index::setFields | ( | $fields | ) |
Set the index fields.
array | $fields |
xmldb_index::setFromADOIndex | ( | $adoindex | ) |
This function will set all the attributes of the xmldb_index object based on information passed in one ADOindex.
array |
void |
|
inherited |
This function will set the hash of the xmldb_object.
string | $hash |
xmldb_index::setHints | ( | $hints | ) |
Set optional index hints.
array | $hints |
|
inherited |
This function will set the loaded field of the xmldb_object.
bool | $loaded |
|
inherited |
This function will set the name field of the xmldb_object.
string | $name |
|
inherited |
This function will set the next of the xmldb_object.
string | $next |
|
inherited |
This function will set the previous of the xmldb_object.
string | $previous |
xmldb_index::setUnique | ( | $unique = true | ) |
Set the index unique.
bool | $unique |
xmldb_index::validateDefinition | ( | xmldb_table | $xmldb_table = null | ) |
Validates the index restrictions.
The error message should not be localised because it is intended for developers, end users and admins should never see these problems!
xmldb_table | $xmldb_table | optional when object is table |
string | null if ok, error message if problem found |
Reimplemented from xmldb_object.
xmldb_index::xmlOutput | ( | ) |
This function will output the XML text for one index.
string |
max const xmldb_index::INDEX_COMPOSED_MAX_BYTES = 999 |
Note:
length of composed indexes, one utf-8 char is 3 bytes in the worst case
single const xmldb_index::INDEX_MAX_BYTES = 765 |
Note:
column index length limit, one utf-8 char is 3 bytes in the worst case