$string['ddltablenotexist'] = 'Table \"$a\" does not exist';
$string['ddlunknownerror'] = 'Unknown DDL library error';
$string['ddlxmlfileerror'] = 'XML database file errors found';
+$string['dmlreadexception'] = 'Error reading from database';
+$string['dmlwriteexception'] = 'Error writing to database';
$string['destinationcmnotexit'] = 'The destination course module does not exist';
$string['downloadedfilecheckfailed'] = 'Downloaded file check failed';
$string['duplicateusername'] = 'Duplicate username - skipping record';
* @param mixed $obj optional library specific object
*/
protected function report_error($sql, array $params=null, $obj=null) {
- debugging($this->get_last_error() .'<br /><br />'. s($sql).'<br />['.s(var_export($params, true)).']');
+ debugging(s($this->get_last_error()).'<br /><br />'.s($sql).'<br />['.s(var_export($params, true)).']');
}
/**
}
}
+/**
+ * DML read exception - triggered by SQL syntax errors, missing tables, etc.
+ */
+class dml_read_exception extends dml_exception {
+ public $error;
+ public $sql;
+ public $params;
+
+ function __construct($error, $sql=null, array $params=null) {
+ $this->error = $error;
+ $this->sql = $sql;
+ $this->params = $params;
+ $errorinfo = s($error).'<br /><br />'.s($sql).'<br />['.s(var_export($params, true)).']';
+ parent::__construct('dmlreadexception', NULL, $errorinfo);
+ }
+}
+
+/**
+ * DML read exception - triggered by SQL syntax errors, missing tables, etc.
+ */
+class dml_write_exception extends dml_exception {
+ public $error;
+ public $sql;
+ public $params;
+
+ function __construct($error, $sql=null, array $params=null) {
+ $this->error = $error;
+ $this->sql = $sql;
+ $this->params = $params;
+ $errorinfo = s($error).'<br /><br />'.s($sql).'<br />['.s(var_export($params, true)).']';
+ parent::__construct('dmlwriteexception', NULL, $errorinfo);
+ }
+}
+
/**
* Sets up global $DB moodle_database instance
* @return void
}
/**
- * Exception indicating programming error, must be fixed by a programeer.
+ * Exception indicating programming error, must be fixed by a programer.
*/
class coding_exception extends moodle_exception {