Merge branch 'MDL-41359-master' of https://github.com/mr-russ/moodle
This commit is contained in:
@@ -903,6 +903,9 @@ class mssql_native_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
$cleaned = array();
|
||||
|
||||
foreach ($dataobject as $field => $value) {
|
||||
|
||||
@@ -1106,6 +1106,10 @@ class mysqli_native_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
|
||||
$cleaned = array();
|
||||
|
||||
foreach ($dataobject as $field=>$value) {
|
||||
|
||||
@@ -1256,6 +1256,10 @@ class oci_native_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
|
||||
$cleaned = array();
|
||||
|
||||
foreach ($dataobject as $field=>$value) {
|
||||
|
||||
@@ -386,6 +386,10 @@ abstract class pdo_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
|
||||
$cleaned = array();
|
||||
|
||||
foreach ($dataobject as $field=>$value) {
|
||||
|
||||
@@ -876,6 +876,10 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
|
||||
$cleaned = array();
|
||||
$blobs = array();
|
||||
|
||||
|
||||
@@ -979,6 +979,10 @@ class sqlsrv_native_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
|
||||
$cleaned = array ();
|
||||
|
||||
foreach ($dataobject as $field => $value) {
|
||||
|
||||
@@ -2253,6 +2253,14 @@ class core_dml_testcase extends database_driver_testcase {
|
||||
} catch (moodle_exception $e) {
|
||||
$this->assertInstanceOf('dml_exception', $e);
|
||||
}
|
||||
|
||||
// Try to insert a record into a non-existent table. dml_exception expected.
|
||||
try {
|
||||
$DB->insert_record('nonexistenttable', $record, true);
|
||||
$this->fail("Expecting an exception, none occurred");
|
||||
} catch (exception $e) {
|
||||
$this->assertTrue($e instanceof dml_exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_import_record() {
|
||||
|
||||
Reference in New Issue
Block a user