Remove some old code coupling and boilerplate
This commit is contained in:
parent
f967aaf96e
commit
73e4c35163
@ -35,7 +35,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Additional configuration for the collecting process (parsing of php code, generation of xml data) -->
|
<!-- Additional configuration for the collecting process (parsing of php code, generation of xml data) -->
|
||||||
<collector publiconly="false" backend="parser" encoding="auto">
|
<collector publiconly="true" backend="parser" encoding="auto">
|
||||||
<!-- @publiconly - Flag to disable/enable processing of non public methods and members -->
|
<!-- @publiconly - Flag to disable/enable processing of non public methods and members -->
|
||||||
<!-- @backend - The collector backend to use, currently only shipping with 'parser' -->
|
<!-- @backend - The collector backend to use, currently only shipping with 'parser' -->
|
||||||
<!-- @encoding - Charset encoding of source files (overwrite default 'auto' if detection fails) -->
|
<!-- @encoding - Charset encoding of source files (overwrite default 'auto' if detection fails) -->
|
||||||
|
@ -16,11 +16,7 @@ namespace Query;
|
|||||||
|
|
||||||
use BadMethodCallException;
|
use BadMethodCallException;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
use Query\Drivers\{
|
use Query\Drivers\DriverInterface;
|
||||||
AbstractUtil,
|
|
||||||
DriverInterface,
|
|
||||||
SQLInterface
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience class for creating sql queries
|
* Convenience class for creating sql queries
|
||||||
@ -37,7 +33,9 @@ class QueryBuilder implements QueryBuilderInterface {
|
|||||||
* List of queries executed
|
* List of queries executed
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $queries;
|
public $queries = [
|
||||||
|
'total_time' => 0
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to do only an explain on the query
|
* Whether to do only an explain on the query
|
||||||
@ -57,18 +55,6 @@ class QueryBuilder implements QueryBuilderInterface {
|
|||||||
*/
|
*/
|
||||||
protected $parser;
|
protected $parser;
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias to driver util class
|
|
||||||
* @var AbstractUtil
|
|
||||||
*/
|
|
||||||
protected $util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias to driver sql class
|
|
||||||
* @var SQLInterface
|
|
||||||
*/
|
|
||||||
protected $sql;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query Builder state
|
* Query Builder state
|
||||||
* @var State
|
* @var State
|
||||||
@ -93,12 +79,6 @@ class QueryBuilder implements QueryBuilderInterface {
|
|||||||
|
|
||||||
// Create new State object
|
// Create new State object
|
||||||
$this->state = new State();
|
$this->state = new State();
|
||||||
|
|
||||||
$this->queries['total_time'] = 0;
|
|
||||||
|
|
||||||
// Alias driver sql and util classes
|
|
||||||
$this->sql = $this->driver->getSql();
|
|
||||||
$this->util = $this->driver->getUtil();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -543,7 +523,7 @@ class QueryBuilder implements QueryBuilderInterface {
|
|||||||
// doesn't support random ordering
|
// doesn't support random ordering
|
||||||
if (stripos($type, 'rand') !== FALSE)
|
if (stripos($type, 'rand') !== FALSE)
|
||||||
{
|
{
|
||||||
$rand = $this->sql->random();
|
$rand = $this->driver->getSql()->random();
|
||||||
$type = $rand ?? 'ASC';
|
$type = $rand ?? 'ASC';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1306,14 +1286,14 @@ class QueryBuilder implements QueryBuilderInterface {
|
|||||||
$limit = $this->state->getLimit();
|
$limit = $this->state->getLimit();
|
||||||
if (is_numeric($limit))
|
if (is_numeric($limit))
|
||||||
{
|
{
|
||||||
$sql = $this->sql->limit($sql, $limit, $this->state->getOffset());
|
$sql = $this->driver->getSql()->limit($sql, $limit, $this->state->getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if the query plan, rather than the
|
// See if the query plan, rather than the
|
||||||
// query data should be returned
|
// query data should be returned
|
||||||
if ($this->explain === TRUE)
|
if ($this->explain === TRUE)
|
||||||
{
|
{
|
||||||
$sql = $this->sql->explain($sql);
|
$sql = $this->driver->getSql()->explain($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
|
Loading…
Reference in New Issue
Block a user