Commit 4d7b8838 authored by romanb's avatar romanb

Intermediate checkin. Refactoring towards namespaced structure.

parent ad4db34a
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Adapter');
/**
* Doctrine_Adapter_Db2
* IBM DB2 Adapter [BORROWED FROM ZEND FRAMEWORK]
......@@ -30,6 +30,7 @@ Doctrine::autoload('Doctrine_Adapter');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @deprecated
*/
class Doctrine_Adapter_Db2 extends Doctrine_Adapter
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Exception');
/**
* Doctrine_Adapter_Exception
*
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Exception');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Adapter_Exception extends Doctrine_Exception
{ }
......@@ -29,7 +29,8 @@
* @subpackage Adapter
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @deprecated
*/
interface Doctrine_Adapter_Interface {
public function prepare($prepareString);
......
......@@ -29,7 +29,8 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @deprecated
*/
class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable
{
......
......@@ -30,6 +30,7 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1080 $
* @deprecated
*/
class Doctrine_Adapter_Mysqli extends Doctrine_Adapter
{
......
......@@ -28,7 +28,9 @@
* @subpackage Adapter
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 2702 $
* @version $Revision: 2702 $
* @deprecated
* @todo Remove
*/
class Doctrine_Adapter_Resource implements Doctrine_Adapter_Interface
{
......
......@@ -28,7 +28,8 @@
* @subpackage Adapter
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @deprecated
*/
interface Doctrine_Adapter_Statement_Interface
{
......
<?php
#namespace Doctrine::ORM::Mappings;
#namespace Doctrine::ORM::Mapping;
/**
* A many-to-many mapping describes the mapping between two collections of
......
......@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Mappings;
#namespace Doctrine::ORM::Mapping;
/**
* Represents a one-to-many mapping.
......
......@@ -19,19 +19,16 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::Common::Cache;
#namespace Doctrine::ORM::Cache;
/**
* Doctrine_Cache_Apc
* APC cache driver.
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @todo Rename to ApcCache
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class Doctrine_Cache_Apc extends Doctrine_Cache_Driver
{
......
......@@ -20,17 +20,15 @@
*/
/**
* Doctrine_Cache_Interface
* Array cache driver.
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
*/
class Doctrine_Cache_Array implements Countable, Doctrine_Cache_Interface
class Doctrine_Cache_Array implements Doctrine_Cache_Interface
{
/**
* @var array $data an array of cached data
......
......@@ -20,10 +20,8 @@
*/
/**
* Doctrine_Cache_Driver
* Base class for cache drivers.
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
......
......@@ -20,10 +20,8 @@
*/
/**
* Doctrine_Cache_Memcache
* Memcache cache driver.
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
......
......@@ -20,10 +20,8 @@
*/
/**
* Doctrine_Cache_Xcache
* Xcache cache driver.
*
* @package Doctrine
* @subpackage Cache
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
......
......@@ -19,14 +19,14 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
/**
* The code metadata driver loads the metadata of the classes through invoking
* a static callback method that needs to be implemented when using this driver.
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @package Doctrine
* @subpackage ClassMetadata
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version $Revision$
* @link www.phpdoctrine.org
......
<?php
//@deprecated
class Doctrine_ClassMetadata_Exception extends Doctrine_Exception {}
\ No newline at end of file
......@@ -22,7 +22,7 @@
#namespace Doctrine::ORM;
/**
* A persistent collection of entities.
* A persistent collection.
*
* A collection object is strongly typed in the sense that it can only contain
* entities of a specific type or one of it's subtypes. A collection object is
......
......@@ -28,7 +28,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
......@@ -29,7 +29,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
abstract class Doctrine_Collection_Iterator implements Iterator
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Collection_Iterator');
/**
* Doctrine_Collection_Iterator_Normal
*
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Collection_Iterator');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Iterator_Expandable extends Doctrine_Collection_Iterator
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Collection_Iterator');
/**
* Doctrine_Collection_Iterator_Normal
*
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Collection_Iterator');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Iterator_Normal extends Doctrine_Collection_Iterator
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Collection_Iterator');
/**
* Doctrine_Collection_Iterator_Normal
*
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Collection_Iterator');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Iterator_Offset extends Doctrine_Collection_Iterator
{
......
......@@ -28,7 +28,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Collection_Offset extends Doctrine_Collection
{
......
......@@ -28,7 +28,8 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @deprecated
*/
class Doctrine_Compiler_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
This diff is collapsed.
......@@ -29,7 +29,8 @@
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @TODO Remove this class and move the modifyLimitQuery implementation to Connection.
* @TODO Remove this class and move the modifyLimitQuery implementation to Connection.
* @deprecated
*/
class Doctrine_Connection_Common extends Doctrine_Connection
{
......
......@@ -28,7 +28,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Connection_Db2 extends Doctrine_Connection
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Exception');
/**
* Doctrine_Exception
*
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Exception');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Connection_Exception extends Doctrine_Exception
{
......
......@@ -30,7 +30,8 @@
* @author Lorenzo Alberton <l.alberton@quipo.it> (PEAR MDB2 Interbase driver)
* @version $Revision$
* @link www.phpdoctrine.org
* @since 1.0
* @since 1.0
* @deprecated
*/
class Doctrine_Connection_Firebird extends Doctrine_Connection
{
......
......@@ -28,7 +28,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Connection_Informix extends Doctrine_Connection
{
......
......@@ -28,7 +28,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Connection_Module
{
......
......@@ -29,7 +29,8 @@
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @version $Revision$
* @link www.phpdoctrine.org
* @since 1.0
* @since 1.0
* @deprecated
*/
class Doctrine_Connection_Mssql extends Doctrine_Connection
{
......
......@@ -29,7 +29,8 @@
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @version $Revision$
* @link www.phpdoctrine.org
* @since 1.0
* @since 1.0
* @deprecated
*/
class Doctrine_Connection_Mysql extends Doctrine_Connection_Common
{
......
......@@ -26,7 +26,8 @@
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Connection_Oracle extends Doctrine_Connection
{
......
......@@ -29,7 +29,8 @@
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @version $Revision$
* @link www.phpdoctrine.org
* @since 1.0
* @since 1.0
* @deprecated
*/
class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Overloadable');
/**
* Doctrine_Connection_Profiler
*
......@@ -28,7 +28,9 @@ Doctrine::autoload('Doctrine_Overloadable');
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @deprecated
* @todo remove
*/
class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAggregate, Countable
{
......
......@@ -18,7 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
Doctrine::autoload('Doctrine_Connection_Profiler_Exception');
/**
* Doctrine_Connection_Profiler_Exception
*
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Connection_Profiler_Exception');
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision: 1345 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @deprecated
*/
class Doctrine_Connection_Profiler_Exception extends Doctrine_Exception
{
......
......@@ -31,7 +31,8 @@
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
* @version $Revision$
* @link www.phpdoctrine.org
* @since 1.0
* @since 1.0
* @deprecated
*/
class Doctrine_Connection_Sqlite extends Doctrine_Connection_Common
{
......
......@@ -18,6 +18,8 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::DBAL;
/**
* A thin wrapper around PDOStatement.
......
......@@ -19,7 +19,7 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
#namespace Doctrine::ORM;
#use Doctrine::ORM::Entity;
#use Doctrine::ORM::EntityManager;
......@@ -36,7 +36,7 @@
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @todo Rename: Doctrine::ORM::(Internal::)UnitOfWork.
* @todo Rename: Doctrine::ORM::UnitOfWork.
* @todo Turn connection exceptions into UnitOfWorkExceptions.
*/
class Doctrine_Connection_UnitOfWork
......
<?php
/**
* Connection interface.
* Drivers must implement this interface.
*
* This includes the full PDO interface as well as custom extensions of
* Doctrine's DBAL.
*
* @since 2.0
*/
interface Doctrine_DBAL_Connection
{
const TRANSACTION_READ_UNCOMMITTED = 1;
const TRANSACTION_READ_COMMITTED = 2;
const TRANSACTION_REPEATABLE_READ = 3;
const TRANSACTION_SERIALIZABLE = 4;
/* PDO interface */
public function prepare($prepareString);
public function query($queryString);
public function quote($input);
public function exec($statement);
public function lastInsertId();
public function beginTransaction();
public function commit();
public function rollBack();
public function errorCode();
public function errorInfo();
/* Doctrine DBAL extensions */
public function setTransactionIsolation($level);
public function getTransactionIsolation();
}
?>
\ No newline at end of file
<?php
/**
* Driver interface.
* Interface that all DBAL drivers must implement.
*
* @since 2.0
*/
interface Doctrine_DBAL_Driver
{
/**
* Attempts to create a connection with the database.
*
* @param array $params All connection parameters passed by the user.
* @param string $username The username to use when connecting.
* @param string $password The password to use when connecting.
* @param array $driverOptions The driver options to use when connecting.
* @return Doctrine::DBAL::Connection The database connection.
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array());
/**
* Gets the DatabasePlatform instance that provides all the metadata about
* the platform this driver connects to.
*
* @return Doctrine::DBAL::DatabasePlatform The database platform.
*/
public function getDatabasePlatform();
/**
* Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to.
*
* @return Doctrine::DBAL::SchemaManager
*/
public function getSchemaManager();
}
?>
\ No newline at end of file
<?php
#namespace Doctrine::DBAL::Driver::PDOMsSql;
/**
* MsSql Connection implementation.
*
* @since 2.0
*/
class Doctrine_DBAL_Driver_PDOMsSql_Connection extends PDO implements Doctrine_DBAL_Connection
{
private $_isolationLevel = Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED;
/**
* Set the transacton isolation level.
*
* @param string standard isolation level (SQL-92)
* portable modes:
* READ UNCOMMITTED (allows dirty reads)
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
*
* @link http://msdn2.microsoft.com/en-us/library/ms173763.aspx
* @throws PDOException if something fails at the PDO level
* @throws Doctrine_Transaction_Exception if using unknown isolation level or unknown wait option
* @return void
* @override
*/
public function setTransactionIsolation($level, $options = array()) {
$sql = "";
switch ($level) {
case Doctrine_DBAL_Connection::TRANSACTION_READ_UNCOMMITTED:
$sql = 'READ UNCOMMITTED';
break;
case Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED:
$sql = 'READ COMMITTED';
break;
case Doctrine_DBAL_Connection::TRANSACTION_REPEATABLE_READ:
$sql = 'REPEATABLE READ';
break;
case Doctrine_DBAL_Connection::TRANSACTION_SERIALIZABLE:
$sql = 'SERIALIZABLE';
break;
default:
throw new Doctrine_Transaction_Exception('isolation level is not supported: ' . $isolation);
}
$this->_isolationLevel = $level;
$this->exec('SET TRANSACTION ISOLATION LEVEL ' . $sql);
}
public function getTransactionIsolation()
{
return $this->_isolationLevel;
}
/**
* Performs the rollback.
*
* @override
*/
public function rollback()
{
$this->exec('ROLLBACK TRANSACTION');
}
/**
* Performs the commit.
*
* @override
*/
public function commit()
{
$this->exec('COMMIT TRANSACTION');
}
/**
* Begins a database transaction.
*
* @override
*/
public function beginTransaction()
{
$this->exec('BEGIN TRANSACTION');
}
}
?>
\ No newline at end of file
<?php
#namespace Doctrine::DBAL::Driver::PDOMySql;
#use Doctrine::DBAL::Driver;
class Doctrine_DBAL_Driver_PDOMsSql_Driver implements Doctrine_DBAL_Driver
{
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new PDO($this->_constructPdoDsn($params), $username, $password, $driverOptions);
}
/**
* Constructs the MySql PDO DSN.
*
* Overrides Connection#_constructPdoDsn().
*
* @return string The DSN.
*/
private function _constructPdoDsn(array $params)
{
//TODO
}
public function getDatabasePlatform()
{
return new Doctrine_DatabasePlatform_MySqlPlatform();
}
public function getSchemaManager(Doctrine_Connection $conn)
{
return new Doctrine_Schema_MySqlSchemaManager($conn);
}
}
?>
\ No newline at end of file
<?php
class Doctrine_DBAL_Driver_PDOMySql_Connection extends PDO implements Doctrine_DBAL_Connection
{
private $_isolationLevel = Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED;
/**
* Set the transacton isolation level.
*
* @param string standard isolation level
* READ UNCOMMITTED (allows dirty reads)
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
*
* @throws Doctrine_Transaction_Exception if using unknown isolation level
* @throws PDOException if something fails at the PDO level
* @return void
*/
public function setTransactionIsolation($level)
{
$sql = "";
switch ($level) {
case Doctrine_DBAL_Connection::TRANSACTION_READ_UNCOMMITTED:
$sql = 'READ UNCOMMITTED';
break;
case Doctrine_DBAL_Connection::TRANSACTION_READ_COMMITTED:
$sql = 'READ COMMITTED';
break;
case Doctrine_DBAL_Connection::TRANSACTION_REPEATABLE_READ:
$sql = 'REPEATABLE READ';
break;
case Doctrine_DBAL_Connection::TRANSACTION_SERIALIZABLE:
$sql = 'SERIALIZABLE';
break;
default:
throw new Doctrine_Transaction_Exception('isolation level is not supported: ' . $isolation);
}
$this->_isolationLevel = $level;
return $this->exec('SET SESSION TRANSACTION ISOLATION LEVEL ' . $sql);
}
/**
* getTransactionIsolation
*
* @return string returns the current session transaction isolation level
*/
public function getTransactionIsolation()
{
return $this->_isolationLevel;
}
}
?>
\ No newline at end of file
<?php
#namespace Doctrine::DBAL::Driver::PDOMySql;
#use Doctrine::DBAL::Driver;
class Doctrine_DBAL_Driver_PDOMySql_Driver implements Doctrine_DBAL_Driver
{
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new PDO($this->_constructPdoDsn($params), $username, $password, $driverOptions);
}
/**
* Constructs the MySql PDO DSN.
*
* Overrides Connection#_constructPdoDsn().
*
* @return string The DSN.
*/
private function _constructPdoDsn(array $params)
{
$dsn = 'mysql:';
if (isset($params['host'])) {
$dsn .= 'host=' . $params['host'] . ';';
}
if (isset($params['port'])) {
$dsn .= 'port=' . $params['port'] . ';';
}
if (isset($params['dbname'])) {
$dsn .= 'dbname=' . $params['dbname'] . ';';
}
if (isset($params['unix_socket'])) {
$dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
}
return $dsn;
}
public function getDatabasePlatform()
{
return new Doctrine_DatabasePlatform_MySqlPlatform();
}
public function getSchemaManager(Doctrine_Connection $conn)
{
return new Doctrine_Schema_MySqlSchemaManager($conn);
}
}
?>
\ No newline at end of file
<?php
#namespace Doctrine::DBAL::Driver::PDOOracle;
#use Doctrine::DBAL::Driver;
class Doctrine_DBAL_Driver_PDOOracle_Driver implements Doctrine_DBAL_Driver
{
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new PDO($this->_constructPdoDsn($params), $username, $password, $driverOptions);
}
/**
* Constructs the Oracle PDO DSN.
*
* @return string The DSN.
*/
private function _constructPdoDsn(array $params)
{
//TODO
}
public function getDatabasePlatform()
{
return new Doctrine_DatabasePlatform_OraclePlatform();
}
public function getSchemaManager(Doctrine_Connection $conn)
{
return new Doctrine_Schema_OracleSchemaManager($conn);
}
}
?>
\ No newline at end of file
<?php
#namespace Doctrine::DBAL::Driver::PDOPgSql;
/**
* Driver that connects through pdo_pgsql.
*
* @since 2.0
*/
class Doctrine_DBAL_Driver_PDOPgSql_Driver implements Doctrine_DBAL_Driver
{
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new PDO($this->_constructPdoDsn($params), $username, $password, $driverOptions);
}
/**
* Constructs the Postgres PDO DSN.
*
* @return string The DSN.
*/
private function _constructPdoDsn(array $params)
{
//TODO
}
public function getDatabasePlatform()
{
return new Doctrine_DatabasePlatform_PostgreSqlPlatform();
}
public function getSchemaManager(Doctrine_Connection $conn)
{
return new Doctrine_Schema_PostgreSqlSchemaManager($conn);
}
}
?>
\ No newline at end of file
<?php
#namespace Doctrine::DBAL::Driver::PDOOracle;
#use Doctrine::DBAL::Driver;
class Doctrine_DBAL_Driver_PDOSqlite_Driver implements Doctrine_DBAL_Driver
{
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
return new PDO($this->_constructPdoDsn($params), $username, $password, $driverOptions);
}
/**
* Constructs the Sqlite PDO DSN.
*
* @return string The DSN.
* @override
*/
protected function _constructPdoDsn(array $params)
{
$dsn = 'sqlite:';
if (isset($params['path'])) {
$dsn .= $params['path'];
} else if (isset($params['memory'])) {
$dsn .= ':memory:';
}
return $dsn;
}
public function getDatabasePlatform()
{
return new Doctrine_DatabasePlatform_SqlitePlatform();
}
public function getSchemaManager(Doctrine_Connection $conn)
{
return new Doctrine_Schema_SqliteSchemaManager($conn);
}
}
?>
\ No newline at end of file
This diff is collapsed.
<?php
#namespace Doctrine::DBAL::Platforms;
class Doctrine_DBAL_Platforms_Db2Platform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
public function getSequenceNextValSql($sequenceName) {
return 'SELECT NEXTVAL FOR ' . $this->quoteIdentifier($sequenceName)
. ' FROM SYSIBM.SYSDUMMY1';
}
}
?>
\ No newline at end of file
......@@ -7,7 +7,7 @@
*
* @since 2.0
*/
class Doctrine_DatabasePlatform_FirebirdPlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_FirebirdPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
/**
......
......@@ -7,7 +7,7 @@
*
* @since 2.0
*/
class Doctrine_DatabasePlatform_InformixPlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_InformixPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
public function __construct()
......
<?php
#namespace Doctrine::DBAL::Platforms;
class Doctrine_DatabasePlatform_MockPlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_MockPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
public function getNativeDeclaration(array $field) {}
public function getPortableDeclaration(array $field) {}
......
<?php
class Doctrine_DatabasePlatform_MsSqlPlatform extends Doctrine_DatabasePlatform
#namespace Doctrine::DBAL::Platforms;
class Doctrine_DBAL_Platforms_MsSqlPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
/**
* the constructor
......@@ -279,6 +281,36 @@ class Doctrine_DatabasePlatform_MsSqlPlatform extends Doctrine_DatabasePlatform
'fixed' => $fixed);
}
/**
* Quote a string so it can be safely used as a table / column name
*
* Quoting style depends on which database driver is being used.
*
* @param string $identifier identifier name to be quoted
* @param bool $checkOption check the 'quote_identifier' option
*
* @return string quoted identifier string
* @override
*/
public function quoteIdentifier($identifier, $checkOption = false)
{
if ($checkOption && ! $this->getAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER)) {
return $identifier;
}
if (strpos($identifier, '.') !== false) {
$parts = explode('.', $identifier);
$quotedParts = array();
foreach ($parts as $p) {
$quotedParts[] = $this->quoteIdentifier($p);
}
return implode('.', $quotedParts);
}
return '[' . str_replace(']', ']]', $identifier) . ']';
}
}
?>
\ No newline at end of file
......@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::DBAL::Platforms;
/**
* The MySqlPlatform provides the behavior, features and SQL dialect of the
* MySQL database platform.
......@@ -26,7 +28,7 @@
* @since 2.0
* @author Roman Borschel <roman@code-factory.org>
*/
class Doctrine_DatabasePlatform_MySqlPlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_MySqlPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
/**
* MySql reserved words.
......
......@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::DBAL::Platforms;
/**
* Base class for all DatabasePlatforms. The DatabasePlatforms are the central
* point of abstraction of platform-specific behaviors, features and SQL dialects.
......@@ -28,7 +30,7 @@
* @author Roman Borschel <roman@code-factory.org>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
*/
class Doctrine_DatabasePlatform_OraclePlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_OraclePlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
/**
* Constructor.
......
<?php
#namespace Doctrine::DBAL::Platforms;
class Doctrine_DatabasePlatform_PostgreSqlPlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_PostgreSqlPlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
/**
* The reserved keywords by pgsql. Ordered alphabetically.
......
......@@ -7,7 +7,7 @@
*
* @since 2.0
*/
class Doctrine_DatabasePlatform_SqlitePlatform extends Doctrine_DatabasePlatform
class Doctrine_DBAL_Platforms_SqlitePlatform extends Doctrine_DBAL_Platforms_AbstractPlatform
{
/**
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
*
* @since 2.0
*/
class Doctrine_DataType_ArrayType extends Doctrine_DataType
class Doctrine_DBAL_Types_ArrayType extends Doctrine_DBAL_Types_Type
{
......
......@@ -4,7 +4,7 @@
* Type that maps an SQL boolean to a PHP boolean.
*
*/
class Doctrine_DataType_BooleanType extends Doctrine_DataType
class Doctrine_DBAL_Types_BooleanType extends Doctrine_DBAL_Types_Type
{
/**
* Enter description here...
......
......@@ -5,7 +5,7 @@
*
* @since 2.0
*/
class Doctrine_DataType_DateTimeType extends Doctrine_DataType
class Doctrine_DBAL_Types_DateTimeType extends Doctrine_DBAL_Types_Type
{
/**
* Enter description here...
......
......@@ -4,7 +4,7 @@
* Type that maps an SQL DECIMAL to a PHP double.
*
*/
class Doctrine_DataType_DecimalType extends Doctrine_DataType
class Doctrine_DBAL_Types_DecimalType extends Doctrine_DBAL_Types_Type
{
}
......
......@@ -4,7 +4,7 @@
* Type that maps an SQL INT/MEDIUMINT/BIGINT to a PHP integer.
*
*/
class Doctrine_DataType_IntegerType extends Doctrine_DataType
class Doctrine_DBAL_Types_IntegerType extends Doctrine_DBAL_Types_Type
{
......
......@@ -7,7 +7,7 @@
*
* @since 2.0
*/
class Doctrine_DataType_StringType extends Doctrine_DataType
class Doctrine_DBAL_Types_StringType extends Doctrine_DBAL_Types_Type
{
public function getSqlDeclaration(array $fieldDeclaration, Doctrine_DatabasePlatform $platform)
{
......
......@@ -5,7 +5,7 @@
*
* @since 2.0
*/
class Doctrine_DataType_TextType extends Doctrine_DataType
class Doctrine_DBAL_Types_TextType extends Doctrine_DBAL_Types_Type
{
/**
* Enter description here...
......
......@@ -1762,6 +1762,18 @@ abstract class Doctrine_DatabasePlatform
}
return $item;
}
/**
* Enter description here...
*
* @param unknown_type $charset
* @return string
*/
public function getSetCharsetSql($charset)
{
return 'SET NAMES ' . $this->quote($charset);
}
/* supports*() metods */
......
......@@ -19,6 +19,8 @@
* <http://www.phpdoctrine.org>.
*/
#namespace Doctrine::ORM::Internal;
/**
* Defines an array hydration strategy.
*
......
......@@ -31,16 +31,7 @@
* @since 2.0
*/
class Doctrine_Schema_MySqlSchemaManager extends Doctrine_Schema_SchemaManager
{
/*protected $_sql = array(
'showDatabases' => 'SHOW DATABASES',
'listTableFields' => 'DESCRIBE %s',
'listSequences' => 'SHOW TABLES',
'listTables' => 'SHOW TABLES',
'listUsers' => 'SELECT DISTINCT USER FROM USER',
'listViews' => "SHOW FULL TABLES %s WHERE Table_type = 'VIEW'",
);*/
{
public function __construct(Doctrine_Connection $conn)
{
$this->_conn = $conn;
......
......@@ -30,7 +30,8 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @deprecated
*/
class Doctrine_Transaction extends Doctrine_Connection_Module
{
......@@ -110,29 +111,17 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
public function begin($savepoint = null)
{
$this->conn->connect();
//$listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER);
if ( ! is_null($savepoint)) {
$this->savePoints[] = $savepoint;
//$event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_CREATE);
//$listener->preSavepointCreate($event);
//if ( ! $event->skipOperation) {
$this->createSavePoint($savepoint);
//}
//$listener->postSavepointCreate($event);
$this->createSavePoint($savepoint);
} else {
if ($this->_nestingLevel == 0) {
//$event = new Doctrine_Event($this, Doctrine_Event::TX_BEGIN);
//$listener->preTransactionBegin($event);
//if ( ! $event->skipOperation) {
try {
$this->_doBeginTransaction();
} catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage());
}
//}
//$listener->postTransactionBegin($event);
try {
$this->_doBeginTransaction();
} catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage());
}
}
}
......@@ -161,24 +150,12 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
$this->conn->connect();
//$listener = $this->conn->getAttribute(Doctrine::ATTR_LISTENER);
if ( ! is_null($savepoint)) {
$this->_nestingLevel -= $this->removeSavePoints($savepoint);
//$event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_COMMIT);
//$listener->preSavepointCommit($event);
//if ( ! $event->skipOperation) {
$this->releaseSavePoint($savepoint);
//}
//$listener->postSavepointCommit($event);
$this->releaseSavePoint($savepoint);
} else {
if ($this->_nestingLevel == 1) {
//$event = new Doctrine_Event($this, Doctrine_Event::TX_COMMIT);
//$listener->preTransactionCommit($event);
//if ( ! $event->skipOperation) {
$this->_doCommit();
//}
//$listener->postTransactionCommit($event);
$this->_doCommit();
}
if ($this->_nestingLevel > 0) {
......@@ -219,24 +196,14 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
if ( ! is_null($savepoint)) {
$this->_nestingLevel -= $this->removeSavePoints($savepoint);
//$event = new Doctrine_Event($this, Doctrine_Event::SAVEPOINT_ROLLBACK);
//$listener->preSavepointRollback($event);
//if ( ! $event->skipOperation) {
$this->rollbackSavePoint($savepoint);
//}
//$listener->postSavepointRollback($event);
$this->rollbackSavePoint($savepoint);
} else {
//$event = new Doctrine_Event($this, Doctrine_Event::TX_ROLLBACK);
//$listener->preTransactionRollback($event);
//if ( ! $event->skipOperation) {
$this->_nestingLevel = 0;
try {
$this->_doRollback();
} catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage());
}
//}
//$listener->postTransactionRollback($event);
$this->_nestingLevel = 0;
try {
$this->_doRollback();
} catch (Exception $e) {
throw new Doctrine_Transaction_Exception($e->getMessage());
}
}
return true;
......
......@@ -28,7 +28,8 @@ Doctrine::autoload('Doctrine_Exception');
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @since 1.0
* @version $Revision$
* @link www.phpdoctrine.org
* @link www.phpdoctrine.org
* @todo remove
*/
class Doctrine_Transaction_Exception extends Doctrine_Exception
{ }
\ No newline at end of file
......@@ -28,7 +28,8 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Firebird extends Doctrine_Transaction
{
......
......@@ -26,7 +26,8 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Informix extends Doctrine_Transaction
{ }
\ No newline at end of file
......@@ -30,7 +30,8 @@ Doctrine::autoload('Doctrine_Transaction');
* @subpackage Transaction
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Mock extends Doctrine_Transaction
{ }
\ No newline at end of file
......@@ -28,7 +28,8 @@
* @subpackage Transaction
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Mssql extends Doctrine_Transaction
{
......
......@@ -28,7 +28,8 @@
* @subpackage Transaction
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Mysql extends Doctrine_Transaction
{
......
......@@ -28,7 +28,8 @@
* @subpackage Transaction
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Oracle extends Doctrine_Transaction
{
......
......@@ -29,7 +29,8 @@
* @subpackage Transaction
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Pgsql extends Doctrine_Transaction
{
......
......@@ -28,7 +28,8 @@
* @subpackage Transaction
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
* @version $Revision$
* @todo remove
*/
class Doctrine_Transaction_Sqlite extends Doctrine_Transaction
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment