General database importer class
Copyright: | 2008 Andrei Bautu |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 218 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
database_importer:: (8 methods):
__construct()
set_transaction_mode()
begin_database_import()
begin_table_import()
finish_table_import()
finish_database_import()
import_table_data()
import_database()
Class: database_importer - X-Ref
Base class for database import operations. This class implements__construct(moodle_database $mdb, $check_schema=true) X-Ref |
Object constructor. param: moodle_database $mdb Connection to the target database (a param: boolean $check_schema - whether or not to check that XML database |
set_transaction_mode($mode) X-Ref |
How to use transactions during the import. param: string $mode 'pertable', 'allinone' or 'none'. |
begin_database_import($version, $timestamp) X-Ref |
Callback function. Should be called only once database per import operation, before any database changes are made. It will check the database schema if @see check_schema is true param: float $version the version of the system which generated the data param: string $timestamp the timestamp of the data (in ISO 8601) format. return: void |
begin_table_import($tablename, $schemaHash) X-Ref |
Callback function. Should be called only once per table import operation, before any table changes are made. It will delete all table data. param: string $tablename - the name of the table that will be imported param: string $schemaHash - the hash of the xmldb_table schema of the table return: void |
finish_table_import($tablename) X-Ref |
Callback function. Should be called only once per table import operation, after all table changes are made. It will reset table sequences if any. param: string $tablename return: void |
finish_database_import() X-Ref |
Callback function. Should be called only once database per import operation, after all database changes are made. It will commit changes. return: void |
import_table_data($tablename, $data) X-Ref |
Callback function. Should be called only once per record import operation, only between @see begin_table_import and @see finish_table_import calls. It will insert table data. param: string $tablename - the name of the table in which data will be param: object $data - data object (fields and values will be inserted return: void |
import_database() X-Ref |
Common import method return: void |