Commit 79805d69 authored by Kim Hemsø Rasmussen's avatar Kim Hemsø Rasmussen

Merge branch 'master' into drizzle

parents 035b079c 4cb8a99b
...@@ -584,7 +584,7 @@ class Connection implements DriverConnection ...@@ -584,7 +584,7 @@ class Connection implements DriverConnection
* Prepares an SQL statement. * Prepares an SQL statement.
* *
* @param string $statement The SQL statement to prepare. * @param string $statement The SQL statement to prepare.
* @return Doctrine\DBAL\Driver\Statement The prepared statement. * @return \Doctrine\DBAL\Driver\Statement The prepared statement.
*/ */
public function prepare($statement) public function prepare($statement)
{ {
...@@ -603,7 +603,7 @@ class Connection implements DriverConnection ...@@ -603,7 +603,7 @@ class Connection implements DriverConnection
* @param array $params The parameters to bind to the query, if any. * @param array $params The parameters to bind to the query, if any.
* @param array $types The types the previous parameters are in. * @param array $types The types the previous parameters are in.
* @param QueryCacheProfile $qcp * @param QueryCacheProfile $qcp
* @return Doctrine\DBAL\Driver\Statement The executed statement. * @return \Doctrine\DBAL\Driver\Statement The executed statement.
* @internal PERF: Directly prepares a driver statement, not a wrapper. * @internal PERF: Directly prepares a driver statement, not a wrapper.
*/ */
public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null) public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
...@@ -700,7 +700,7 @@ class Connection implements DriverConnection ...@@ -700,7 +700,7 @@ class Connection implements DriverConnection
* *
* @param string $statement * @param string $statement
* @param integer $fetchType * @param integer $fetchType
* @return Doctrine\DBAL\Driver\Statement * @return \Doctrine\DBAL\Driver\Statement
*/ */
public function query() public function query()
{ {
...@@ -1015,7 +1015,7 @@ class Connection implements DriverConnection ...@@ -1015,7 +1015,7 @@ class Connection implements DriverConnection
/** /**
* Gets the wrapped driver connection. * Gets the wrapped driver connection.
* *
* @return Doctrine\DBAL\Driver\Connection * @return \Doctrine\DBAL\Driver\Connection
*/ */
public function getWrappedConnection() public function getWrappedConnection()
{ {
...@@ -1028,7 +1028,7 @@ class Connection implements DriverConnection ...@@ -1028,7 +1028,7 @@ class Connection implements DriverConnection
* Gets the SchemaManager that can be used to inspect or change the * Gets the SchemaManager that can be used to inspect or change the
* database schema through the connection. * database schema through the connection.
* *
* @return Doctrine\DBAL\Schema\AbstractSchemaManager * @return \Doctrine\DBAL\Schema\AbstractSchemaManager
*/ */
public function getSchemaManager() public function getSchemaManager()
{ {
......
...@@ -34,7 +34,7 @@ interface Driver ...@@ -34,7 +34,7 @@ interface Driver
* @param string $username The username to use when connecting. * @param string $username The username to use when connecting.
* @param string $password The password to use when connecting. * @param string $password The password to use when connecting.
* @param array $driverOptions The driver options to use when connecting. * @param array $driverOptions The driver options to use when connecting.
* @return Doctrine\DBAL\Driver\Connection The database connection. * @return \Doctrine\DBAL\Driver\Connection The database connection.
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()); public function connect(array $params, $username = null, $password = null, array $driverOptions = array());
...@@ -42,7 +42,7 @@ interface Driver ...@@ -42,7 +42,7 @@ interface Driver
* Gets the DatabasePlatform instance that provides all the metadata about * Gets the DatabasePlatform instance that provides all the metadata about
* the platform this driver connects to. * the platform this driver connects to.
* *
* @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform. * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
*/ */
public function getDatabasePlatform(); public function getDatabasePlatform();
...@@ -50,8 +50,8 @@ interface Driver ...@@ -50,8 +50,8 @@ interface Driver
* Gets the SchemaManager that can be used to inspect and change the underlying * Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to. * database schema of the platform this driver connects to.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\SchemaManager * @return \Doctrine\DBAL\SchemaManager
*/ */
public function getSchemaManager(Connection $conn); public function getSchemaManager(Connection $conn);
...@@ -65,7 +65,7 @@ interface Driver ...@@ -65,7 +65,7 @@ interface Driver
/** /**
* Get the name of the database connected to for this driver. * Get the name of the database connected to for this driver.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return string $database * @return string $database
*/ */
public function getDatabase(Connection $conn); public function getDatabase(Connection $conn);
......
...@@ -37,7 +37,7 @@ class DB2Driver implements Driver ...@@ -37,7 +37,7 @@ class DB2Driver implements Driver
* @param string $username The username to use when connecting. * @param string $username The username to use when connecting.
* @param string $password The password to use when connecting. * @param string $password The password to use when connecting.
* @param array $driverOptions The driver options to use when connecting. * @param array $driverOptions The driver options to use when connecting.
* @return Doctrine\DBAL\Driver\Connection The database connection. * @return \Doctrine\DBAL\Driver\Connection The database connection.
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
...@@ -65,7 +65,7 @@ class DB2Driver implements Driver ...@@ -65,7 +65,7 @@ class DB2Driver implements Driver
* Gets the DatabasePlatform instance that provides all the metadata about * Gets the DatabasePlatform instance that provides all the metadata about
* the platform this driver connects to. * the platform this driver connects to.
* *
* @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform. * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
*/ */
public function getDatabasePlatform() public function getDatabasePlatform()
{ {
...@@ -76,8 +76,8 @@ class DB2Driver implements Driver ...@@ -76,8 +76,8 @@ class DB2Driver implements Driver
* Gets the SchemaManager that can be used to inspect and change the underlying * Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to. * database schema of the platform this driver connects to.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\SchemaManager * @return \Doctrine\DBAL\SchemaManager
*/ */
public function getSchemaManager(Connection $conn) public function getSchemaManager(Connection $conn)
{ {
...@@ -97,7 +97,7 @@ class DB2Driver implements Driver ...@@ -97,7 +97,7 @@ class DB2Driver implements Driver
/** /**
* Get the name of the database connected to for this driver. * Get the name of the database connected to for this driver.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return string $database * @return string $database
*/ */
public function getDatabase(\Doctrine\DBAL\Connection $conn) public function getDatabase(\Doctrine\DBAL\Connection $conn)
......
...@@ -44,7 +44,7 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -44,7 +44,7 @@ class Driver implements \Doctrine\DBAL\Driver
* @param string $username * @param string $username
* @param string $password * @param string $password
* @param array $driverOptions * @param array $driverOptions
* @return Doctrine\DBAL\Driver\Connection * @return \Doctrine\DBAL\Driver\Connection
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
...@@ -83,7 +83,7 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -83,7 +83,7 @@ class Driver implements \Doctrine\DBAL\Driver
* Gets the DatabasePlatform instance that provides all the metadata about * Gets the DatabasePlatform instance that provides all the metadata about
* the platform this driver connects to. * the platform this driver connects to.
* *
* @return Doctrine\DBAL\Platforms\AbstractPlatform The database platform. * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
*/ */
public function getDatabasePlatform() public function getDatabasePlatform()
{ {
...@@ -94,8 +94,8 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -94,8 +94,8 @@ class Driver implements \Doctrine\DBAL\Driver
* Gets the SchemaManager that can be used to inspect and change the underlying * Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to. * database schema of the platform this driver connects to.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\SchemaManager * @return \Doctrine\DBAL\SchemaManager
*/ */
public function getSchemaManager(Connection $conn) public function getSchemaManager(Connection $conn)
{ {
...@@ -115,7 +115,7 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -115,7 +115,7 @@ class Driver implements \Doctrine\DBAL\Driver
/** /**
* Get the name of the database connected to for this driver. * Get the name of the database connected to for this driver.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return string $database * @return string $database
*/ */
public function getDatabase(\Doctrine\DBAL\Connection $conn) public function getDatabase(\Doctrine\DBAL\Connection $conn)
......
...@@ -35,7 +35,7 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -35,7 +35,7 @@ class Driver implements \Doctrine\DBAL\Driver
* @param string $username * @param string $username
* @param string $password * @param string $password
* @param array $driverOptions * @param array $driverOptions
* @return Doctrine\DBAL\Driver\Connection * @return \Doctrine\DBAL\Driver\Connection
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
......
...@@ -14,7 +14,7 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -14,7 +14,7 @@ class Driver implements \Doctrine\DBAL\Driver
/** /**
* Attempts to connect to the database and returns a driver connection on success. * Attempts to connect to the database and returns a driver connection on success.
* *
* @return Doctrine\DBAL\Driver\Connection * @return \Doctrine\DBAL\Driver\Connection
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
......
...@@ -95,8 +95,8 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -95,8 +95,8 @@ class Driver implements \Doctrine\DBAL\Driver
/** /**
* Gets the schema manager that is relevant for this driver. * Gets the schema manager that is relevant for this driver.
* *
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\Schema\SqliteSchemaManager * @return \Doctrine\DBAL\Schema\SqliteSchemaManager
*/ */
public function getSchemaManager(\Doctrine\DBAL\Connection $conn) public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{ {
......
...@@ -92,9 +92,9 @@ final class DriverManager ...@@ -92,9 +92,9 @@ final class DriverManager
* The driver class to use. * The driver class to use.
* *
* @param array $params The parameters. * @param array $params The parameters.
* @param Doctrine\DBAL\Configuration The configuration to use. * @param \Doctrine\DBAL\Configuration The configuration to use.
* @param Doctrine\Common\EventManager The event manager to use. * @param \Doctrine\Common\EventManager The event manager to use.
* @return Doctrine\DBAL\Connection * @return \Doctrine\DBAL\Connection
*/ */
public static function getConnection( public static function getConnection(
array $params, array $params,
......
...@@ -46,7 +46,7 @@ class ConnectionEventArgs extends EventArgs ...@@ -46,7 +46,7 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @return Doctrine\DBAL\Connection * @return \Doctrine\DBAL\Connection
*/ */
public function getConnection() public function getConnection()
{ {
...@@ -54,7 +54,7 @@ class ConnectionEventArgs extends EventArgs ...@@ -54,7 +54,7 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @return Doctrine\DBAL\Driver * @return \Doctrine\DBAL\Driver
*/ */
public function getDriver() public function getDriver()
{ {
...@@ -62,7 +62,7 @@ class ConnectionEventArgs extends EventArgs ...@@ -62,7 +62,7 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @return Doctrine\DBAL\Platforms\AbstractPlatform * @return \Doctrine\DBAL\Platforms\AbstractPlatform
*/ */
public function getDatabasePlatform() public function getDatabasePlatform()
{ {
...@@ -70,7 +70,7 @@ class ConnectionEventArgs extends EventArgs ...@@ -70,7 +70,7 @@ class ConnectionEventArgs extends EventArgs
} }
/** /**
* @return Doctrine\DBAL\Schema\AbstractSchemaManager * @return \Doctrine\DBAL\Schema\AbstractSchemaManager
*/ */
public function getSchemaManager() public function getSchemaManager()
{ {
......
...@@ -61,7 +61,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs ...@@ -61,7 +61,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
* @param \Doctrine\DBAL\Schema\Table $table * @param \Doctrine\DBAL\Schema\Table $table
* @param array $columns * @param array $columns
* @param array $options * @param array $options
* @param Doctrine\DBAL\Platforms\AbstractPlatform $platform * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*/ */
public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform) public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
{ {
......
...@@ -1095,7 +1095,7 @@ abstract class AbstractPlatform ...@@ -1095,7 +1095,7 @@ abstract class AbstractPlatform
$sql = $this->_getCreateTableSQL($tableName, $columns, $options); $sql = $this->_getCreateTableSQL($tableName, $columns, $options);
if ($this->supportsCommentOnStatement()) { if ($this->supportsCommentOnStatement()) {
foreach ($table->getColumns() AS $column) { foreach ($table->getColumns() AS $column) {
if ($column->getComment()) { if ($this->getColumnComment($column)) {
$sql[] = $this->getCommentOnColumnSQL($tableName, $column->getName(), $this->getColumnComment($column)); $sql[] = $this->getCommentOnColumnSQL($tableName, $column->getName(), $this->getColumnComment($column));
} }
} }
...@@ -1276,7 +1276,8 @@ abstract class AbstractPlatform ...@@ -1276,7 +1276,8 @@ abstract class AbstractPlatform
/** /**
* Quotes a string so that it can be safely used as a table or column name, * Quotes a string so that it can be safely used as a table or column name,
* even if it is a reserved word of the platform. * even if it is a reserved word of the platform. This also detects identifier
* chains seperated by dot and quotes them independently.
* *
* NOTE: Just because you CAN use quoted identifiers doesn't mean * NOTE: Just because you CAN use quoted identifiers doesn't mean
* you SHOULD use them. In general, they end up causing way more * you SHOULD use them. In general, they end up causing way more
...@@ -1286,6 +1287,22 @@ abstract class AbstractPlatform ...@@ -1286,6 +1287,22 @@ abstract class AbstractPlatform
* @return string quoted identifier string * @return string quoted identifier string
*/ */
public function quoteIdentifier($str) public function quoteIdentifier($str)
{
if (strpos($str, ".") !== false) {
$parts = array_map(array($this, "quoteIdentifier"), explode(".", $str));
return implode(".", $parts);
}
return $this->quoteSingleIdentifier($str);
}
/**
* Quote a single identifier (no dot chain seperation)
*
* @param string $str
* @return string
*/
public function quoteSingleIdentifier($str)
{ {
$c = $this->getIdentifierQuoteCharacter(); $c = $this->getIdentifierQuoteCharacter();
...@@ -2601,4 +2618,4 @@ abstract class AbstractPlatform ...@@ -2601,4 +2618,4 @@ abstract class AbstractPlatform
{ {
throw DBALException::notSupported(__METHOD__); throw DBALException::notSupported(__METHOD__);
} }
} }
\ No newline at end of file
...@@ -831,17 +831,9 @@ class MsSqlPlatform extends AbstractPlatform ...@@ -831,17 +831,9 @@ class MsSqlPlatform extends AbstractPlatform
} }
/** /**
* Quotes a string so that it can be safely used as a table or column name, * {@inheritDoc}
* even if it is a reserved word of the platform.
*
* NOTE: Just because you CAN use quoted identifiers doesn't mean
* you SHOULD use them. In general, they end up causing way more
* problems than they solve.
*
* @param string $str identifier name to be quoted
* @return string quoted identifier string
*/ */
public function quoteIdentifier($str) public function quoteSingleIdentifier($str)
{ {
return "[" . str_replace("]", "][", $str) . "]"; return "[" . str_replace("]", "][", $str) . "]";
} }
......
...@@ -99,7 +99,7 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -99,7 +99,7 @@ class Connection extends \Doctrine\DBAL\Connection
* Prepares an SQL statement. * Prepares an SQL statement.
* *
* @param string $statement The SQL statement to prepare. * @param string $statement The SQL statement to prepare.
* @return Doctrine\DBAL\Driver\Statement The prepared statement. * @return \Doctrine\DBAL\Driver\Statement The prepared statement.
*/ */
public function prepare($statement) public function prepare($statement)
{ {
......
...@@ -56,8 +56,8 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement ...@@ -56,8 +56,8 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
/** /**
* Wraps <tt>Statement</tt> and applies portability measures * Wraps <tt>Statement</tt> and applies portability measures
* *
* @param Doctrine\DBAL\Driver\Statement $stmt * @param \Doctrine\DBAL\Driver\Statement $stmt
* @param Doctrine\DBAL\Connection $conn * @param \Doctrine\DBAL\Connection $conn
*/ */
public function __construct($stmt, Connection $conn) public function __construct($stmt, Connection $conn)
{ {
......
...@@ -47,7 +47,7 @@ class ExpressionBuilder ...@@ -47,7 +47,7 @@ class ExpressionBuilder
/** /**
* Initializes a new <tt>ExpressionBuilder</tt>. * Initializes a new <tt>ExpressionBuilder</tt>.
* *
* @param Doctrine\DBAL\Connection $connection DBAL Connection * @param \Doctrine\DBAL\Connection $connection DBAL Connection
*/ */
public function __construct(Connection $connection) public function __construct(Connection $connection)
{ {
......
...@@ -113,7 +113,7 @@ class QueryBuilder ...@@ -113,7 +113,7 @@ class QueryBuilder
/** /**
* Initializes a new <tt>QueryBuilder</tt>. * Initializes a new <tt>QueryBuilder</tt>.
* *
* @param Doctrine\DBAL\Connection $connection DBAL Connection * @param \Doctrine\DBAL\Connection $connection DBAL Connection
*/ */
public function __construct(Connection $connection) public function __construct(Connection $connection)
{ {
...@@ -134,7 +134,7 @@ class QueryBuilder ...@@ -134,7 +134,7 @@ class QueryBuilder
* For more complex expression construction, consider storing the expression * For more complex expression construction, consider storing the expression
* builder object in a local variable. * builder object in a local variable.
* *
* @return Doctrine\DBAL\Query\ExpressionBuilder * @return \Doctrine\DBAL\Query\ExpressionBuilder
*/ */
public function expr() public function expr()
{ {
...@@ -154,7 +154,7 @@ class QueryBuilder ...@@ -154,7 +154,7 @@ class QueryBuilder
/** /**
* Get the associated DBAL Connection for this query builder. * Get the associated DBAL Connection for this query builder.
* *
* @return Doctrine\DBAL\Connection * @return \Doctrine\DBAL\Connection
*/ */
public function getConnection() public function getConnection()
{ {
...@@ -306,7 +306,7 @@ class QueryBuilder ...@@ -306,7 +306,7 @@ class QueryBuilder
* Sets the position of the first result to retrieve (the "offset"). * Sets the position of the first result to retrieve (the "offset").
* *
* @param integer $firstResult The first result to return. * @param integer $firstResult The first result to return.
* @return Doctrine\DBAL\Query\QueryBuilder This QueryBuilder instance. * @return \Doctrine\DBAL\Query\QueryBuilder This QueryBuilder instance.
*/ */
public function setFirstResult($firstResult) public function setFirstResult($firstResult)
{ {
...@@ -330,7 +330,7 @@ class QueryBuilder ...@@ -330,7 +330,7 @@ class QueryBuilder
* Sets the maximum number of results to retrieve (the "limit"). * Sets the maximum number of results to retrieve (the "limit").
* *
* @param integer $maxResults The maximum number of results to retrieve. * @param integer $maxResults The maximum number of results to retrieve.
* @return Doctrine\DBAL\Query\QueryBuilder This QueryBuilder instance. * @return \Doctrine\DBAL\Query\QueryBuilder This QueryBuilder instance.
*/ */
public function setMaxResults($maxResults) public function setMaxResults($maxResults)
{ {
...@@ -359,7 +359,7 @@ class QueryBuilder ...@@ -359,7 +359,7 @@ class QueryBuilder
* @param string $sqlPartName * @param string $sqlPartName
* @param string $sqlPart * @param string $sqlPart
* @param string $append * @param string $append
* @return Doctrine\DBAL\Query\QueryBuilder This QueryBuilder instance. * @return \Doctrine\DBAL\Query\QueryBuilder This QueryBuilder instance.
*/ */
public function add($sqlPartName, $sqlPart, $append = false) public function add($sqlPartName, $sqlPart, $append = false)
{ {
......
...@@ -830,7 +830,7 @@ abstract class AbstractSchemaManager ...@@ -830,7 +830,7 @@ abstract class AbstractSchemaManager
*/ */
public function extractDoctrineTypeFromComment($comment, $currentType) public function extractDoctrineTypeFromComment($comment, $currentType)
{ {
if (preg_match("(\(DC2Type:([a-zA-Z0-9]+)\))", $comment, $match)) { if (preg_match("(\(DC2Type:([a-zA-Z0-9_]+)\))", $comment, $match)) {
$currentType = $match[1]; $currentType = $match[1];
} }
return $currentType; return $currentType;
......
...@@ -102,7 +102,7 @@ class Column extends AbstractAsset ...@@ -102,7 +102,7 @@ class Column extends AbstractAsset
* Create a new Column * Create a new Column
* *
* @param string $columnName * @param string $columnName
* @param Doctrine\DBAL\Types\Type $type * @param \Doctrine\DBAL\Types\Type $type
* @param int $length * @param int $length
* @param bool $notNull * @param bool $notNull
* @param mixed $default * @param mixed $default
......
...@@ -156,7 +156,7 @@ class Schema extends AbstractAsset ...@@ -156,7 +156,7 @@ class Schema extends AbstractAsset
/** /**
* @throws SchemaException * @throws SchemaException
* @param string $sequenceName * @param string $sequenceName
* @return Doctrine\DBAL\Schema\Sequence * @return \Doctrine\DBAL\Schema\Sequence
*/ */
public function getSequence($sequenceName) public function getSequence($sequenceName)
{ {
...@@ -168,7 +168,7 @@ class Schema extends AbstractAsset ...@@ -168,7 +168,7 @@ class Schema extends AbstractAsset
} }
/** /**
* @return Doctrine\DBAL\Schema\Sequence[] * @return \Doctrine\DBAL\Schema\Sequence[]
*/ */
public function getSequences() public function getSequences()
{ {
......
...@@ -59,7 +59,7 @@ class Statement implements \IteratorAggregate, DriverStatement ...@@ -59,7 +59,7 @@ class Statement implements \IteratorAggregate, DriverStatement
* Creates a new <tt>Statement</tt> for the given SQL and <tt>Connection</tt>. * Creates a new <tt>Statement</tt> for the given SQL and <tt>Connection</tt>.
* *
* @param string $sql The SQL of the statement. * @param string $sql The SQL of the statement.
* @param Doctrine\DBAL\Connection The connection on which the statement should be executed. * @param \Doctrine\DBAL\Connection The connection on which the statement should be executed.
*/ */
public function __construct($sql, Connection $conn) public function __construct($sql, Connection $conn)
{ {
...@@ -238,7 +238,7 @@ class Statement implements \IteratorAggregate, DriverStatement ...@@ -238,7 +238,7 @@ class Statement implements \IteratorAggregate, DriverStatement
/** /**
* Gets the wrapped driver statement. * Gets the wrapped driver statement.
* *
* @return Doctrine\DBAL\Driver\Statement * @return \Doctrine\DBAL\Driver\Statement
*/ */
public function getWrappedStatement() public function getWrappedStatement()
{ {
......
...@@ -133,7 +133,7 @@ abstract class Type ...@@ -133,7 +133,7 @@ abstract class Type
* @static * @static
* @throws DBALException * @throws DBALException
* @param string $name The name of the type (as returned by getName()). * @param string $name The name of the type (as returned by getName()).
* @return Doctrine\DBAL\Types\Type * @return \Doctrine\DBAL\Types\Type
*/ */
public static function getType($name) public static function getType($name)
{ {
...@@ -189,6 +189,10 @@ abstract class Type ...@@ -189,6 +189,10 @@ abstract class Type
if ( ! isset(self::$_typesMap[$name])) { if ( ! isset(self::$_typesMap[$name])) {
throw DBALException::typeNotFound($name); throw DBALException::typeNotFound($name);
} }
if (isset(self::$_typeObjects[$name])) {
unset(self::$_typeObjects[$name]);
}
self::$_typesMap[$name] = $className; self::$_typesMap[$name] = $className;
} }
......
...@@ -19,6 +19,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -19,6 +19,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->_platform = $this->createPlatform(); $this->_platform = $this->createPlatform();
} }
/**
* @group DDC-1360
*/
public function testQuoteIdentifier() public function testQuoteIdentifier()
{ {
if ($this->_platform->getName() == "mssql") { if ($this->_platform->getName() == "mssql") {
...@@ -26,9 +29,26 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -26,9 +29,26 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
} }
$c = $this->_platform->getIdentifierQuoteCharacter(); $c = $this->_platform->getIdentifierQuoteCharacter();
$this->assertEquals($c."test".$c, $this->_platform->quoteIdentifier("test"));
$this->assertEquals($c."test".$c.".".$c."test".$c, $this->_platform->quoteIdentifier("test.test"));
$this->assertEquals(str_repeat($c, 4), $this->_platform->quoteIdentifier($c)); $this->assertEquals(str_repeat($c, 4), $this->_platform->quoteIdentifier($c));
} }
/**
* @group DDC-1360
*/
public function testQuoteSingleIdentifier()
{
if ($this->_platform->getName() == "mssql") {
$this->markTestSkipped('Not working this way on mssql.');
}
$c = $this->_platform->getIdentifierQuoteCharacter();
$this->assertEquals($c."test".$c, $this->_platform->quoteSingleIdentifier("test"));
$this->assertEquals($c."test.test".$c, $this->_platform->quoteSingleIdentifier("test.test"));
$this->assertEquals(str_repeat($c, 4), $this->_platform->quoteSingleIdentifier($c));
}
public function testGetInvalidtForeignKeyReferentialActionSQL() public function testGetInvalidtForeignKeyReferentialActionSQL()
{ {
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
...@@ -326,6 +346,16 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -326,6 +346,16 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff)); $this->assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff));
} }
public function testCreateTableColumnTypeComments()
{
$table = new \Doctrine\DBAL\Schema\Table('test');
$table->addColumn('id', 'integer');
$table->addColumn('data', 'array');
$table->setPrimaryKey(array('id'));
$this->assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->_platform->getCreateTableSQL($table));
}
public function getCreateTableColumnCommentsSQL() public function getCreateTableColumnCommentsSQL()
{ {
$this->markTestSkipped('Platform does not support Column comments.'); $this->markTestSkipped('Platform does not support Column comments.');
...@@ -336,6 +366,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -336,6 +366,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->markTestSkipped('Platform does not support Column comments.'); $this->markTestSkipped('Platform does not support Column comments.');
} }
public function getCreateTableColumnTypeCommentsSQL()
{
$this->markTestSkipped('Platform does not support Column comments.');
}
/** /**
* @group DBAL-45 * @group DBAL-45
*/ */
......
...@@ -171,8 +171,23 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase ...@@ -171,8 +171,23 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
$this->assertEquals('SELECT TOP 10 * FROM user ORDER BY username DESC', $sql); $this->assertEquals('SELECT TOP 10 * FROM user ORDER BY username DESC', $sql);
} }
/**
* @group DDC-1360
*/
public function testQuoteIdentifier() public function testQuoteIdentifier()
{ {
$this->assertEquals('[fo][o]', $this->_platform->quoteIdentifier('fo]o')); $this->assertEquals('[fo][o]', $this->_platform->quoteIdentifier('fo]o'));
$this->assertEquals('[test]', $this->_platform->quoteIdentifier('test'));
$this->assertEquals('[test].[test]', $this->_platform->quoteIdentifier('test.test'));
} }
}
\ No newline at end of file /**
* @group DDC-1360
*/
public function testQuoteSingleIdentifier()
{
$this->assertEquals('[fo][o]', $this->_platform->quoteSingleIdentifier('fo]o'));
$this->assertEquals('[test]', $this->_platform->quoteSingleIdentifier('test'));
$this->assertEquals('[test.test]', $this->_platform->quoteSingleIdentifier('test.test'));
}
}
...@@ -204,4 +204,9 @@ class MySqlPlatformTest extends AbstractPlatformTestCase ...@@ -204,4 +204,9 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
{ {
return array("ALTER TABLE mytable ADD quota INT NOT NULL COMMENT 'A comment', CHANGE bar baz VARCHAR(255) NOT NULL COMMENT 'B comment'"); return array("ALTER TABLE mytable ADD quota INT NOT NULL COMMENT 'A comment', CHANGE bar baz VARCHAR(255) NOT NULL COMMENT 'B comment'");
} }
public function getCreateTableColumnTypeCommentsSQL()
{
return array("CREATE TABLE test (id INT NOT NULL, data LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) ENGINE = InnoDB");
}
} }
\ No newline at end of file
...@@ -195,6 +195,14 @@ class OraclePlatformTest extends AbstractPlatformTestCase ...@@ -195,6 +195,14 @@ class OraclePlatformTest extends AbstractPlatformTestCase
); );
} }
public function getCreateTableColumnTypeCommentsSQL()
{
return array(
"CREATE TABLE test (id NUMBER(10) NOT NULL, data CLOB NOT NULL, PRIMARY KEY(id))",
"COMMENT ON COLUMN test.data IS '(DC2Type:array)'"
);
}
public function getAlterTableColumnCommentsSQL() public function getAlterTableColumnCommentsSQL()
{ {
return array( return array(
......
...@@ -216,4 +216,12 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase ...@@ -216,4 +216,12 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
"COMMENT ON COLUMN mytable.baz IS 'B comment'", "COMMENT ON COLUMN mytable.baz IS 'B comment'",
); );
} }
public function getCreateTableColumnTypeCommentsSQL()
{
return array(
"CREATE TABLE test (id INT NOT NULL, data TEXT NOT NULL, PRIMARY KEY(id))",
"COMMENT ON COLUMN test.data IS '(DC2Type:array)'"
);
}
} }
\ No newline at end of file
...@@ -28,7 +28,7 @@ class TestUtil ...@@ -28,7 +28,7 @@ class TestUtil
* 1) Each invocation of this method returns a NEW database connection. * 1) Each invocation of this method returns a NEW database connection.
* 2) The database is dropped and recreated to ensure it's clean. * 2) The database is dropped and recreated to ensure it's clean.
* *
* @return Doctrine\DBAL\Connection The database connection instance. * @return \Doctrine\DBAL\Connection The database connection instance.
*/ */
public static function getConnection() public static function getConnection()
{ {
......
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