Author: romanb Date: 2008-09-12 13:25:56 +0100 (Fri, 12 Sep 2008) New Revision: 4941
Removed: trunk/lib/Doctrine/Adapter.php trunk/lib/Doctrine/Adapter/ trunk/lib/Doctrine/ConnectionFactory.php trunk/lib/Doctrine/ConnectionFactory/ Modified: trunk/lib/Doctrine/EntityManager.php trunk/tests/lib/Doctrine_TestUtil.php Log: moved connectionfactory. removed old adapters. Deleted: trunk/lib/Doctrine/Adapter.php =================================================================== --- trunk/lib/Doctrine/Adapter.php 2008-09-12 12:17:31 UTC (rev 4940) +++ trunk/lib/Doctrine/Adapter.php 2008-09-12 12:25:56 UTC (rev 4941) @@ -1,106 +0,0 @@ -<?php -/* - * $Id$ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see - * <http://www.phpdoctrine.org>. - */ - -/** - * - * Doctrine_Adapter - * - * @package Doctrine - * @subpackage Adapter - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.phpdoctrine.org - * @since 1.0 - * @version $Revision$ - * @author Konsta Vesterinen <[EMAIL PROTECTED]> - * @todo Remove. - */ -class Doctrine_Adapter -{ - const ATTR_AUTOCOMMIT = 0; - const ATTR_CASE = 8; - const ATTR_CLIENT_VERSION = 5; - const ATTR_CONNECTION_STATUS = 7; - const ATTR_CURSOR = 10; - const ATTR_CURSOR_NAME = 9; - const ATTR_DRIVER_NAME = 16; - const ATTR_ERRMODE = 3; - const ATTR_FETCH_CATALOG_NAMES = 15; - const ATTR_FETCH_TABLE_NAMES = 14; - const ATTR_MAX_COLUMN_LEN = 18; - const ATTR_ORACLE_NULLS = 11; - const ATTR_PERSISTENT = 12; - const ATTR_PREFETCH = 1; - const ATTR_SERVER_INFO = 6; - const ATTR_SERVER_VERSION = 4; - const ATTR_STATEMENT_CLASS = 13; - const ATTR_STRINGIFY_FETCHES = 17; - const ATTR_TIMEOUT = 2; - const CASE_LOWER = 2; - const CASE_NATURAL = 0; - const CASE_UPPER = 1; - const CURSOR_FWDONLY = 0; - const CURSOR_SCROLL = 1; - const ERR_ALREADY_EXISTS = NULL; - const ERR_CANT_MAP = NULL; - const ERR_CONSTRAINT = NULL; - const ERR_DISCONNECTED = NULL; - const ERR_MISMATCH = NULL; - const ERR_NO_PERM = NULL; - const ERR_NONE = '00000'; - const ERR_NOT_FOUND = NULL; - const ERR_NOT_IMPLEMENTED = NULL; - const ERR_SYNTAX = NULL; - const ERR_TRUNCATED = NULL; - const ERRMODE_EXCEPTION = 2; - const ERRMODE_SILENT = 0; - const ERRMODE_WARNING = 1; - const FETCH_ASSOC = 2; - const FETCH_BOTH = 4; - const FETCH_BOUND = 6; - const FETCH_CLASS = 8; - const FETCH_CLASSTYPE = 262144; - const FETCH_COLUMN = 7; - const FETCH_FUNC = 10; - const FETCH_GROUP = 65536; - const FETCH_INTO = 9; - const FETCH_LAZY = 1; - const FETCH_NAMED = 11; - const FETCH_NUM = 3; - const FETCH_OBJ = 5; - const FETCH_ORI_ABS = 4; - const FETCH_ORI_FIRST = 2; - const FETCH_ORI_LAST = 3; - const FETCH_ORI_NEXT = 0; - const FETCH_ORI_PRIOR = 1; - const FETCH_ORI_REL = 5; - const FETCH_SERIALIZE = 524288; - const FETCH_UNIQUE = 196608; - const NULL_EMPTY_STRING = 1; - const NULL_NATURAL = 0; - const NULL_TO_STRING = NULL; - const PARAM_BOOL = 5; - const PARAM_INPUT_OUTPUT = -2147483648; - const PARAM_INT = 1; - const PARAM_LOB = 3; - const PARAM_NULL = 0; - const PARAM_STMT = 4; - const PARAM_STR = 2; -} Deleted: trunk/lib/Doctrine/ConnectionFactory.php =================================================================== --- trunk/lib/Doctrine/ConnectionFactory.php 2008-09-12 12:17:31 UTC (rev 4940) +++ trunk/lib/Doctrine/ConnectionFactory.php 2008-09-12 12:25:56 UTC (rev 4941) @@ -1,112 +0,0 @@ -<?php -/* - * $Id$ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the LGPL. For more information, see - * <http://www.phpdoctrine.org>. - */ - -#namespace Doctrine::DBAL; - -/** - * Factory for creating dbms-specific Connection instances. - * - * @author Roman Borschel <[EMAIL PROTECTED]> - * @since 2.0 - */ -class Doctrine_ConnectionFactory -{ - /** - * List of supported drivers and their mappings to the driver class. - * - * @var array - */ - private $_drivers = array( - 'mysql' => 'Doctrine_Connection_Mysql', - 'sqlite' => 'Doctrine_Connection_Sqlite', - 'pgsql' => 'Doctrine_Connection_Pgsql', - 'oci' => 'Doctrine_Connection_Oracle', - 'oci8' => 'Doctrine_Connection_Oracle', - 'oracle' => 'Doctrine_Connection_Oracle', - 'mssql' => 'Doctrine_Connection_Mssql', - 'dblib' => 'Doctrine_Connection_Mssql', - 'firebird' => 'Doctrine_Connection_Firebird', - 'informix' => 'Doctrine_Connection_Informix', - ); - - public function __construct() - { - - } - - /** - * Creates a connection object with the specified parameters. - * - * @param array $params - * @return Connection - */ - public function createConnection(array $params, Doctrine_Common_Configuration $config = null, - Doctrine_Common_EventManager $eventManager = null) - { - // create default config and event manager, if not set - if ( ! $config) { - $config = new Doctrine_Common_Configuration(); - } - if ( ! $eventManager) { - $eventManager = new Doctrine_Common_EventManager(); - } - - // check for existing pdo object - if (isset($params['pdo']) && ! $params['pdo'] instanceof PDO) { - throw Doctrine_ConnectionFactory_Exception::invalidPDOInstance(); - } else if (isset($params['pdo'])) { - $params['driver'] = $params['pdo']->getAttribute(PDO::ATTR_DRIVER_NAME); - } else { - $this->_checkParams($params); - } - if (isset($params['driverClass'])) { - $className = $params['driverClass']; - } else { - $className = $this->_drivers[$params['driver']]; - } - - return new $className($params, $config, $eventManager); - } - - /** - * Checks the list of parameters. - * - * @param array $params - */ - private function _checkParams(array $params) - { - // check existance of mandatory parameters - - // driver - if ( ! isset($params['driver']) && ! isset($params['driverClass'])) { - throw Doctrine_ConnectionFactory_Exception::driverRequired(); - } - - // check validity of parameters - - // driver - if ( isset($params['driver']) && ! isset($this->_drivers[$params['driver']])) { - throw Doctrine_ConnectionFactory_Exception::unknownDriver($params['driver']); - } - } -} - -?> \ No newline at end of file Modified: trunk/lib/Doctrine/EntityManager.php =================================================================== --- trunk/lib/Doctrine/EntityManager.php 2008-09-12 12:17:31 UTC (rev 4940) +++ trunk/lib/Doctrine/EntityManager.php 2008-09-12 12:25:56 UTC (rev 4941) @@ -702,8 +702,8 @@ Doctrine_EventManager $eventManager = null) { if (is_array($conn)) { - $connFactory = new Doctrine_ConnectionFactory(); - $conn = $connFactory->createConnection($conn, $config, $eventManager); + $connFactory = new Doctrine_DBAL_DriverManager(); + $conn = $connFactory->getConnection($conn, $config, $eventManager); } else if ( ! $conn instanceof Doctrine_Connection) { throw new Doctrine_Exception("Invalid parameter '$conn'."); } Modified: trunk/tests/lib/Doctrine_TestUtil.php =================================================================== --- trunk/tests/lib/Doctrine_TestUtil.php 2008-09-12 12:17:31 UTC (rev 4940) +++ trunk/tests/lib/Doctrine_TestUtil.php 2008-09-12 12:25:56 UTC (rev 4941) @@ -4,7 +4,7 @@ { public static function getConnection() { - $connFactory = new Doctrine_ConnectionFactory(); + $connFactory = new Doctrine_DBAL_DriverManager(); if (isset($GLOBALS['db_type'], $GLOBALS['db_username'], $GLOBALS['db_password'], $GLOBALS['db_host'], $GLOBALS['db_name'])) { @@ -24,7 +24,7 @@ ); } - return $connFactory->createConnection($params); + return $connFactory->getConnection($params); } /* public static function autoloadModel($className) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "doctrine-svn" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.co.uk/group/doctrine-svn?hl=en-GB -~----------~----~----~----~------~----~------~--~---
