diff --git a/system/db/connection.php b/system/db/connection.php index 0c3ab037..e61bdcb0 100644 --- a/system/db/connection.php +++ b/system/db/connection.php @@ -16,13 +16,6 @@ class Connection { */ public $config; - /** - * The Connector instance. - * - * @var Connector - */ - public $connector; - /** * The PDO connection. * @@ -33,17 +26,16 @@ class Connection { /** * Create a new Connection instance. * - * @param string $name - * @param object $config - * @param Conector $connector + * @param string $name + * @param object $config + * @param Connector $connector * @return void */ public function __construct($name, $config, $connector) { $this->name = $name; $this->config = $config; - $this->connector = $connector; - $this->pdo = $this->connector->connect($this->config); + $this->pdo = $connector->connect($this->config); } /** diff --git a/system/db/query.php b/system/db/query.php index 19e21d0d..fac29c6c 100644 --- a/system/db/query.php +++ b/system/db/query.php @@ -84,8 +84,8 @@ class Query { */ public function __construct($table, $connection) { - $this->connection = $connection; $this->table = $table; + $this->connection = $connection; $this->from = 'FROM '.$this->wrap($table); } @@ -471,7 +471,9 @@ class Query { */ public function paginate($per_page, $columns = array('*')) { - list($select, $total) = array($this->select, $this->count()); + $select = $this->select; + + $total = $this->count(); // Every query clears the SELECT clause, so we store the contents of the clause // before executing the count query and then put the contents back in afterwards. @@ -515,20 +517,11 @@ class Query { $sql = $this->select.' '.$this->from.' '.$this->where; - if (count($this->orderings) > 0) - { - $sql .= ' ORDER BY '.implode(', ', $this->orderings); - } + if (count($this->orderings) > 0) $sql .= ' ORDER BY '.implode(', ', $this->orderings); - if ( ! is_null($this->limit)) - { - $sql .= ' LIMIT '.$this->limit; - } + if ( ! is_null($this->limit)) $sql .= ' LIMIT '.$this->limit; - if ( ! is_null($this->offset)) - { - $sql .= ' OFFSET '.$this->offset; - } + if ( ! is_null($this->offset)) $sql .= ' OFFSET '.$this->offset; $results = $this->connection->query($sql, $this->bindings);