Skip to content
Permalink
Browse files

A few random improvements to the database layer

  • Loading branch information...
lorenzo committed Aug 24, 2014
1 parent 3451bf4 commit 038c16b2de47736237a8742ad23fb9f5d7a3435d
@@ -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
@@ -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.
@@ -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.'
);
}
@@ -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
@@ -16,7 +16,7 @@
use Cake\Database\Driver;
use Cake\Error;
use \PDO;
use PDO;
/**
* Binary type converter.
@@ -16,7 +16,7 @@
use Cake\Database\Driver;
use Cake\Error;
use \PDO;
use PDO;
/**
* Float type converter.
@@ -16,7 +16,7 @@
use Cake\Database\Driver;
use Cake\Error;
use \PDO;
use PDO;
/**
* Integer type converter.
@@ -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
@@ -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() {
@@ -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);
@@ -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);

0 comments on commit 038c16b

Please sign in to comment.
You can’t perform that action at this time.