Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]
Abstract database driver test class providing some moodle database interface
Copyright: | 2018 Srdjan Janković, Catalyst IT |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 401 lines (11 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 4 files lib/dml/moodle_database.php lib/dml/tests/fixtures/test_sql_generator.php lib/ddl/database_manager.php lib/dml/moodle_temptables.php |
test_moodle_database:: (34 methods):
__construct()
driver_installed()
get_dbfamily()
get_dbtype()
get_dblibrary()
get_name()
get_configuration_help()
get_server_info()
allowed_param_types()
get_last_error()
set_tables()
get_tables()
get_indexes()
fetch_columns()
normalise_value()
change_database_structure()
execute()
get_recordset_sql()
get_records_sql()
get_fieldset_sql()
insert_record_raw()
insert_record()
import_record()
update_record_raw()
update_record()
set_field_select()
delete_records_select()
sql_concat()
sql_concat_join()
sql_group_concat()
begin_transaction()
commit_transaction()
rollback_transaction()
get_manager()
Class: test_moodle_database - X-Ref
Abstract database driver test class__construct($external = false) X-Ref |
Constructor - Instantiates the database param: bool $external True means that an external database is used. |
driver_installed() X-Ref |
Default implementation return: boolean true |
get_dbfamily() X-Ref |
Default implementation return: string 'test' |
get_dbtype() X-Ref |
Default implementation return: string 'test' |
get_dblibrary() X-Ref |
Default implementation return: string 'test' |
get_name() X-Ref |
Default implementation return: string 'test' |
get_configuration_help() X-Ref |
Default implementation return: string |
get_server_info() X-Ref |
Default implementation return: array |
allowed_param_types() X-Ref |
Default implementation return: int 0 |
get_last_error() X-Ref |
Returns error property return: string $error |
set_tables($tables) X-Ref |
Sets tables property param: array $tables return: void |
get_tables($usecache = true) X-Ref |
Returns keys of tables property param: bool $usecache return: array $tablenames |
get_indexes($table) X-Ref |
Return table indexes param: string $table return: array $indexes |
fetch_columns($table) X-Ref |
Return table columns param: string $table return: array database_column_info[] of database_column_info objects indexed with column names |
normalise_value($column, $value) X-Ref |
Default implementation param: \stdClass $column metadata param: mixed $value return: mixed $value |
change_database_structure($sql, $tablenames = null) X-Ref |
Default implementation param: string|array $sql param: array|null $tablenames return: bool true |
execute($sql, array $params = null) X-Ref |
Default implementation, throws Exception param: string $sql param: array $params return: bool true |
get_recordset_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0) X-Ref |
Default implementation, throws Exception param: string $sql param: array $params param: int $limitfrom param: int $limitnum return: bool true |
get_records_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0) X-Ref |
Default implementation, throws Exception param: string $sql param: array $params param: int $limitfrom param: int $limitnum return: bool true |
get_fieldset_sql($sql, array $params = null) X-Ref |
Default implementation, throws Exception param: string $sql param: array $params return: bool true |
insert_record_raw($table, $params, $returnid = true, $bulk = false, $customsequence = false) X-Ref |
Default implementation, throws Exception param: string $table param: array $params param: bool $returnid param: bool $bulk param: bool $customsequence return: bool|int true or new id |
insert_record($table, $dataobject, $returnid = true, $bulk = false) X-Ref |
Default implementation, throws Exception param: string $table param: object|array $dataobject param: bool $returnid param: bool $bulk return: bool|int true or new id |
import_record($table, $dataobject) X-Ref |
Default implementation, throws Exception param: string $table param: StdObject $dataobject return: bool true |
update_record_raw($table, $params, $bulk = false) X-Ref |
Default implementation, throws Exception param: string $table param: array $params param: bool $bulk return: bool true |
update_record($table, $dataobject, $bulk = false) X-Ref |
Default implementation, throws Exception param: string $table param: StdObject $dataobject param: bool $bulk return: bool true |
set_field_select($table, $newfield, $newvalue, $select, array $params = null) X-Ref |
Default implementation, throws Exception param: string $table param: string $newfield param: string $newvalue param: string $select param: array $params return: bool true |
delete_records_select($table, $select, array $params = null) X-Ref |
Default implementation, throws Exception param: string $table param: string $select param: array $params return: bool true |
sql_concat() X-Ref |
Default implementation, throws Exception return: string $sql |
sql_concat_join($separator = "' '", $elements = []) X-Ref |
Default implementation, throws Exception param: string $separator param: array $elements return: string $sql |
sql_group_concat(string $field, string $separator = ', ', string $sort = '') X-Ref |
Default implementation, throws Exception param: string $field param: string $separator param: string $sort return: string |
begin_transaction() X-Ref |
Default implementation, throws Exception return: void |
commit_transaction() X-Ref |
Default implementation, throws Exception return: void |
rollback_transaction() X-Ref |
Default implementation, throws Exception return: void |
get_manager() X-Ref |
Returns the database manager used for db manipulation. Used mostly in upgrade.php scripts. return: database_manager The instance used to perform ddl operations. |