MDL-41359 database: no table columns is a dml_excpeiton

When insert_record is called and it doesn't find any columns
to insert data into, that is a dml_exception as you need at least
one column in the database to insert into it.  This can happen
when you have created a zero column database table, or the table
does not exist.
This commit is contained in:
Russell Smith
2013-12-07 08:56:24 +11:00
parent c36a2401ab
commit 9c7dfbe6ed
7 changed files with 31 additions and 0 deletions
+4
View File
@@ -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();