|
Moodle
2.2.1
http://www.collinsharper.com
|

Public Member Functions | |
| __construct (moodle_database $mdb, $check_schema=true) | |
| set_transaction_mode ($mode) | |
| begin_database_import ($version, $timestamp) | |
| begin_table_import ($tablename, $schemaHash) | |
| finish_table_import ($tablename) | |
| finish_database_import () | |
| import_table_data ($tablename, $data) | |
| import_database () | |
Protected Attributes | |
| $mdb | |
| $manager | |
| $schema | |
| $check_schema | |
| $transactionmode = 'allinone' | |
| $transaction | |
Base class for database import operations. This class implements basic callbacks for import operations and defines the
Definition at line 45 of file database_importer.php.
| __construct | ( | moodle_database $ | mdb, |
| $ | check_schema = true |
||
| ) |
Object constructor.
| moodle_database | $mdb | Connection to the target database (a |
| boolean | $check_schema | - whether or not to check that XML database schema matches the RDBMS database schema before importing (inside |
Definition at line 74 of file database_importer.php.

| begin_database_import | ( | $ | version, |
| $ | timestamp | ||
| ) |
Callback function. Should be called only once database per import operation, before any database changes are made. It will check the database schema if
| dbtransfer_exception | if any checking (e.g. database schema, Moodle version) fails |
| float | $version | the version of the system which generated the data |
| string | $timestamp | the timestamp of the data (in ISO 8601) format. |
Definition at line 104 of file database_importer.php.

| begin_table_import | ( | $ | tablename, |
| $ | schemaHash | ||
| ) |
Callback function. Should be called only once per table import operation, before any table changes are made. It will delete all table data.
| dbtransfer_exception | an unknown table import is attempted |
| ddl_table_missing_exception | if the table is missing |
| string | $tablename | - the name of the table that will be imported |
| string | $schemaHash | - the hash of the xmldb_table schema of the table |
Definition at line 145 of file database_importer.php.

Callback function. Should be called only once database per import operation, after all database changes are made. It will commit changes.
Definition at line 187 of file database_importer.php.

| finish_table_import | ( | $ | tablename | ) |
Callback function. Should be called only once per table import operation, after all table changes are made. It will reset table sequences if any.
| string | $tablename |
Definition at line 168 of file database_importer.php.

| import_database | ( | ) |
Common import method
Reimplemented in file_xml_database_importer, and string_xml_database_importer.
Definition at line 214 of file database_importer.php.
| import_table_data | ( | $ | tablename, |
| $ | data | ||
| ) |
Callback function. Should be called only once per record import operation, only between
| dml_exception | if data insert operation failed |
| string | $tablename | - the name of the table in which data will be imported |
| object | $data | - data object (fields and values will be inserted into table) |
Definition at line 206 of file database_importer.php.

| set_transaction_mode | ( | $ | mode | ) |
How to use transactions during the import.
| string | $mode | 'pertable', 'allinone' or 'none'. |
Definition at line 85 of file database_importer.php.
$check_schema [protected] |
Boolean flag - whether or not to check that XML database schema matches the RDBMS database schema before importing (used by
Definition at line 57 of file database_importer.php.
$manager [protected] |
Database manager of the target database (a
Definition at line 49 of file database_importer.php.
$mdb [protected] |
Connection to the target database (a
Definition at line 47 of file database_importer.php.
$schema [protected] |
Target database schema in XMLDB format (a
Definition at line 51 of file database_importer.php.
$transaction [protected] |
Transaction object
Definition at line 63 of file database_importer.php.
$transactionmode = 'allinone' [protected] |
How to use transactions.
Definition at line 61 of file database_importer.php.