mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Simplify query addition to array
Co-authored-by: Lonnie Ezell <lonnieje@gmail.com>
This commit is contained in:
parent
9a2b3c2bc3
commit
e12b35e307
@ -83,19 +83,11 @@ class Database extends BaseCollector
|
||||
$max = $config->maxQueries ?: 100;
|
||||
|
||||
if (count(static::$queries) < $max) {
|
||||
if (! in_array($query->getQuery(), array_column(static::$queries, 'string', null), true)) {
|
||||
static::$queries[] = [
|
||||
'query' => $query,
|
||||
'string' => $query->getQuery(),
|
||||
'duplicate' => false,
|
||||
];
|
||||
} else {
|
||||
static::$queries[] = [
|
||||
'query' => $query,
|
||||
'string' => $query->getQuery(),
|
||||
'duplicate' => true,
|
||||
];
|
||||
}
|
||||
static::$queries[] = [
|
||||
'query' => $query,
|
||||
'string' => $query->getQuery(),
|
||||
'duplicate' => in_array($query->getQuery(), array_column(static::$queries, 'string', null), true),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user