mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-14990 implemented query loggin in new native DML drivers
This commit is contained in:
parent
b68bff82c9
commit
b4154c2d64
9 changed files with 105 additions and 36 deletions
|
@ -2149,6 +2149,35 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
|
|||
upgrade_main_savepoint($result, 2009060200);
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2009061300) {
|
||||
//TODO: copy this to the very beginning of this upgrade script so that we may log upgrade queries
|
||||
|
||||
/// Define table log_queries to be created
|
||||
$table = new xmldb_table('log_queries');
|
||||
|
||||
/// Adding fields to table log_queries
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('qtype', XMLDB_TYPE_INTEGER, '5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('sqltext', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('sqlparams', XMLDB_TYPE_TEXT, 'big', null, null, null, null);
|
||||
$table->add_field('error', XMLDB_TYPE_INTEGER, '5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('info', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
|
||||
$table->add_field('backtrace', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
|
||||
$table->add_field('exectime', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timelogged', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
|
||||
/// Adding keys to table log_queries
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
||||
/// Conditionally launch create table for log_queries
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
/// Main savepoint reached
|
||||
upgrade_main_savepoint($result, 2009061300);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue