function devel_store_queries in Devel 6
Same name and namespace in other branches
- 5 devel.module \devel_store_queries()
1 call to devel_store_queries()
- devel_shutdown_real in ./
devel.module - See devel_shutdown() which registers this function as a shutdown function. Displays developer information in the footer.
4 string references to 'devel_store_queries'
- devel_admin_settings in ./
devel.module - devel_disable in ./
devel.install - Implementation of hook_disable().
- devel_menu_access_store_queries in ./
devel.module - devel_uninstall in ./
devel.install - Implementation of hook_uninstall().
File
- ./
devel.module, line 938
Code
function devel_store_queries() {
global $queries;
if (is_array($queries) && variable_get('devel_store_queries', 0) && rand(1, variable_get('devel_store_random', 1)) == 1) {
$qids = array();
$values = array();
$fields = array();
// We need this for the devel_queries insert below.
setlocale(LC_NUMERIC, 'C');
foreach ($queries as $value) {
list($function, $query) = explode("\n", $value[0]);
$query = preg_replace(array(
"/'.*'/s",
"/\\d.*\\.\\d.*/",
"/\\d.*/",
), array(
"S",
"F",
"D",
), $query);
$hash = md5($function . $query);
if (!isset($qids[$hash])) {
$qids[$hash] = db_result(devel_db_query("SELECT qid FROM {devel_queries} WHERE hash = '%s'", $hash));
if (!$qids[$hash]) {
devel_db_query("INSERT INTO {devel_queries} (query, function, hash) VALUES ('%s', '%s', '%s')", $query, $function, $hash);
$qids[$hash] = db_last_insert_id('devel_queries', 'qid');
}
}
$fields[] = "(%d, '%f')";
$values[] = $qids[$hash];
$values[] = $value[1];
}
if (count($fields)) {
devel_db_query('INSERT INTO {devel_times} (qid, time) VALUES ' . implode(',', $fields), $values);
}
}
}