Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

(no description)

Copyright: 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 921 lines (38 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: view_table_php  - X-Ref

This class will show the PHP needed (upgrade block) to perform
the desired DDL action with the specified field/key/index

init()   X-Ref
Init method, every subclass will have its own


invoke()   X-Ref
Invoke method, every class will have its own
returns true/false on completion, setting both
errormsg and output as necessary


add_field_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
create one field using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to be created
return: string PHP code to be used to create the field

drop_field_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
drop one field using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to be dropped
return: string PHP code to be used to drop the field

rename_field_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
rename one field using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to be renamed
return: string PHP code to be used to rename the field

change_field_type_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
change the type of one field using XMLDB objects and functions.
Currently these conversions are supported:
integer to char
char to integer
number to char
char to number
float to char
char to float

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to change precision

change_field_precision_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
change the precision of one field using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to change precision

change_field_notnull_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
change the nullability of one field using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to change null/not null

change_field_default_php($structure, $table, $field)   X-Ref
This function will generate all the PHP code needed to
change the default of one field using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string field field name to change null/not null

add_key_php($structure, $table, $key)   X-Ref
This function will generate all the PHP code needed to
create one key using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string key key name to be created
return: string PHP code to be used to create the key

drop_key_php($structure, $table, $key)   X-Ref
This function will generate all the PHP code needed to
drop one key using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string key key name to be dropped
return: string PHP code to be used to drop the key

rename_key_php($structure, $table, $key)   X-Ref
This function will generate all the PHP code needed to
rename one key using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string key key name to be renamed
return: string PHP code to be used to rename the key

add_index_php($structure, $table, $index)   X-Ref
This function will generate all the PHP code needed to
create one index using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string index index name to be created
return: string PHP code to be used to create the index

drop_index_php($structure, $table, $index)   X-Ref
This function will generate all the PHP code needed to
drop one index using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string index index name to be dropped
return: string PHP code to be used to drop the index

rename_index_php($structure, $table, $index)   X-Ref
This function will generate all the PHP code needed to
rename one index using XMLDB objects and functions

param: xmldb_structure structure object containing all the info
param: string table table name
param: string index index name to be renamed
return: string PHP code to be used to rename the index