Moodle  2.2.1
http://www.collinsharper.com
xmldb_table Class Reference

This class represent one XMLDB table. More...

Inheritance diagram for xmldb_table:
Collaboration diagram for xmldb_table:

Public Member Functions

 __construct ($name)
 addField (&$field, $after=NULL)
 addKey (&$key, $after=NULL)
 addIndex (&$index, $after=NULL)
getFields ()
getKeys ()
getIndexes ()
getField ($fieldname)
findFieldInArray ($fieldname)
 orderFields ()
getKey ($keyname)
findKeyInArray ($keyname)
 orderKeys ()
getIndex ($indexname)
findIndexInArray ($indexname)
 orderIndexes ()
 setFields ($fields)
 setKeys ($keys)
 setIndexes ($indexes)
 deleteField ($fieldname)
 deleteKey ($keyname)
 deleteIndex ($indexname)
 arr2xmldb_table ($xmlarr)
 calculateHash ($recursive=false)
 xmlOutput ()
 addFieldInfo ($name, $type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $enum=null, $enumvalues=null, $default=null, $previous=null)
 add_field ($name, $type, $precision=null, $unsigned=null, $notnull=null, $sequence=null, $default=null, $previous=null)
 Deprecated API ends here.
 addKeyInfo ($name, $type, $fields, $reftable=null, $reffields=null)
 add_key ($name, $type, $fields, $reftable=null, $reffields=null)
 Deprecated API ends here.
 addIndexInfo ($name, $type, $fields)
 add_index ($name, $type, $fields)
 Deprecated API ends here.
 getAllErrors ()

Data Fields

 $fields
 $keys
 $indexes

Detailed Description

This class represent one XMLDB table.

Definition at line 29 of file xmldb_table.php.


Constructor & Destructor Documentation

__construct ( name)

Creates one new xmldb_table

Reimplemented from xmldb_object.

Reimplemented in XMLDBTable.

Definition at line 38 of file xmldb_table.php.


Member Function Documentation

add_field ( name,
type,
precision = null,
unsigned = null,
notnull = null,
sequence = null,
default = null,
previous = null 
)

Deprecated API ends here.

This function will add one new field to the table with all its attributes defined

Parameters:
stringname name of the field
stringtype XMLDB_TYPE_INTEGER, XMLDB_TYPE_NUMBER, XMLDB_TYPE_CHAR, XMLDB_TYPE_TEXT, XMLDB_TYPE_BINARY
stringprecision length for integers and chars, two-comma separated numbers for numbers and 'small', 'medium', 'big' for texts and binaries
stringunsigned XMLDB_UNSIGNED or null (or false)
stringnotnull XMLDB_NOTNULL or null (or false)
stringsequence XMLDB_SEQUENCE or null (or false)
stringdefault meaningful default o null (or false)
stringprevious name of the previous field in the table or null (or false)

Definition at line 734 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_index ( name,
type,
fields 
)

Deprecated API ends here.

This function will add one new index to the table with all its attributes defined

Parameters:
stringname name of the index
stringtype XMLDB_INDEX_UNIQUE, XMLDB_INDEX_NOTUNIQUE
arrayfields an array of fieldnames to build the index over

Definition at line 787 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_key ( name,
type,
fields,
reftable = null,
reffields = null 
)

Deprecated API ends here.

This function will add one new key to the table with all its attributes defined

Parameters:
stringname name of the key
stringtype XMLDB_KEY_PRIMARY, XMLDB_KEY_UNIQUE, XMLDB_KEY_FOREIGN
arrayfields an array of fieldnames to build the key over
stringreftable name of the table the FK points to or null
arrayreffields an array of fieldnames in the FK table or null

Definition at line 763 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addField ( &$  field,
after = NULL 
)

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

Detect duplicates first

Calculate the previous and next fields

Set current field previous and next attributes

Some more attributes

Add the new field

Reorder the field

Recalculate the hash

We have one new field, so the table has changed

Definition at line 49 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addFieldInfo ( name,
type,
precision = null,
unsigned = null,
notnull = null,
sequence = null,
enum = null,
enumvalues = null,
default = null,
previous = null 
)

TODO: Delete for 2.1 (deprecated in 2.0). Deprecated API starts here

Definition at line 709 of file xmldb_table.php.

Here is the call graph for this function:

addIndex ( &$  index,
after = NULL 
)

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

Detect duplicates first

Calculate the previous and next indexes

Set current index previous and next attributes

Some more attributes

Add the new index

Reorder the indexes

Recalculate the hash

We have one new index, so the table has changed

Definition at line 151 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addIndexInfo ( name,
type,
fields 
)

TODO: Delete for 2.1 (deprecated in 2.0). Deprecated API starts here

Definition at line 770 of file xmldb_table.php.

Here is the call graph for this function:

addKey ( &$  key,
after = NULL 
)

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

Detect duplicates first

Calculate the previous and next keys

Set current key previous and next attributes

Some more attributes

Add the new key

Reorder the keys

Recalculate the hash

We have one new field, so the table has changed

Definition at line 101 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addKeyInfo ( name,
type,
fields,
reftable = null,
reffields = null 
)

TODO: Delete for 2.1 (deprecated in 2.0). Deprecated API starts here

Definition at line 744 of file xmldb_table.php.

Here is the call graph for this function:

arr2xmldb_table ( xmlarr)

Load data from XML to the table

Debug the table traverse_xmlize($xmlarr); //Debug print_object ($GLOBALS['traverse_array']); //Debug $GLOBALS['traverse_array']=""; //Debug

Process table attributes (name, comment, previoustable and nexttable)

Iterate over fields

Perform some general checks over fields

Check field names are ok (lowercase, a-z _-)

Check previous & next are ok (duplicates and existing fields)

Order fields

Iterate over keys

Perform some general checks over keys

Check keys names are ok (lowercase, a-z _-)

Check previous & next are ok (duplicates and existing keys)

Order keys

TODO: Only one PK TODO: Not keys with repeated fields TODO: Check fields and reffieds exist in table

Iterate over indexes

Perform some general checks over indexes

Check field names are ok (lowercase, a-z _-)

Check previous & next are ok (duplicates and existing INDEXES)

Order indexes

TODO: Not indexes with repeated fields TODO: Check fields exist in table

Set some attributes

Definition at line 444 of file xmldb_table.php.

Here is the call graph for this function:

calculateHash ( recursive = false)

This function calculate and set the hash of one xmldb_table

Definition at line 626 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

deleteField ( fieldname)

Delete one field from the table

Look for prev and next field

Change their previous and next attributes

Delete the field

Reorder the whole structure

Recalculate the hash

We have one deleted field, so the table has changed

Definition at line 357 of file xmldb_table.php.

Here is the call graph for this function:

deleteIndex ( indexname)

Delete one index from the table

Look for prev and next index

Change their previous and next attributes

Delete the index

Reorder the indexes

Recalculate the hash

We have one deleted index, so the table has changed

Definition at line 415 of file xmldb_table.php.

Here is the call graph for this function:

deleteKey ( keyname)

Delete one key from the table

Look for prev and next key

Change their previous and next attributes

Delete the key

Reorder the Keys

Recalculate the hash

We have one deleted key, so the table has changed

Definition at line 386 of file xmldb_table.php.

Here is the call graph for this function:

& findFieldInArray ( fieldname)

Returns the position of one field in the array.

Definition at line 234 of file xmldb_table.php.

Here is the caller graph for this function:

& findIndexInArray ( indexname)

Returns the position of one index in the array.

Definition at line 310 of file xmldb_table.php.

Here is the caller graph for this function:

& findKeyInArray ( keyname)

Returns the position of one key in the array.

Definition at line 272 of file xmldb_table.php.

Here is the caller graph for this function:

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

First the table itself

Delegate to fields

Delegate to keys

Delegate to indexes

Return decision

Definition at line 797 of file xmldb_table.php.

Here is the call graph for this function:

& getField ( fieldname)

Returns one xmldb_field

Definition at line 222 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

& getFields ( )

This function will return the array of fields in the table

Definition at line 201 of file xmldb_table.php.

Here is the caller graph for this function:

& getIndex ( indexname)

Returns one xmldb_index

Definition at line 298 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

& getIndexes ( )

This function will return the array of indexes in the table

Definition at line 215 of file xmldb_table.php.

Here is the caller graph for this function:

& getKey ( keyname)

Returns one xmldb_key

Definition at line 260 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

& getKeys ( )

This function will return the array of keys in the table

Definition at line 208 of file xmldb_table.php.

Here is the caller graph for this function:

This function will reorder the array of fields

Definition at line 247 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

This function will reorder the array of indexes

Definition at line 323 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

orderKeys ( )

This function will reorder the array of keys

Definition at line 285 of file xmldb_table.php.

Here is the call graph for this function:

Here is the caller graph for this function:

setFields ( fields)

This function will set the array of fields in the table

Definition at line 336 of file xmldb_table.php.

Here is the caller graph for this function:

setIndexes ( indexes)

This function will set the array of indexes in the table

Definition at line 350 of file xmldb_table.php.

Here is the caller graph for this function:

setKeys ( keys)

This function will set the array of keys in the table

Definition at line 343 of file xmldb_table.php.

Here is the caller graph for this function:

xmlOutput ( )

This function will output the XML text for one table

Now the fields

Now the keys

Now the indexes

Definition at line 665 of file xmldb_table.php.


Field Documentation

$fields

Definition at line 31 of file xmldb_table.php.

$indexes

Definition at line 33 of file xmldb_table.php.

$keys

Definition at line 32 of file xmldb_table.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations