From 812a0609ca0650590b69a808c403a6ea24921e22 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 4 Mar 2013 21:07:34 -0500 Subject: [PATCH] Update headers & doc blocks. --- .../Model/Datasource/Database/Connection.php | 17 +++++- .../Database/Dialect/PostgresDialect.php | 16 +++--- lib/Cake/Model/Datasource/Database/Driver.php | 17 +++++- .../Datasource/Database/Driver/Mysql.php | 21 ++++++- .../Datasource/Database/Driver/PDODriver.php | 37 ++++++++---- .../Datasource/Database/Driver/Postgres.php | 26 ++++----- .../Datasource/Database/Driver/Sqlite.php | 23 ++++++-- .../Exception/MissingConnectionException.php | 20 +++---- .../Exception/MissingDriverException.php | 19 +++---- .../Exception/MissingExtensionException.php | 19 +++---- .../Model/Datasource/Database/Expression.php | 16 +++--- .../Database/Expression/Comparison.php | 3 +- .../Database/Expression/OrderByExpression.php | 17 +++++- .../Database/Expression/QueryExpression.php | 18 +++--- .../Database/Expression/UnaryExpression.php | 17 +++++- .../Database/Expression/ValuesExpression.php | 2 +- lib/Cake/Model/Datasource/Database/Query.php | 16 +++--- .../Model/Datasource/Database/SqlDialect.php | 16 +++--- .../Model/Datasource/Database/Statement.php | 53 +++++++++++------- .../Database/Statement/BufferedStatement.php | 16 +++--- .../Database/Statement/CallbackStatement.php | 16 +++--- lib/Cake/Model/Datasource/Database/Type.php | 45 ++++++++++----- .../Datasource/Database/Type/BooleanType.php | 23 ++++++-- .../Datasource/Database/Type/DateTimeType.php | 17 +++++- .../Datasource/Database/Type/DateType.php | 17 +++++- .../Datasource/Database/TypeConverter.php | 20 +++---- .../Datasource/Database/ConnectionTest.php | 16 +++--- .../Model/Datasource/Database/QueryTest.php | 16 +++--- .../Model/Datasource/Database/TypeTest.php | 56 +++++++++---------- 29 files changed, 395 insertions(+), 220 deletions(-) diff --git a/lib/Cake/Model/Datasource/Database/Connection.php b/lib/Cake/Model/Datasource/Database/Connection.php index 8e3c49f3067..de2a3a674cf 100644 --- a/lib/Cake/Model/Datasource/Database/Connection.php +++ b/lib/Cake/Model/Datasource/Database/Connection.php @@ -1,5 +1,20 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Dialect; diff --git a/lib/Cake/Model/Datasource/Database/Driver.php b/lib/Cake/Model/Datasource/Database/Driver.php index e9df6d5db38..0de49479b2f 100644 --- a/lib/Cake/Model/Datasource/Database/Driver.php +++ b/lib/Cake/Model/Datasource/Database/Driver.php @@ -1,5 +1,20 @@ _baseConfig; $config['flags'] += [ @@ -54,7 +69,7 @@ public function connect(array $config) { * Returns whether php is able to use this driver for connecting to database * * @return boolean true if it is valid to use this driver - **/ + */ public function enabled() { return in_array('mysql', PDO::getAvailableDrivers()); diff --git a/lib/Cake/Model/Datasource/Database/Driver/PDODriver.php b/lib/Cake/Model/Datasource/Database/Driver/PDODriver.php index 3a2a6d97f53..c5593a7e01b 100644 --- a/lib/Cake/Model/Datasource/Database/Driver/PDODriver.php +++ b/lib/Cake/Model/Datasource/Database/Driver/PDODriver.php @@ -1,5 +1,20 @@ _connection = $connection; @@ -42,7 +57,7 @@ public function connection($connection = null) { * Disconnects from database server * * @return void - **/ + */ public function disconnect() { $this->_connection = null; } @@ -52,7 +67,7 @@ public function disconnect() { * * @param string $sql * @return Cake\Model\Datasource\Database\Statement - **/ + */ public function prepare($sql) { $statement = $this->connection()->prepare($sql); return new Statement($statement, $this); @@ -62,7 +77,7 @@ public function prepare($sql) { * Starts a transaction * * @return boolean true on success, false otherwise - **/ + */ public function beginTransaction() { return $this->connection()->beginTransaction(); } @@ -71,7 +86,7 @@ public function beginTransaction() { * Commits a transaction * * @return boolean true on success, false otherwise - **/ + */ public function commitTransaction() { return $this->connection()->commit(); } @@ -80,7 +95,7 @@ public function commitTransaction() { * Rollsback a transaction * * @return boolean true on success, false otherwise - **/ + */ public function rollbackTransaction() { return $this->connection()->rollback(); } @@ -89,7 +104,7 @@ public function rollbackTransaction() { * Returns a value in a safe representation to be used in a query string * * @return string - **/ + */ public function quote($value, $type) { return $this->connection()->quote($value, $type); } @@ -99,7 +114,7 @@ public function quote($value, $type) { * * @param string $table table name or sequence to get last insert value from * @return string|integer - **/ + */ public function lastInsertId($table = null) { return $this->connection()->lastInsertId(); } @@ -108,7 +123,7 @@ public function lastInsertId($table = null) { * Checks if the driver supports quoting, as PDO_ODBC does not support it. * * @return boolean - **/ + */ public function supportsQuoting() { return $this->connection()->getAttribute(PDO::ATTR_DRIVER_NAME) !== 'odbc'; } diff --git a/lib/Cake/Model/Datasource/Database/Driver/Postgres.php b/lib/Cake/Model/Datasource/Database/Driver/Postgres.php index 89662275ad2..899a067e5e1 100644 --- a/lib/Cake/Model/Datasource/Database/Driver/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Driver/Postgres.php @@ -1,18 +1,18 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Driver; @@ -49,7 +49,7 @@ class Postgres extends \Cake\Model\Datasource\Database\Driver { * * @param array $config configuration to be used for creating connection * @return boolean true on success - **/ + */ public function connect(array $config) { $config += $this->_baseConfig; $config['flags'] += [ @@ -75,7 +75,7 @@ public function connect(array $config) { * Returns whether php is able to use this driver for connecting to database * * @return boolean true if it is valid to use this driver - **/ + */ public function enabled() { return in_array('pgsql', PDO::getAvailableDrivers()); @@ -86,7 +86,7 @@ public function enabled() { * * @param string $sql * @return Cake\Model\Datasource\Database\Statement - **/ + */ public function prepare($sql) { $statement = $this->connection()->prepare($sql); return new Statement($statement, $this); @@ -96,7 +96,7 @@ public function prepare($sql) { * Sets connection encoding * * @return void - **/ + */ public function setEncoding($encoding) { $this->_connection->exec('SET NAMES ' . $this->_connection->quote($encoding)); } @@ -106,7 +106,7 @@ public function setEncoding($encoding) { * postgres will fallback to looking the relation into defined default schema * * @return void - **/ + */ public function setSchema($schema) { $this->_connection->exec('SET search_path TO ' . $this->_connection->quote($schema)); } diff --git a/lib/Cake/Model/Datasource/Database/Driver/Sqlite.php b/lib/Cake/Model/Datasource/Database/Driver/Sqlite.php index 44ce08c28de..038deeebc62 100644 --- a/lib/Cake/Model/Datasource/Database/Driver/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Driver/Sqlite.php @@ -1,5 +1,20 @@ _baseConfig + ['login' => null, 'password' => null]; $config['flags'] += [ @@ -46,7 +61,7 @@ public function connect(array $config) { * Returns whether php is able to use this driver for connecting to database * * @return boolean true if it is valid to use this driver - **/ + */ public function enabled() { return in_array('sqlite', PDO::getAvailableDrivers()); @@ -57,7 +72,7 @@ public function enabled() { * * @param string $sql * @return Cake\Model\Datasource\Database\Statement - **/ + */ public function prepare($sql) { $statement = $this->connection()->prepare($sql); return new BufferedStatement($statement, $this); diff --git a/lib/Cake/Model/Datasource/Database/Exception/MissingConnectionException.php b/lib/Cake/Model/Datasource/Database/Exception/MissingConnectionException.php index 729d72cab3c..3ccace788cf 100644 --- a/lib/Cake/Model/Datasource/Database/Exception/MissingConnectionException.php +++ b/lib/Cake/Model/Datasource/Database/Exception/MissingConnectionException.php @@ -1,26 +1,24 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Model.Datasource.Database.Exception - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Exception; - class MissingConnectionException extends \Cake\Error\Exception { protected $_messageTemplate = 'Connection to database could not be established: %s'; } - diff --git a/lib/Cake/Model/Datasource/Database/Exception/MissingDriverException.php b/lib/Cake/Model/Datasource/Database/Exception/MissingDriverException.php index b2cfb69bdf8..c0388c19a1c 100644 --- a/lib/Cake/Model/Datasource/Database/Exception/MissingDriverException.php +++ b/lib/Cake/Model/Datasource/Database/Exception/MissingDriverException.php @@ -1,23 +1,22 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Model.Datasource.Database.Exception - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Exception; - class MissingDriverException extends \Cake\Error\Exception { protected $_messageTemplate = 'Database driver %s could not be found.'; diff --git a/lib/Cake/Model/Datasource/Database/Exception/MissingExtensionException.php b/lib/Cake/Model/Datasource/Database/Exception/MissingExtensionException.php index ac799c8cdcc..341f6750ba9 100644 --- a/lib/Cake/Model/Datasource/Database/Exception/MissingExtensionException.php +++ b/lib/Cake/Model/Datasource/Database/Exception/MissingExtensionException.php @@ -1,23 +1,22 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Model.Datasource.Database.Exception - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Exception; - class MissingExtensionException extends \Cake\Error\Exception { protected $_messageTemplate = 'Database driver %s cannot be used due to a missing PHP extension or unmet dependency'; diff --git a/lib/Cake/Model/Datasource/Database/Expression.php b/lib/Cake/Model/Datasource/Database/Expression.php index 593894d9eb9..b28d0168b7d 100644 --- a/lib/Cake/Model/Datasource/Database/Expression.php +++ b/lib/Cake/Model/Datasource/Database/Expression.php @@ -1,18 +1,18 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database; diff --git a/lib/Cake/Model/Datasource/Database/Expression/Comparison.php b/lib/Cake/Model/Datasource/Database/Expression/Comparison.php index 0670aa7db70..b4a183581e0 100644 --- a/lib/Cake/Model/Datasource/Database/Expression/Comparison.php +++ b/lib/Cake/Model/Datasource/Database/Expression/Comparison.php @@ -9,13 +9,12 @@ * Licensed under The Open Group Test Suite License * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests * @package Cake.Test.Case.Model.Datasource.Database * @since CakePHP(tm) v 3.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ - namespace Cake\Model\Datasource\Database\Expression; use Cake\Model\Datasource\Database\Expression; diff --git a/lib/Cake/Model/Datasource/Database/Expression/OrderByExpression.php b/lib/Cake/Model/Datasource/Database/Expression/OrderByExpression.php index 3076f4b2407..13b3f173671 100644 --- a/lib/Cake/Model/Datasource/Database/Expression/OrderByExpression.php +++ b/lib/Cake/Model/Datasource/Database/Expression/OrderByExpression.php @@ -1,5 +1,20 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Expression; @@ -387,7 +387,7 @@ public function placeholder($token) { * Subexpression bound values will not be returned with this function. * * @return array - **/ + */ public function bindings() { return $this->_bindings; } diff --git a/lib/Cake/Model/Datasource/Database/Expression/UnaryExpression.php b/lib/Cake/Model/Datasource/Database/Expression/UnaryExpression.php index 3b8d4fc1e17..c7c702e83ac 100644 --- a/lib/Cake/Model/Datasource/Database/Expression/UnaryExpression.php +++ b/lib/Cake/Model/Datasource/Database/Expression/UnaryExpression.php @@ -1,5 +1,20 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database; diff --git a/lib/Cake/Model/Datasource/Database/SqlDialect.php b/lib/Cake/Model/Datasource/Database/SqlDialect.php index 4d23357f781..eb98f7c69e7 100644 --- a/lib/Cake/Model/Datasource/Database/SqlDialect.php +++ b/lib/Cake/Model/Datasource/Database/SqlDialect.php @@ -1,18 +1,18 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database; diff --git a/lib/Cake/Model/Datasource/Database/Statement.php b/lib/Cake/Model/Datasource/Database/Statement.php index 3b80d96f1e8..ce301cc5e65 100644 --- a/lib/Cake/Model/Datasource/Database/Statement.php +++ b/lib/Cake/Model/Datasource/Database/Statement.php @@ -1,5 +1,20 @@ PDO::FETCH_NUM, 'assoc' => PDO::FETCH_ASSOC @@ -45,7 +60,7 @@ class Statement implements \IteratorAggregate, \Countable { * * @param Statement implementation such as PDOStatement * @return void - **/ + */ public function __construct($statement = null, $driver = null) { $this->_statement = $statement; $this->_driver = $driver; @@ -56,7 +71,7 @@ public function __construct($statement = null, $driver = null) { * * @param string $property internal property to get * @return mixed - **/ + */ public function __get($property) { if ($property === 'queryString') { return $this->_statement->queryString; @@ -85,7 +100,7 @@ public function __get($property) { * @param mixed $value the value to bind to variable in query * @param string|integer $type PDO type or name of configured Type class * @return void - **/ + */ public function bindValue($column, $value, $type = 'string') { if ($type === null) { $type = 'string'; @@ -102,7 +117,7 @@ public function bindValue($column, $value, $type = 'string') { * automatically called after fetching all results from the result set. * * @return void - **/ + */ public function closeCursor() { $this->_statement->closeCursor(); } @@ -119,7 +134,7 @@ public function closeCursor() { * }}} * * @return integer - **/ + */ public function columnCount() { return $this->_statement->columnCount(); } @@ -128,7 +143,7 @@ public function columnCount() { * Returns the error code for the last error that occurred when executing this statement * * @return integer|string - **/ + */ public function errorCode() { return $this->_statement->errorCode(); } @@ -138,7 +153,7 @@ public function errorCode() { * this statement * * @return array - **/ + */ public function errorInfo() { return $this->_statement->errorInfo(); } @@ -151,7 +166,7 @@ public function errorInfo() { * * $param array $params list of values to be bound to query * @return boolean true on success, false otherwise - **/ + */ public function execute($params = null) { return $this->_statement->execute($params); } @@ -172,7 +187,7 @@ public function execute($params = null) { * @param string $type 'num' for positional columns, assoc for named columns * @return mixed|boolean result array containing columns and values or false if no results * are left - **/ + */ public function fetch($type = 'num') { switch ($type) { case 'num': @@ -195,7 +210,7 @@ public function fetch($type = 'num') { * * @param string $type num for fetching columns as positional keys or assoc for column names as keys * @return array list of all results from database for this statement - **/ + */ public function fetchAll($type = 'num') { switch ($type) { case 'num': @@ -217,7 +232,7 @@ public function fetchAll($type = 'num') { * }}} * * @return integer - **/ + */ public function rowCount() { return $this->_statement->rowCount(); } @@ -237,7 +252,7 @@ public function rowCount() { * }}} * * @return Iterator - **/ + */ public function getIterator() { return $this->_statement; } @@ -247,7 +262,7 @@ public function getIterator() { * to return the number for affected rows from last execution * * @return integer - **/ + */ public function count() { return $this->rowCount(); } @@ -258,7 +273,7 @@ public function count() { * @param array $params list of values to be bound * @param array $types list of types to be used, keys should match those in $params * @return void - **/ + */ public function bind($params, $types) { if (empty($params)) { return; diff --git a/lib/Cake/Model/Datasource/Database/Statement/BufferedStatement.php b/lib/Cake/Model/Datasource/Database/Statement/BufferedStatement.php index 522161d9e46..24f95e3d8d7 100644 --- a/lib/Cake/Model/Datasource/Database/Statement/BufferedStatement.php +++ b/lib/Cake/Model/Datasource/Database/Statement/BufferedStatement.php @@ -1,18 +1,18 @@ - * Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Statement; diff --git a/lib/Cake/Model/Datasource/Database/Statement/CallbackStatement.php b/lib/Cake/Model/Datasource/Database/Statement/CallbackStatement.php index 0b8c69d895c..d9fbdd424a4 100644 --- a/lib/Cake/Model/Datasource/Database/Statement/CallbackStatement.php +++ b/lib/Cake/Model/Datasource/Database/Statement/CallbackStatement.php @@ -1,18 +1,18 @@ - * Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database\Statement; diff --git a/lib/Cake/Model/Datasource/Database/Type.php b/lib/Cake/Model/Datasource/Database/Type.php index 2aae5b9098f..d017b39984f 100644 --- a/lib/Cake/Model/Datasource/Database/Type.php +++ b/lib/Cake/Model/Datasource/Database/Type.php @@ -1,5 +1,20 @@ '\Cake\Model\Datasource\Database\Type\BooleanType', 'binary' => '\Cake\Model\Datasource\Database\Type\BinaryType', @@ -32,7 +47,7 @@ class Type { * for doing conversion on these * * @var array - **/ + */ protected static $_basicTypes = [ 'float' => ['callback' => 'floatval'], 'integer' => ['callback' => 'intval', 'pdo' => PDO::PARAM_INT], @@ -44,14 +59,14 @@ class Type { * Contains a map of type object instances to be reused if needed * * @var array - **/ + */ protected static $_builtTypes = []; /** * Identifier name for this type * * @var string - **/ + */ protected $_name = null; /** @@ -59,7 +74,7 @@ class Type { * * @param string $name The name identifying this type * @return void - **/ + */ public function __construct($name = null) { $this->_name = $name; } @@ -69,7 +84,7 @@ public function __construct($name = null) { * * @param string $name type identifier * @return Type - **/ + */ public static function build($name) { if (isset(self::$_builtTypes[$name])) { return self::$_builtTypes[$name]; @@ -92,7 +107,7 @@ public static function build($name) { * @param string $className * @return array|string|null if $type is null then array with current map, if $className is null string * configured class name for give $type, null otherwise - **/ + */ public static function map($type = null, $className = null) { if ($type === null) { return self::$_types; @@ -111,7 +126,7 @@ public static function map($type = null, $className = null) { * Clears out all created instances and mapped types classes, useful for testing * * @return void - **/ + */ public static function clear() { self::$_types = []; self::$_builtTypes = []; @@ -121,7 +136,7 @@ public static function clear() { * Returns type identifier name for this object * * @return string - **/ + */ public function getName() { return $this->_name; } @@ -132,7 +147,7 @@ public function getName() { * @param mixed $value value to be converted to database equivalent * @param Driver $driver object from which database preferences and configuration will be extracted * @return mixed - **/ + */ public function toDatabase($value, Driver $driver) { return $this->_basicTypeCast($value, $driver); } @@ -143,7 +158,7 @@ public function toDatabase($value, Driver $driver) { * @param mixed $value value to be converted to PHP equivalent * @param Driver $driver object from which database preferences and configuration will be extracted * @return mixed - **/ + */ public function toPHP($value, Driver $driver) { return $this->_basicTypeCast($value, $driver); } @@ -155,7 +170,7 @@ public function toPHP($value, Driver $driver) { * @param mixed $value value to be converted to PHP equivalent * @param Driver $driver object from which database preferences and configuration will be extracted * @return mixed - **/ + */ protected function _basicTypeCast($value, Driver $driver) { if (is_null($value)) { return null; @@ -176,7 +191,7 @@ protected function _basicTypeCast($value, Driver $driver) { * @param mixed $value value to be converted to PHP equivalent * @param Driver $driver object from which database preferences and configuration will be extracted * @return mixed - **/ + */ public function toStatement($value, Driver $driver) { if (is_null($value)) { return PDO::PARAM_NULL; diff --git a/lib/Cake/Model/Datasource/Database/Type/BooleanType.php b/lib/Cake/Model/Datasource/Database/Type/BooleanType.php index cc6d272719b..b63056ee372 100644 --- a/lib/Cake/Model/Datasource/Database/Type/BooleanType.php +++ b/lib/Cake/Model/Datasource/Database/Type/BooleanType.php @@ -1,5 +1,20 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Model\Datasource\Database; @@ -26,7 +26,7 @@ trait TypeConverter { * @param mixed value * @param string $type * @return array list containing converted value and internal type - **/ + */ public function cast($value, $type) { if (is_string($type)) { $type = Type::build($type); @@ -47,7 +47,7 @@ public function cast($value, $type) { * @param array $columns list or associative array of columns and parameters to be bound with types * @param array $types list or associative array of types * @return array - **/ + */ public function matchTypes($columns, $types) { if (!is_int(key($types))) { $positions = array_intersect_key(array_flip($columns), $types); diff --git a/lib/Cake/Test/TestCase/Model/Datasource/Database/ConnectionTest.php b/lib/Cake/Test/TestCase/Model/Datasource/Database/ConnectionTest.php index 3d4a59bc7ca..932983fc256 100644 --- a/lib/Cake/Test/TestCase/Model/Datasource/Database/ConnectionTest.php +++ b/lib/Cake/Test/TestCase/Model/Datasource/Database/ConnectionTest.php @@ -1,18 +1,18 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Test\TestCase\Model\Datasource\Database; diff --git a/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php b/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php index 9a148c6f660..25a3ac5b905 100644 --- a/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php +++ b/lib/Cake/Test/TestCase/Model/Datasource/Database/QueryTest.php @@ -1,18 +1,18 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2013, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Test\TestCase\Model\Datasource\Database; diff --git a/lib/Cake/Test/TestCase/Model/Datasource/Database/TypeTest.php b/lib/Cake/Test/TestCase/Model/Datasource/Database/TypeTest.php index 3d711f3e0b0..1fbf5e377bb 100644 --- a/lib/Cake/Test/TestCase/Model/Datasource/Database/TypeTest.php +++ b/lib/Cake/Test/TestCase/Model/Datasource/Database/TypeTest.php @@ -1,18 +1,18 @@ - * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * - * Licensed under The Open Group Test Suite License + * Licensed under The MIT License + * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests - * @package Cake.Test.Case.Model.Datasource.Database - * @since CakePHP(tm) v 3.0 + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project + * @package Cake.Model + * @since CakePHP(tm) v 3.0.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ namespace Cake\Test\TestCase\Model\Datasource\Database; @@ -23,7 +23,7 @@ /** * Mock class for testing type registering * - **/ + */ class FooType extends \Cake\Model\Datasource\Database\Type { } @@ -31,21 +31,21 @@ class FooType extends \Cake\Model\Datasource\Database\Type { /** * Tests Type class * - **/ + */ class TypeTest extends \Cake\TestSuite\TestCase { /** * Original type map * * @var array - **/ + */ protected $_originalMap = array(); /** * Backup original Type class state * * @return void - **/ + */ public function setUp() { $this->_originalMap = Type::map(); parent::setUp(); @@ -55,7 +55,7 @@ public function setUp() { * Restores Type class state * * @return void - **/ + */ public function tearDown() { Type::map($this->_originalMap); } @@ -65,7 +65,7 @@ public function tearDown() { * * @dataProvider basicTypesProvider * @return void - **/ + */ public function testBuildBasicTypes($name) { $type = Type::build($name); $this->assertInstanceOf('\Cake\Model\Datasource\Database\Type', $type); @@ -76,7 +76,7 @@ public function testBuildBasicTypes($name) { * provides a basics type list to be used as data provided for a test * * @return void - **/ + */ public function basicTypesProvider() { return array( array('float'), @@ -91,7 +91,7 @@ public function basicTypesProvider() { * * @expectedException InvalidArgumentException * @return void - **/ + */ public function testBuildUnknownType() { Type::build('foo'); } @@ -101,7 +101,7 @@ public function testBuildUnknownType() { * for future use * * @return void - **/ + */ public function testInstanceRecycling() { $type = Type::build('integer'); $this->assertSame($type, Type::build('integer')); @@ -111,7 +111,7 @@ public function testInstanceRecycling() { * Tests new types can be registered and built * * @return void - **/ + */ public function testMapAndBuild() { $map = Type::map(); $this->assertNotEmpty($map); @@ -132,7 +132,7 @@ public function testMapAndBuild() { * Tests clear function in conjunction with map * * @return void - **/ + */ public function testClear() { $map = Type::map(); $this->assertNotEmpty($map); @@ -151,7 +151,7 @@ public function testClear() { * Tests floats from database are converted correctly to PHP * * @return void - **/ + */ public function testFloatToPHP() { $type = Type::build('float'); $float = '3.14159'; @@ -165,7 +165,7 @@ public function testFloatToPHP() { * Tests floats from PHP are converted correctly to statement value * * @return void - **/ + */ public function testFloatToStatement() { $type = Type::build('float'); @@ -178,7 +178,7 @@ public function testFloatToStatement() { * Tests integers from database are converted correctly to PHP * * @return void - **/ + */ public function testIntegerToPHP() { $type = Type::build('integer'); $integer = '3'; @@ -192,7 +192,7 @@ public function testIntegerToPHP() { * Tests integers from PHP are converted correctly to statement value * * @return void - **/ + */ public function testIntegerToStatement() { $type = Type::build('integer'); $integer = '3'; @@ -204,7 +204,7 @@ public function testIntegerToStatement() { * Tests integers from database are converted correctly to PHP * * @return void - **/ + */ public function testStringToPHP() { $type = Type::build('string'); $string = 'foo'; @@ -218,7 +218,7 @@ public function testStringToPHP() { * Tests integers from PHP are converted correctly to statement value * * @return void - **/ + */ public function testStringToStatement() { $type = Type::build('string'); $string = '3'; @@ -230,7 +230,7 @@ public function testStringToStatement() { * Tests integers from database are converted correctly to PHP * * @return void - **/ + */ public function testTextToPHP() { $type = Type::build('string'); $string = 'foo'; @@ -244,7 +244,7 @@ public function testTextToPHP() { * Tests integers from PHP are converted correctly to statement value * * @return void - **/ + */ public function testTextToStatement() { $type = Type::build('string'); $string = '3';