Skip to content

Commit

Permalink
A few random improvements to the database layer
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 24, 2014
1 parent 3451bf4 commit 038c16b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Database/Expression/QueryExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Cake\Database\Expression\IdentifierExpression;
use Cake\Database\TypeMapTrait;
use Cake\Database\ValueBinder;
use \Countable;
use Countable;

/**
* Represents a SQL Query expression. Internally it stores a tree of
Expand Down
6 changes: 3 additions & 3 deletions src/Database/Expression/ValuesExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
*/
namespace Cake\Database\Expression;

use Cake\Database\Exception;
use Cake\Database\ExpressionInterface;
use Cake\Database\Query;
use Cake\Database\TypeMapTrait;
use Cake\Database\ValueBinder;
use Cake\Error;

/**
* An expression object to contain values being inserted.
Expand Down Expand Up @@ -70,14 +70,14 @@ public function __construct(array $columns, $typeMap) {
* @param array|Query $data Array of data to append into the insert, or
* a query for doing INSERT INTO .. SELECT style commands
* @return void
* @throws \Cake\Error\Exception When mixing array + Query data types.
* @throws \Cake\Database\Exception When mixing array + Query data types.
*/
public function add($data) {
if (
(count($this->_values) && $data instanceof Query) ||
($this->_query && is_array($data))
) {
throw new Error\Exception(
throw new Exception(
'You cannot mix subqueries and array data in inserts.'
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Statement/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/
namespace Cake\Database\Statement;

use \PDO;
use \PDOStatement as Statement;
use PDO;
use PDOStatement as Statement;

/**
* Decorator for \PDOStatement class mainly used for converting human readable
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Type/BinaryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Driver;
use Cake\Error;
use \PDO;
use PDO;

/**
* Binary type converter.
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Type/FloatType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Driver;
use Cake\Error;
use \PDO;
use PDO;

/**
* Float type converter.
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Type/IntegerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use Cake\Database\Driver;
use Cake\Error;
use \PDO;
use PDO;

/**
* Integer type converter.
Expand Down
8 changes: 4 additions & 4 deletions src/ORM/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
use Cake\Collection\CollectionTrait;
use Cake\Database\Exception;
use Cake\Database\Type;
use \Countable;
use \Iterator;
use \JsonSerializable;
use \Serializable;
use Countable;
use Iterator;
use JsonSerializable;
use Serializable;

/**
* Represents the results obtained after executing a query for a specific table
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase/Database/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ public function testUpdateArrayFields() {
/**
* You cannot call values() before insert() it causes all sorts of pain.
*
* @expectedException \Cake\Error\Exception
* @expectedException \Cake\Database\Exception
* @return void
*/
public function testInsertValuesBeforeInsertFailure() {
Expand Down Expand Up @@ -2265,7 +2265,7 @@ public function testInsertFromSelect() {
/**
* Test that an exception is raised when mixing query + array types.
*
* @expectedException \Cake\Error\Exception
* @expectedException \Cake\Database\Exception
*/
public function testInsertFailureMixingTypesArrayFirst() {
$query = new Query($this->connection);
Expand All @@ -2278,7 +2278,7 @@ public function testInsertFailureMixingTypesArrayFirst() {
/**
* Test that an exception is raised when mixing query + array types.
*
* @expectedException \Cake\Error\Exception
* @expectedException \Cake\Database\Exception
*/
public function testInsertFailureMixingTypesQueryFirst() {
$query = new Query($this->connection);
Expand Down

0 comments on commit 038c16b

Please sign in to comment.