Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/lib/ -> dmllib.php (source)

Differences Between: [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

This library contains all the Data Manipulation Language (DML) functions used to interact with the DB This library contains all the Data Manipulation Language (DML) functions used to interact with the DB. All the dunctions in this library must be generic and work against the major number of RDBMS possible. This is the list of currently supported and tested DBs: mysql, postresql, mssql, oracle

Copyright: 2008 Petr Skoda (http://skodak.org)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 376 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 8 classes

dml_exception:: (1 method):
  __construct()

dml_connection_exception:: (1 method):
  __construct()

dml_sessionwait_exception:: (1 method):
  __construct()

dml_read_exception:: (1 method):
  __construct()

dml_multiple_records_exception:: (1 method):
  __construct()

dml_missing_record_exception:: (1 method):
  __construct()

dml_write_exception:: (1 method):
  __construct()

dml_transaction_exception:: (2 methods):
  __construct()
  setup_DB()


Class: dml_exception  - X-Ref

DML exception class, use instead of print_error() in dml code.

__construct($errorcode, $a=NULL, $debuginfo=null)   X-Ref

param: string $errorcode The name of the string from error.php to print.
param: string $a Extra words and phrases that might be required in the error string.
param: string $debuginfo Optional debugging information.

Class: dml_connection_exception  - X-Ref

DML db connection exception - triggered if database not accessible.

__construct($error)   X-Ref
Constructor

param: string $error Optional debugging information.

Class: dml_sessionwait_exception  - X-Ref

DML db session wait exception - triggered when session lock request times out.

__construct()   X-Ref
Constructor


Class: dml_read_exception  - X-Ref

DML read exception - triggered by some SQL syntax errors, etc.

__construct($error, $sql=null, array $params=null)   X-Ref
Constructor

param: string $error The name of the string from error.php to print.
param: string $sql The SQL that ran just before this read error.
param: array $params The SQL's related parameters.(optional)

Class: dml_multiple_records_exception  - X-Ref

Caused by multiple records found in get_record() call.

__construct($sql='', array $params=null)   X-Ref
Constructor

param: string $sql The SQL that ran just before this read error.
param: array $params The SQL's related parameters.(optional)

Class: dml_missing_record_exception  - X-Ref

Caused by missing record that is required for normal operation.

__construct($tablename, $sql='', array $params=null)   X-Ref
Constructor

param: string $tablename The table name if known, '' if unknown.
param: string $sql Optional SQL query.
param: array $params Optional SQL query's parameters.

Class: dml_write_exception  - X-Ref

DML write exception - triggered by some SQL syntax errors, etc.

__construct($error, $sql=null, array $params=null)   X-Ref
Constructor

param: string $error The name of the string from error.php to print.
param: string $sql The SQL that ran just before this write error.
param: array $params The SQL's related parameters.(optional)

Class: dml_transaction_exception  - X-Ref

DML transaction exception - triggered by problems related to DB transactions.

__construct($debuginfo=null, $transaction=null)   X-Ref
Constructor

param: array $debuginfo Optional debugging information.
param: moodle_transaction $transaction The instance of the transaction.(Optional)

setup_DB()   X-Ref
Sets up global $DB moodle_database instance

return: void|bool Returns true when finished setting up $DB. Returns void when $DB has already been set.