Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
79805d69
Commit
79805d69
authored
Jan 02, 2012
by
Kim Hemsø Rasmussen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into drizzle
parents
035b079c
4cb8a99b
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
148 additions
and
64 deletions
+148
-64
Connection.php
lib/Doctrine/DBAL/Connection.php
+5
-5
Driver.php
lib/Doctrine/DBAL/Driver.php
+5
-5
DB2Driver.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
+5
-5
Driver.php
lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
+5
-5
Driver.php
lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
+1
-1
Driver.php
lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
+1
-1
Driver.php
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
+2
-2
DriverManager.php
lib/Doctrine/DBAL/DriverManager.php
+3
-3
ConnectionEventArgs.php
lib/Doctrine/DBAL/Event/ConnectionEventArgs.php
+4
-4
SchemaCreateTableEventArgs.php
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
+1
-1
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+20
-3
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+2
-10
Connection.php
lib/Doctrine/DBAL/Portability/Connection.php
+1
-1
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+2
-2
ExpressionBuilder.php
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
+1
-1
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+6
-6
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+1
-1
Column.php
lib/Doctrine/DBAL/Schema/Column.php
+1
-1
Schema.php
lib/Doctrine/DBAL/Schema/Schema.php
+2
-2
Statement.php
lib/Doctrine/DBAL/Statement.php
+2
-2
Type.php
lib/Doctrine/DBAL/Types/Type.php
+5
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+35
-0
MsSqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
+16
-1
MySqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+5
-0
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+8
-0
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+8
-0
TestUtil.php
tests/Doctrine/Tests/TestUtil.php
+1
-1
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
79805d69
...
...
@@ -584,7 +584,7 @@ class Connection implements DriverConnection
* Prepares an SQL statement.
*
* @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
)
{
...
...
@@ -603,7 +603,7 @@ class Connection implements DriverConnection
* @param array $params The parameters to bind to the query, if any.
* @param array $types The types the previous parameters are in.
* @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.
*/
public
function
executeQuery
(
$query
,
array
$params
=
array
(),
$types
=
array
(),
QueryCacheProfile
$qcp
=
null
)
...
...
@@ -700,7 +700,7 @@ class Connection implements DriverConnection
*
* @param string $statement
* @param integer $fetchType
* @return Doctrine\DBAL\Driver\Statement
* @return
\
Doctrine\DBAL\Driver\Statement
*/
public
function
query
()
{
...
...
@@ -1015,7 +1015,7 @@ class Connection implements DriverConnection
/**
* Gets the wrapped driver connection.
*
* @return Doctrine\DBAL\Driver\Connection
* @return
\
Doctrine\DBAL\Driver\Connection
*/
public
function
getWrappedConnection
()
{
...
...
@@ -1028,7 +1028,7 @@ class Connection implements DriverConnection
* Gets the SchemaManager that can be used to inspect or change the
* database schema through the connection.
*
* @return Doctrine\DBAL\Schema\AbstractSchemaManager
* @return
\
Doctrine\DBAL\Schema\AbstractSchemaManager
*/
public
function
getSchemaManager
()
{
...
...
lib/Doctrine/DBAL/Driver.php
View file @
79805d69
...
...
@@ -34,7 +34,7 @@ interface Driver
* @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\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
());
...
...
@@ -42,7 +42,7 @@ interface Driver
* Gets the DatabasePlatform instance that provides all the metadata about
* 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
();
...
...
@@ -50,8 +50,8 @@ interface Driver
* Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to.
*
* @param Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\SchemaManager
* @param
\
Doctrine\DBAL\Connection $conn
* @return
\
Doctrine\DBAL\SchemaManager
*/
public
function
getSchemaManager
(
Connection
$conn
);
...
...
@@ -65,7 +65,7 @@ interface 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
*/
public
function
getDatabase
(
Connection
$conn
);
...
...
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
View file @
79805d69
...
...
@@ -37,7 +37,7 @@ class DB2Driver implements Driver
* @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\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
())
{
...
...
@@ -65,7 +65,7 @@ class DB2Driver implements Driver
* Gets the DatabasePlatform instance that provides all the metadata about
* 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
()
{
...
...
@@ -76,8 +76,8 @@ class DB2Driver implements Driver
* Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to.
*
* @param Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\SchemaManager
* @param
\
Doctrine\DBAL\Connection $conn
* @return
\
Doctrine\DBAL\SchemaManager
*/
public
function
getSchemaManager
(
Connection
$conn
)
{
...
...
@@ -97,7 +97,7 @@ class DB2Driver implements 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
*/
public
function
getDatabase
(
\Doctrine\DBAL\Connection
$conn
)
...
...
lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
View file @
79805d69
...
...
@@ -44,7 +44,7 @@ class Driver implements \Doctrine\DBAL\Driver
* @param string $username
* @param string $password
* @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
())
{
...
...
@@ -83,7 +83,7 @@ class Driver implements \Doctrine\DBAL\Driver
* Gets the DatabasePlatform instance that provides all the metadata about
* 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
()
{
...
...
@@ -94,8 +94,8 @@ class Driver implements \Doctrine\DBAL\Driver
* Gets the SchemaManager that can be used to inspect and change the underlying
* database schema of the platform this driver connects to.
*
* @param Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\SchemaManager
* @param
\
Doctrine\DBAL\Connection $conn
* @return
\
Doctrine\DBAL\SchemaManager
*/
public
function
getSchemaManager
(
Connection
$conn
)
{
...
...
@@ -115,7 +115,7 @@ class Driver implements \Doctrine\DBAL\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
*/
public
function
getDatabase
(
\Doctrine\DBAL\Connection
$conn
)
...
...
lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
View file @
79805d69
...
...
@@ -35,7 +35,7 @@ class Driver implements \Doctrine\DBAL\Driver
* @param string $username
* @param string $password
* @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
())
{
...
...
lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
View file @
79805d69
...
...
@@ -14,7 +14,7 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* 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
())
{
...
...
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
View file @
79805d69
...
...
@@ -95,8 +95,8 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* Gets the schema manager that is relevant for this driver.
*
* @param Doctrine\DBAL\Connection $conn
* @return Doctrine\DBAL\Schema\SqliteSchemaManager
* @param
\
Doctrine\DBAL\Connection $conn
* @return
\
Doctrine\DBAL\Schema\SqliteSchemaManager
*/
public
function
getSchemaManager
(
\Doctrine\DBAL\Connection
$conn
)
{
...
...
lib/Doctrine/DBAL/DriverManager.php
View file @
79805d69
...
...
@@ -92,9 +92,9 @@ final class DriverManager
* The driver class to use.
*
* @param array $params The parameters.
* @param Doctrine\DBAL\Configuration The configuration to use.
* @param Doctrine\Common\EventManager The event manager to use.
* @return Doctrine\DBAL\Connection
* @param
\
Doctrine\DBAL\Configuration The configuration to use.
* @param
\
Doctrine\Common\EventManager The event manager to use.
* @return
\
Doctrine\DBAL\Connection
*/
public
static
function
getConnection
(
array
$params
,
...
...
lib/Doctrine/DBAL/Event/ConnectionEventArgs.php
View file @
79805d69
...
...
@@ -46,7 +46,7 @@ class ConnectionEventArgs extends EventArgs
}
/**
* @return Doctrine\DBAL\Connection
* @return
\
Doctrine\DBAL\Connection
*/
public
function
getConnection
()
{
...
...
@@ -54,7 +54,7 @@ class ConnectionEventArgs extends EventArgs
}
/**
* @return Doctrine\DBAL\Driver
* @return
\
Doctrine\DBAL\Driver
*/
public
function
getDriver
()
{
...
...
@@ -62,7 +62,7 @@ class ConnectionEventArgs extends EventArgs
}
/**
* @return Doctrine\DBAL\Platforms\AbstractPlatform
* @return
\
Doctrine\DBAL\Platforms\AbstractPlatform
*/
public
function
getDatabasePlatform
()
{
...
...
@@ -70,7 +70,7 @@ class ConnectionEventArgs extends EventArgs
}
/**
* @return Doctrine\DBAL\Schema\AbstractSchemaManager
* @return
\
Doctrine\DBAL\Schema\AbstractSchemaManager
*/
public
function
getSchemaManager
()
{
...
...
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
View file @
79805d69
...
...
@@ -61,7 +61,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
* @param \Doctrine\DBAL\Schema\Table $table
* @param array $columns
* @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
)
{
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
79805d69
...
...
@@ -1095,7 +1095,7 @@ abstract class AbstractPlatform
$sql
=
$this
->
_getCreateTableSQL
(
$tableName
,
$columns
,
$options
);
if
(
$this
->
supportsCommentOnStatement
())
{
foreach
(
$table
->
getColumns
()
AS
$column
)
{
if
(
$
column
->
getComment
(
))
{
if
(
$
this
->
getColumnComment
(
$column
))
{
$sql
[]
=
$this
->
getCommentOnColumnSQL
(
$tableName
,
$column
->
getName
(),
$this
->
getColumnComment
(
$column
));
}
}
...
...
@@ -1276,7 +1276,8 @@ abstract class AbstractPlatform
/**
* 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
* you SHOULD use them. In general, they end up causing way more
...
...
@@ -1286,6 +1287,22 @@ abstract class AbstractPlatform
* @return string quoted identifier string
*/
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
();
...
...
@@ -2601,4 +2618,4 @@ abstract class AbstractPlatform
{
throw
DBALException
::
notSupported
(
__METHOD__
);
}
}
\ No newline at end of file
}
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
79805d69
...
...
@@ -831,17 +831,9 @@ class MsSqlPlatform extends AbstractPlatform
}
/**
* 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.
*
* 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
* {@inheritDoc}
*/
public
function
quoteIdentifier
(
$str
)
public
function
quote
Single
Identifier
(
$str
)
{
return
"["
.
str_replace
(
"]"
,
"]["
,
$str
)
.
"]"
;
}
...
...
lib/Doctrine/DBAL/Portability/Connection.php
View file @
79805d69
...
...
@@ -99,7 +99,7 @@ class Connection extends \Doctrine\DBAL\Connection
* Prepares an SQL statement.
*
* @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
)
{
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
79805d69
...
...
@@ -56,8 +56,8 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
/**
* Wraps <tt>Statement</tt> and applies portability measures
*
* @param Doctrine\DBAL\Driver\Statement $stmt
* @param Doctrine\DBAL\Connection $conn
* @param
\
Doctrine\DBAL\Driver\Statement $stmt
* @param
\
Doctrine\DBAL\Connection $conn
*/
public
function
__construct
(
$stmt
,
Connection
$conn
)
{
...
...
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
View file @
79805d69
...
...
@@ -47,7 +47,7 @@ class ExpressionBuilder
/**
* 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
)
{
...
...
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
79805d69
...
...
@@ -113,7 +113,7 @@ class QueryBuilder
/**
* 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
)
{
...
...
@@ -134,7 +134,7 @@ class QueryBuilder
* For more complex expression construction, consider storing the expression
* builder object in a local variable.
*
* @return Doctrine\DBAL\Query\ExpressionBuilder
* @return
\
Doctrine\DBAL\Query\ExpressionBuilder
*/
public
function
expr
()
{
...
...
@@ -154,7 +154,7 @@ class QueryBuilder
/**
* Get the associated DBAL Connection for this query builder.
*
* @return Doctrine\DBAL\Connection
* @return
\
Doctrine\DBAL\Connection
*/
public
function
getConnection
()
{
...
...
@@ -306,7 +306,7 @@ class QueryBuilder
* Sets the position of the first result to retrieve (the "offset").
*
* @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
)
{
...
...
@@ -330,7 +330,7 @@ class QueryBuilder
* Sets the maximum number of results to retrieve (the "limit").
*
* @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
)
{
...
...
@@ -359,7 +359,7 @@ class QueryBuilder
* @param string $sqlPartName
* @param string $sqlPart
* @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
)
{
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
79805d69
...
...
@@ -830,7 +830,7 @@ abstract class AbstractSchemaManager
*/
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
];
}
return
$currentType
;
...
...
lib/Doctrine/DBAL/Schema/Column.php
View file @
79805d69
...
...
@@ -102,7 +102,7 @@ class Column extends AbstractAsset
* Create a new Column
*
* @param string $columnName
* @param Doctrine\DBAL\Types\Type $type
* @param
\
Doctrine\DBAL\Types\Type $type
* @param int $length
* @param bool $notNull
* @param mixed $default
...
...
lib/Doctrine/DBAL/Schema/Schema.php
View file @
79805d69
...
...
@@ -156,7 +156,7 @@ class Schema extends AbstractAsset
/**
* @throws SchemaException
* @param string $sequenceName
* @return Doctrine\DBAL\Schema\Sequence
* @return
\
Doctrine\DBAL\Schema\Sequence
*/
public
function
getSequence
(
$sequenceName
)
{
...
...
@@ -168,7 +168,7 @@ class Schema extends AbstractAsset
}
/**
* @return Doctrine\DBAL\Schema\Sequence[]
* @return
\
Doctrine\DBAL\Schema\Sequence[]
*/
public
function
getSequences
()
{
...
...
lib/Doctrine/DBAL/Statement.php
View file @
79805d69
...
...
@@ -59,7 +59,7 @@ class Statement implements \IteratorAggregate, DriverStatement
* Creates a new <tt>Statement</tt> for the given SQL and <tt>Connection</tt>.
*
* @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
)
{
...
...
@@ -238,7 +238,7 @@ class Statement implements \IteratorAggregate, DriverStatement
/**
* Gets the wrapped driver statement.
*
* @return Doctrine\DBAL\Driver\Statement
* @return
\
Doctrine\DBAL\Driver\Statement
*/
public
function
getWrappedStatement
()
{
...
...
lib/Doctrine/DBAL/Types/Type.php
View file @
79805d69
...
...
@@ -133,7 +133,7 @@ abstract class Type
* @static
* @throws DBALException
* @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
)
{
...
...
@@ -189,6 +189,10 @@ abstract class Type
if
(
!
isset
(
self
::
$_typesMap
[
$name
]))
{
throw
DBALException
::
typeNotFound
(
$name
);
}
if
(
isset
(
self
::
$_typeObjects
[
$name
]))
{
unset
(
self
::
$_typeObjects
[
$name
]);
}
self
::
$_typesMap
[
$name
]
=
$className
;
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
79805d69
...
...
@@ -19,6 +19,9 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
_platform
=
$this
->
createPlatform
();
}
/**
* @group DDC-1360
*/
public
function
testQuoteIdentifier
()
{
if
(
$this
->
_platform
->
getName
()
==
"mssql"
)
{
...
...
@@ -26,9 +29,26 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
}
$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
));
}
/**
* @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
()
{
$this
->
setExpectedException
(
'InvalidArgumentException'
);
...
...
@@ -326,6 +346,16 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$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
()
{
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
...
...
@@ -336,6 +366,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
}
public
function
getCreateTableColumnTypeCommentsSQL
()
{
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
}
/**
* @group DBAL-45
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
View file @
79805d69
...
...
@@ -171,8 +171,23 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
$this
->
assertEquals
(
'SELECT TOP 10 * FROM user ORDER BY username DESC'
,
$sql
);
}
/**
* @group DDC-1360
*/
public
function
testQuoteIdentifier
()
{
$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'
));
}
}
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
View file @
79805d69
...
...
@@ -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'"
);
}
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
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
79805d69
...
...
@@ -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
()
{
return
array
(
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
79805d69
...
...
@@ -216,4 +216,12 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
"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
tests/Doctrine/Tests/TestUtil.php
View file @
79805d69
...
...
@@ -28,7 +28,7 @@ class TestUtil
* 1) Each invocation of this method returns a NEW database connection.
* 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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment