Difference between revisions of "DML exceptions"

From MoodleDocs
m (Protected "DML exceptions": Developer Docs Migration ([Edit=Allow only administrators] (indefinite)))
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{Template:Migrated|newDocId=/docs/apis/core/dml/exceptions}}
 
{{Moodle_2.0}}In previous versions problems in database calls were ignored by default.
 
{{Moodle_2.0}}In previous versions problems in database calls were ignored by default.
  
 +
==Overview==
 +
[[Image:Dml_exceptions.png]]
  
TODO: add more info here, explanation and same examples.
+
Defined in lib/dmllib.php for now.
  
 +
===dml_connection_exception===
 +
Thrown when can not connect to database for any reason.
 +
 +
===dml_read_exception===
 +
Problem occurred during reading from database. Originally indicated be returning ''false'' - this value was often confused with ''false'' return value meaning ''not found''.
 +
 +
===dml_write_exception===
 +
Problem occurred during writing to database. Originally indicated be returning ''false''.
  
 
==See also==
 
==See also==
  
* [[Exceptions|Exceptions]]: General guidlines for using of exceptions in Moodle 2.0
+
* [[Exceptions|Exceptions]]: General guidelines for using of exceptions in Moodle 2.0
 
* [[DML functions|DML functions]]: Where all the functions used to handle DB data. ([[wikipedia:Data_Manipulation_Language|DML]]) are defined.
 
* [[DML functions|DML functions]]: Where all the functions used to handle DB data. ([[wikipedia:Data_Manipulation_Language|DML]]) are defined.
 
* [[DDL functions|DDL functions]]: Where all the functions used to handle DB objects ([[wikipedia:Data_Definition_Language|DDL]]) are defined.
 
* [[DDL functions|DDL functions]]: Where all the functions used to handle DB objects ([[wikipedia:Data_Definition_Language|DDL]]) are defined.

Latest revision as of 14:05, 13 June 2022

Important:

This content of this page has been updated and migrated to the new Moodle Developer Resources. The information contained on the page should no longer be seen up-to-date.

Why not view this page on the new site and help us to migrate more content to the new site!

Moodle 2.0

In previous versions problems in database calls were ignored by default.

Overview

Dml exceptions.png

Defined in lib/dmllib.php for now.

dml_connection_exception

Thrown when can not connect to database for any reason.

dml_read_exception

Problem occurred during reading from database. Originally indicated be returning false - this value was often confused with false return value meaning not found.

dml_write_exception

Problem occurred during writing to database. Originally indicated be returning false.

See also

  • Exceptions: General guidelines for using of exceptions in Moodle 2.0
  • DML functions: Where all the functions used to handle DB data. (DML) are defined.
  • DDL functions: Where all the functions used to handle DB objects (DDL) are defined.