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
b066e54f
Commit
b066e54f
authored
Dec 19, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all trailing whitespaces
parent
2e02241c
Changes
82
Hide whitespace changes
Inline
Side-by-side
Showing
82 changed files
with
328 additions
and
329 deletions
+328
-329
QueryCacheProfile.php
lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
+1
-1
ResultCacheStatement.php
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
+2
-2
Configuration.php
lib/Doctrine/DBAL/Configuration.php
+2
-2
ConnectionException.php
lib/Doctrine/DBAL/ConnectionException.php
+1
-1
Connection.php
lib/Doctrine/DBAL/Driver/Connection.php
+1
-1
DB2Driver.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
+1
-1
DB2Exception.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php
+1
-1
MysqliStatement.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+1
-1
OCI8Connection.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
+6
-6
Driver.php
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
+1
-1
Connection.php
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
+2
-2
Driver.php
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
+5
-5
Statement.php
lib/Doctrine/DBAL/Driver/Statement.php
+7
-7
SchemaAlterTableChangeColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
+1
-1
SchemaCreateTableEventArgs.php
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
+1
-1
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+1
-1
DB2Keywords.php
lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
+2
-3
KeywordList.php
lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php
+8
-8
MsSQLKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php
+1
-1
MySQLKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
+1
-1
OracleKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
+1
-1
PostgreSQLKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
+1
-1
ReservedKeywordsValidator.php
...ine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
+11
-11
SQLiteKeywords.php
lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
+1
-1
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+2
-2
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+1
-1
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+2
-2
Connection.php
lib/Doctrine/DBAL/Portability/Connection.php
+11
-11
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+1
-1
CompositeExpression.php
lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php
+22
-22
ExpressionBuilder.php
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
+10
-10
SQLParserUtils.php
lib/Doctrine/DBAL/SQLParserUtils.php
+22
-22
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+5
-5
Column.php
lib/Doctrine/DBAL/Schema/Column.php
+1
-1
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+3
-3
DB2SchemaManager.php
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
+2
-2
Index.php
lib/Doctrine/DBAL/Schema/Index.php
+2
-2
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+1
-1
Schema.php
lib/Doctrine/DBAL/Schema/Schema.php
+6
-6
Sequence.php
lib/Doctrine/DBAL/Schema/Sequence.php
+1
-1
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+2
-2
CreateSchemaSqlCollector.php
...Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php
+2
-2
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+12
-12
BooleanType.php
lib/Doctrine/DBAL/Types/BooleanType.php
+1
-1
ConversionException.php
lib/Doctrine/DBAL/Types/ConversionException.php
+3
-3
DateTimeType.php
lib/Doctrine/DBAL/Types/DateTimeType.php
+1
-1
DateTimeTzType.php
lib/Doctrine/DBAL/Types/DateTimeTzType.php
+1
-1
DateType.php
lib/Doctrine/DBAL/Types/DateType.php
+2
-2
TimeType.php
lib/Doctrine/DBAL/Types/TimeType.php
+1
-1
Version.php
lib/Doctrine/DBAL/Version.php
+2
-2
ConnectionTest.php
tests/Doctrine/Tests/DBAL/ConnectionTest.php
+1
-1
OCI8StatementTest.php
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
+4
-4
DriverManagerTest.php
tests/Doctrine/Tests/DBAL/DriverManagerTest.php
+1
-1
ConnectionTest.php
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
+4
-4
ResultCacheTest.php
tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
+1
-1
MsSqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MsSqlSchemaManagerTest.php
+2
-2
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+2
-2
OracleSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
+1
-1
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+1
-1
TemporaryTableTest.php
tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
+1
-1
TypeConversionTest.php
tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
+1
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+3
-3
MySqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+8
-8
OraclePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+6
-6
PostgreSqlPlatformTest.php
.../Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+1
-1
ReservedKeywordsValidatorTest.php
...ne/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php
+6
-6
SqlitePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
+5
-5
CompositeExpressionTest.php
...e/Tests/DBAL/Query/Expression/CompositeExpressionTest.php
+20
-20
ExpressionBuilderTest.php
...ine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
+38
-38
SQLParserUtilsTest.php
tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
+8
-8
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+10
-10
ArrayTest.php
tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
+1
-1
BooleanTest.php
tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
+1
-1
DateTest.php
tests/Doctrine/Tests/DBAL/Types/DateTest.php
+2
-2
DecimalTest.php
tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
+1
-1
ObjectTest.php
tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
+1
-1
SmallIntTest.php
tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
+1
-1
StringTest.php
tests/Doctrine/Tests/DBAL/Types/StringTest.php
+1
-1
TimeTest.php
tests/Doctrine/Tests/DBAL/Types/TimeTest.php
+1
-1
DriverMock.php
tests/Doctrine/Tests/Mocks/DriverMock.php
+1
-1
HydratorMockStatement.php
tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
+14
-14
SchemaManagerMock.php
tests/Doctrine/Tests/Mocks/SchemaManagerMock.php
+1
-1
No files found.
lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
View file @
b066e54f
...
...
@@ -84,7 +84,7 @@ class QueryCacheProfile
/**
* Generate the real cache key from query, params and types.
*
*
* @param string $query
* @param array $params
* @param array $types
...
...
lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
View file @
b066e54f
...
...
@@ -68,7 +68,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
/**
* Did we reach the end of the statement?
*
*
* @var bool
*/
private
$emptied
=
false
;
...
...
@@ -179,7 +179,7 @@ class ResultCacheStatement implements \IteratorAggregate, ResultStatement
$row
=
$this
->
statement
->
fetch
(
PDO
::
FETCH_ASSOC
);
if
(
$row
)
{
$this
->
data
[]
=
$row
;
if
(
$fetchStyle
==
PDO
::
FETCH_ASSOC
)
{
return
$row
;
}
else
if
(
$fetchStyle
==
PDO
::
FETCH_NUM
)
{
...
...
lib/Doctrine/DBAL/Configuration.php
View file @
b066e54f
<?php
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...
...
@@ -54,7 +54,7 @@ class Configuration
/**
* Gets the SQL logger that is used.
*
*
* @return SQLLogger
*/
public
function
getSQLLogger
()
...
...
lib/Doctrine/DBAL/ConnectionException.php
View file @
b066e54f
...
...
@@ -36,7 +36,7 @@ class ConnectionException extends DBALException
{
return
new
self
(
"Transaction commit failed because the transaction has been marked for rollback only."
);
}
public
static
function
noActiveTransaction
()
{
return
new
self
(
"There is no active transaction."
);
...
...
lib/Doctrine/DBAL/Driver/Connection.php
View file @
b066e54f
...
...
@@ -24,7 +24,7 @@ namespace Doctrine\DBAL\Driver;
* Driver connections must implement this interface.
*
* This resembles (a subset of) the PDO interface.
*
*
* @since 2.0
*/
interface
Connection
...
...
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
View file @
b066e54f
...
...
@@ -42,7 +42,7 @@ class DB2Driver implements Driver
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
{
if
(
!
isset
(
$params
[
'schema'
])
)
{
}
if
(
$params
[
'host'
]
!==
'localhost'
&&
$params
[
'host'
]
!=
'127.0.0.1'
)
{
...
...
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php
View file @
b066e54f
...
...
@@ -23,5 +23,5 @@ namespace Doctrine\DBAL\Driver\IBMDB2;
class
DB2Exception
extends
\Exception
{
}
\ No newline at end of file
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
b066e54f
...
...
@@ -179,7 +179,7 @@ class MysqliStatement implements \IteratorAggregate, Statement
/**
* Bind a array of values to bound parameters
*
*
* @param array $values
* @return boolean
*/
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
View file @
b066e54f
...
...
@@ -32,7 +32,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
/**
* Create a Connection to an Oracle Database using oci8 extension.
*
*
* @param string $username
* @param string $password
* @param string $db
...
...
@@ -51,7 +51,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
/**
* Create a non-executed prepared statement.
*
*
* @param string $prepareString
* @return OCI8Statement
*/
...
...
@@ -78,7 +78,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
* Quote input value.
*
* @param mixed $input
* @param int $type PDO::PARAM*
* @param int $type PDO::PARAM*
* @return mixed
*/
public
function
quote
(
$value
,
$type
=
\PDO
::
PARAM_STR
)
...
...
@@ -101,7 +101,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
$stmt
->
execute
();
return
$stmt
->
rowCount
();
}
public
function
lastInsertId
(
$name
=
null
)
{
//TODO: throw exception or support sequences?
...
...
@@ -147,7 +147,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
$this
->
_executeMode
=
OCI_COMMIT_ON_SUCCESS
;
return
true
;
}
public
function
errorCode
()
{
$error
=
oci_error
(
$this
->
_dbh
);
...
...
@@ -156,7 +156,7 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
}
return
$error
;
}
public
function
errorInfo
()
{
return
oci_error
(
$this
->
_dbh
);
...
...
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
View file @
b066e54f
...
...
@@ -80,7 +80,7 @@ class Driver implements \Doctrine\DBAL\Driver
}
else
if
(
isset
(
$params
[
'memory'
]))
{
$dsn
.=
':memory:'
;
}
return
$dsn
;
}
...
...
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
View file @
b066e54f
...
...
@@ -34,12 +34,12 @@ class Connection extends \Doctrine\DBAL\Driver\PDOConnection implements \Doctrin
public
function
quote
(
$value
,
$type
=
\PDO
::
PARAM_STR
)
{
$val
=
parent
::
quote
(
$value
,
$type
);
// Fix for a driver version terminating all values with null byte
if
(
strpos
(
$val
,
"
\0
"
)
!==
false
)
{
$val
=
substr
(
$val
,
0
,
-
1
);
}
return
$val
;
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
View file @
b066e54f
...
...
@@ -29,7 +29,7 @@ namespace Doctrine\DBAL\Driver\PDOSqlsrv;
class
Driver
implements
\Doctrine\DBAL\Driver
{
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
{
{
return
new
Connection
(
$this
->
_constructPdoDsn
(
$params
),
$username
,
...
...
@@ -46,19 +46,19 @@ class Driver implements \Doctrine\DBAL\Driver
private
function
_constructPdoDsn
(
array
$params
)
{
$dsn
=
'sqlsrv:server='
;
if
(
isset
(
$params
[
'host'
]))
{
$dsn
.=
$params
[
'host'
];
}
if
(
isset
(
$params
[
'port'
])
&&
!
empty
(
$params
[
'port'
]))
{
$dsn
.=
','
.
$params
[
'port'
];
}
if
(
isset
(
$params
[
'dbname'
]))
{
$dsn
.=
';Database='
.
$params
[
'dbname'
];
}
return
$dsn
;
}
...
...
lib/Doctrine/DBAL/Driver/Statement.php
View file @
b066e54f
...
...
@@ -24,9 +24,9 @@ use \PDO;
/**
* Statement interface.
* Drivers must implement this interface.
*
*
* This resembles (a subset of) the PDOStatement interface.
*
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
...
...
@@ -51,13 +51,13 @@ interface Statement extends ResultStatement
function
bindValue
(
$param
,
$value
,
$type
=
null
);
/**
* Binds a PHP variable to a corresponding named or question mark placeholder in the
* Binds a PHP variable to a corresponding named or question mark placeholder in the
* SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(),
* the variable is bound as a reference and will only be evaluated at the time
* the variable is bound as a reference and will only be evaluated at the time
* that PDOStatement->execute() is called.
*
* Most parameters are input parameters, that is, parameters that are
* used in a read-only fashion to build up the query. Some drivers support the invocation
* Most parameters are input parameters, that is, parameters that are
* used in a read-only fashion to build up the query. Some drivers support the invocation
* of stored procedures that return data as output parameters, and some also as input/output
* parameters that both send in data and are updated to receive it.
*
...
...
@@ -76,7 +76,7 @@ interface Statement extends ResultStatement
/**
* errorCode
* Fetch the SQLSTATE associated with the last operation on the statement handle
* Fetch the SQLSTATE associated with the last operation on the statement handle
*
* @see Doctrine_Adapter_Interface::errorCode()
* @return string error code string
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
View file @
b066e54f
...
...
@@ -56,7 +56,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
/**
* @param \Doctrine\DBAL\Schema\ColumnDiff $columnDiff
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*/
public
function
__construct
(
ColumnDiff
$columnDiff
,
TableDiff
$tableDiff
,
AbstractPlatform
$platform
)
{
...
...
lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
View file @
b066e54f
...
...
@@ -51,7 +51,7 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
*/
private
$_platform
=
null
;
/**
* @var array
*/
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
b066e54f
...
...
@@ -412,7 +412,7 @@ abstract class AbstractPlatform
{
throw
DBALException
::
notSupported
(
__METHOD__
);
}
/**
* Returns global unique identifier
*
...
...
lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
View file @
b066e54f
...
...
@@ -34,7 +34,7 @@ class DB2Keywords extends KeywordList
{
return
'DB2'
;
}
protected
function
getKeywords
()
{
return
array
(
...
...
@@ -435,5 +435,4 @@ class DB2Keywords extends KeywordList
);
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php
View file @
b066e54f
...
...
@@ -31,32 +31,32 @@ namespace Doctrine\DBAL\Platforms\Keywords;
abstract
class
KeywordList
{
private
$keywords
=
null
;
/**
* Check if the given word is a keyword of this dialect/vendor platform.
*
*
* @param string $word
* @return bool
* @return bool
*/
public
function
isKeyword
(
$word
)
{
if
(
$this
->
keywords
===
null
)
{
$this
->
initializeKeywords
();
}
return
isset
(
$this
->
keywords
[
strtoupper
(
$word
)]);
}
protected
function
initializeKeywords
()
{
$this
->
keywords
=
array_flip
(
array_map
(
'strtoupper'
,
$this
->
getKeywords
()));
}
abstract
protected
function
getKeywords
();
/**
* Name of this keyword list.
*
*
* @return string
*/
abstract
public
function
getName
();
...
...
lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php
View file @
b066e54f
...
...
@@ -35,7 +35,7 @@ class MsSQLKeywords extends KeywordList
{
return
'MsSQL'
;
}
protected
function
getKeywords
()
{
return
array
(
...
...
lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
View file @
b066e54f
...
...
@@ -35,7 +35,7 @@ class MySQLKeywords extends KeywordList
{
return
'MySQL'
;
}
protected
function
getKeywords
()
{
return
array
(
...
...
lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
View file @
b066e54f
...
...
@@ -35,7 +35,7 @@ class OracleKeywords extends KeywordList
{
return
'Oracle'
;
}
protected
function
getKeywords
()
{
return
array
(
...
...
lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
View file @
b066e54f
...
...
@@ -35,7 +35,7 @@ class PostgreSQLKeywords extends KeywordList
{
return
'PostgreSQL'
;
}
protected
function
getKeywords
()
{
return
array
(
...
...
lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
View file @
b066e54f
...
...
@@ -34,22 +34,22 @@ class ReservedKeywordsValidator implements Visitor
* @var KeywordList[]
*/
private
$keywordLists
=
array
();
/**
* @var array
*/
private
$violations
=
array
();
public
function
__construct
(
array
$keywordLists
)
{
$this
->
keywordLists
=
$keywordLists
;
}
public
function
getViolations
()
{
return
$this
->
violations
;
}
/**
* @param string $word
* @return array
...
...
@@ -59,7 +59,7 @@ class ReservedKeywordsValidator implements Visitor
if
(
$word
[
0
]
==
"`"
)
{
$word
=
str_replace
(
'`'
,
''
,
$word
);
}
$keywordLists
=
array
();
foreach
(
$this
->
keywordLists
AS
$keywordList
)
{
if
(
$keywordList
->
isKeyword
(
$word
))
{
...
...
@@ -68,16 +68,16 @@ class ReservedKeywordsValidator implements Visitor
}
return
$keywordLists
;
}
private
function
addViolation
(
$asset
,
$violatedPlatforms
)
{
if
(
!
$violatedPlatforms
)
{
return
;
}
$this
->
violations
[]
=
$asset
.
' keyword violations: '
.
implode
(
', '
,
$violatedPlatforms
);
}
public
function
acceptColumn
(
Table
$table
,
Column
$column
)
{
$this
->
addViolation
(
...
...
@@ -88,7 +88,7 @@ class ReservedKeywordsValidator implements Visitor
public
function
acceptForeignKey
(
Table
$localTable
,
ForeignKeyConstraint
$fkConstraint
)
{
}
public
function
acceptIndex
(
Table
$table
,
Index
$index
)
...
...
@@ -98,12 +98,12 @@ class ReservedKeywordsValidator implements Visitor
public
function
acceptSchema
(
Schema
$schema
)
{
}
public
function
acceptSequence
(
Sequence
$sequence
)
{
}
public
function
acceptTable
(
Table
$table
)
...
...
lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
View file @
b066e54f
...
...
@@ -34,7 +34,7 @@ class SQLiteKeywords extends KeywordList
{
return
'SQLite'
;
}
protected
function
getKeywords
()
{
return
array
(
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
b066e54f
...
...
@@ -320,11 +320,11 @@ class MsSqlPlatform extends AbstractPlatform
$queryParts
[]
=
'ALTER COLUMN '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
}
$tableSql
=
array
();
if
(
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
return
array_merge
(
$tableSql
,
$columnSql
);
return
array_merge
(
$tableSql
,
$columnSql
);
}
foreach
(
$queryParts
as
$query
)
{
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
b066e54f
...
...
@@ -504,7 +504,7 @@ class MySqlPlatform extends AbstractPlatform
$sql
=
array
();
$tableSql
=
array
();
if
(
!
$this
->
onSchemaAlterTable
(
$diff
,
$tableSql
))
{
if
(
count
(
$queryParts
)
>
0
)
{
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
implode
(
", "
,
$queryParts
);
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
b066e54f
...
...
@@ -161,8 +161,8 @@ class OraclePlatform extends AbstractPlatform
*/
public
function
getBitOrComparisonExpression
(
$value1
,
$value2
)
{
return
'('
.
$value1
.
'-'
.
$this
->
getBitAndComparisonExpression
(
$value1
,
$value2
)
return
'('
.
$value1
.
'-'
.
$this
->
getBitAndComparisonExpression
(
$value1
,
$value2
)
.
'+'
.
$value2
.
')'
;
}
...
...
lib/Doctrine/DBAL/Portability/Connection.php
View file @
b066e54f
...
...
@@ -32,26 +32,26 @@ class Connection extends \Doctrine\DBAL\Connection
const
PORTABILITY_RTRIM
=
1
;
const
PORTABILITY_EMPTY_TO_NULL
=
4
;
const
PORTABILITY_FIX_CASE
=
8
;
const
PORTABILITY_ORACLE
=
9
;
const
PORTABILITY_POSTGRESQL
=
13
;
const
PORTABILITY_SQLITE
=
13
;
const
PORTABILITY_OTHERVENDORS
=
12
;
/**
* @var int
*/
private
$portability
=
self
::
PORTABILITY_NONE
;
/**
* @var int
*/
private
$case
;
public
function
connect
()
{
$ret
=
parent
::
connect
();
if
(
$ret
)
{
if
(
$ret
)
{
$params
=
$this
->
getParams
();
if
(
isset
(
$params
[
'portability'
]))
{
if
(
$this
->
_platform
->
getName
()
===
"oracle"
)
{
...
...
@@ -72,26 +72,26 @@ class Connection extends \Doctrine\DBAL\Connection
}
else
{
$this
->
case
=
(
$params
[
'fetch_case'
]
==
\PDO
::
CASE_LOWER
)
?
CASE_LOWER
:
CASE_UPPER
;
}
}
}
}
return
$ret
;
}
public
function
getPortability
()
{
return
$this
->
portability
;
}
public
function
getFetchCase
()
{
return
$this
->
case
;
}
public
function
executeQuery
(
$query
,
array
$params
=
array
(),
$types
=
array
(),
QueryCacheProfile
$qcp
=
null
)
{
return
new
Statement
(
parent
::
executeQuery
(
$query
,
$params
,
$types
,
$qcp
),
$this
);
}
/**
* Prepares an SQL statement.
*
...
...
@@ -102,7 +102,7 @@ class Connection extends \Doctrine\DBAL\Connection
{
return
new
Statement
(
parent
::
prepare
(
$statement
),
$this
);
}
public
function
query
()
{
$this
->
connect
();
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
b066e54f
...
...
@@ -48,7 +48,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
*/
private
$case
;
/**
/**
* @var int
*/
private
$defaultFetchStyle
=
PDO
::
FETCH_BOTH
;
...
...
lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php
View file @
b066e54f
...
...
@@ -34,40 +34,40 @@ class CompositeExpression implements \Countable
* Constant that represents an AND composite expression
*/
const
TYPE_AND
=
'AND'
;
/**
* Constant that represents an OR composite expression
*/
const
TYPE_OR
=
'OR'
;
/**
* @var string Holds the instance type of composite expression
*/
private
$type
;
/**
* @var array Each expression part of the composite expression
*/
private
$parts
=
array
();
/**
* Constructor.
*
*
* @param string $type Instance type of composite expression
* @param array $parts Composition of expressions to be joined on composite expression
*/
public
function
__construct
(
$type
,
array
$parts
=
array
())
{
$this
->
type
=
$type
;
$this
->
addMultiple
(
$parts
);
}
/**
* Adds multiple parts to composite expression.
*
*
* @param array $args
*
*
* @return CompositeExpression
*/
public
function
addMultiple
(
array
$parts
=
array
())
...
...
@@ -75,38 +75,38 @@ class CompositeExpression implements \Countable
foreach
((
array
)
$parts
as
$part
)
{
$this
->
add
(
$part
);
}
return
$this
;
}
/**
* Adds an expression to composite expression.
*
*
* @param mixed $part
* @return CompositeExpression
* @return CompositeExpression
*/
public
function
add
(
$part
)
{
if
(
!
empty
(
$part
)
||
(
$part
instanceof
self
&&
$part
->
count
()
>
0
))
{
$this
->
parts
[]
=
$part
;
}
return
$this
;
}
/**
* Retrieves the amount of expressions on composite expression.
*
* @return integer
*
* @return integer
*/
public
function
count
()
{
return
count
(
$this
->
parts
);
}
/**
* Retrieve the string representation of this composite expression.
*
*
* @return string
*/
public
function
__toString
()
...
...
@@ -114,13 +114,13 @@ class CompositeExpression implements \Countable
if
(
count
(
$this
->
parts
)
===
1
)
{
return
(
string
)
$this
->
parts
[
0
];
}
return
'('
.
implode
(
') '
.
$this
->
type
.
' ('
,
$this
->
parts
)
.
')'
;
}
/**
* Return type of this composite expression (AND/OR)
*
*
* @return string
*/
public
function
getType
()
...
...
lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
View file @
b066e54f
...
...
@@ -38,7 +38,7 @@ class ExpressionBuilder
const
LTE
=
'<='
;
const
GT
=
'>'
;
const
GTE
=
'>='
;
/**
* @var Doctrine\DBAL\Connection DBAL Connection
*/
...
...
@@ -53,7 +53,7 @@ class ExpressionBuilder
{
$this
->
connection
=
$connection
;
}
/**
* Creates a conjunction of the given boolean expressions.
*
...
...
@@ -92,7 +92,7 @@ class ExpressionBuilder
/**
* Creates a comparison expression.
*
*
* @param mixed $x Left expression
* @param string $operator One of the ExpressionBuikder::* constants.
* @param mixed $y Right expression
...
...
@@ -102,7 +102,7 @@ class ExpressionBuilder
{
return
$x
.
' '
.
$operator
.
' '
.
$y
;
}
/**
* Creates an equality comparison expression with the given arguments.
*
...
...
@@ -216,7 +216,7 @@ class ExpressionBuilder
* Creates an IS NULL expression with the given arguments.
*
* @param string $x Field in string format to be restricted by IS NULL
*
*
* @return string
*/
public
function
isNull
(
$x
)
...
...
@@ -228,7 +228,7 @@ class ExpressionBuilder
* Creates an IS NOT NULL expression with the given arguments.
*
* @param string $x Field in string format to be restricted by IS NOT NULL
*
*
* @return string
*/
public
function
isNotNull
(
$x
)
...
...
@@ -241,20 +241,20 @@ class ExpressionBuilder
*
* @param string $x Field in string format to be inspected by LIKE() comparison.
* @param mixed $y Argument to be used in LIKE() comparison.
*
*
* @return string
*/
public
function
like
(
$x
,
$y
)
{
return
$this
->
comparison
(
$x
,
'LIKE'
,
$y
);
}
/**
* Quotes a given input parameter.
*
*
* @param mixed $input Parameter to be quoted.
* @param string $type Type of the parameter.
*
*
* @return string
*/
public
function
literal
(
$input
,
$type
=
null
)
...
...
lib/Doctrine/DBAL/SQLParserUtils.php
View file @
b066e54f
...
...
@@ -34,21 +34,21 @@ class SQLParserUtils
{
/**
* Get an array of the placeholders in an sql statements as keys and their positions in the query string.
*
*
* Returns an integer => integer pair (indexed from zero) for a positional statement
* and a string => int[] pair for a named statement.
*
*
* @param string $statement
* @param bool $isPositional
* @return array
*/
static
public
function
getPlaceholderPositions
(
$statement
,
$isPositional
=
true
)
{
{
$match
=
(
$isPositional
)
?
'?'
:
':'
;
if
(
strpos
(
$statement
,
$match
)
===
false
)
{
return
array
();
}
$count
=
0
;
$inLiteral
=
false
;
// a valid query never starts with quotes
$stmtLen
=
strlen
(
$statement
);
...
...
@@ -75,16 +75,16 @@ class SQLParserUtils
return
$paramMap
;
}
/**
* For a positional query this method can rewrite the sql statement with regard to array parameters.
*
*
* @param string $query
* @param array $params
* @param array $types
* @param array $types
*/
static
public
function
expandListParameters
(
$query
,
$params
,
$types
)
{
{
$isPositional
=
is_int
(
key
(
$params
));
$arrayPositions
=
array
();
$bindIndex
=
-
1
;
...
...
@@ -94,15 +94,15 @@ class SQLParserUtils
if
(
$isPositional
)
{
$name
=
$bindIndex
;
}
$arrayPositions
[
$name
]
=
false
;
}
}
if
((
!
$arrayPositions
&&
$isPositional
)
||
(
count
(
$params
)
!=
count
(
$types
)))
{
return
array
(
$query
,
$params
,
$types
);
}
$paramPos
=
self
::
getPlaceholderPositions
(
$query
,
$isPositional
);
if
(
$isPositional
)
{
$paramOffset
=
0
;
...
...
@@ -111,30 +111,30 @@ class SQLParserUtils
if
(
!
isset
(
$arrayPositions
[
$needle
]))
{
continue
;
}
$needle
+=
$paramOffset
;
$needlePos
+=
$queryOffset
;
$len
=
count
(
$params
[
$needle
]);
$params
=
array_merge
(
array_slice
(
$params
,
0
,
$needle
),
$params
[
$needle
],
array_slice
(
$params
,
$needle
+
1
)
);
$types
=
array_merge
(
array_slice
(
$types
,
0
,
$needle
),
array_fill
(
0
,
$len
,
$types
[
$needle
]
-
Connection
::
ARRAY_PARAM_OFFSET
),
// array needles are at PDO::PARAM_* + 100
array_slice
(
$types
,
$needle
+
1
)
);
$expandStr
=
implode
(
", "
,
array_fill
(
0
,
$len
,
"?"
));
$query
=
substr
(
$query
,
0
,
$needlePos
)
.
$expandStr
.
substr
(
$query
,
$needlePos
+
1
);
$paramOffset
+=
(
$len
-
1
);
// Grows larger by number of parameters minus the replaced needle.
$queryOffset
+=
(
strlen
(
$expandStr
)
-
1
);
}
}
else
{
$queryOffset
=
0
;
$typesOrd
=
array
();
...
...
@@ -144,7 +144,7 @@ class SQLParserUtils
$token
=
substr
(
$needle
,
0
,
1
);
$needle
=
substr
(
$needle
,
1
);
$value
=
$params
[
$needle
];
if
(
!
isset
(
$arrayPositions
[
$needle
]))
{
foreach
(
$needlePos
as
$pos
)
{
$pos
+=
$queryOffset
;
...
...
@@ -157,23 +157,23 @@ class SQLParserUtils
$len
=
count
(
$value
);
$expandStr
=
implode
(
", "
,
array_fill
(
0
,
$len
,
"?"
));
foreach
(
$needlePos
as
$pos
)
{
foreach
(
$value
as
$val
)
{
$paramsOrd
[]
=
$val
;
$typesOrd
[]
=
$types
[
$needle
]
-
Connection
::
ARRAY_PARAM_OFFSET
;
}
$pos
+=
$queryOffset
;
$queryOffset
+=
(
strlen
(
$expandStr
)
-
$paramLen
);
$query
=
substr
(
$query
,
0
,
$pos
)
.
$expandStr
.
substr
(
$query
,
(
$pos
+
$paramLen
));
}
}
}
$types
=
$typesOrd
;
$params
=
$paramsOrd
;
}
return
array
(
$query
,
$params
,
$types
);
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
b066e54f
...
...
@@ -76,7 +76,7 @@ abstract class AbstractSchemaManager
}
/**
* Try any method on the schema manager. Normally a method throws an
* Try any method on the schema manager. Normally a method throws an
* exception when your DBMS doesn't support it or if an error occurs.
* This method allows you to try and method on your SchemaManager
* instance and will return false if it does not work or is not supported.
...
...
@@ -178,7 +178,7 @@ abstract class AbstractSchemaManager
/**
* Return true if all the given tables exist.
*
*
* @param array $tableNames
* @return bool
*/
...
...
@@ -271,7 +271,7 @@ abstract class AbstractSchemaManager
/**
* Drops a database.
*
*
* NOTE: You can not drop the database this SchemaManager is currently connected to.
*
* @param string $database The name of the database to drop
...
...
@@ -793,7 +793,7 @@ abstract class AbstractSchemaManager
/**
* Create a schema instance for the current database.
*
*
* @return Schema
*/
public
function
createSchema
()
...
...
@@ -823,7 +823,7 @@ abstract class AbstractSchemaManager
/**
* Given a table comment this method tries to extract a typehint for Doctrine Type, or returns
* the type given as default.
*
*
* @param string $comment
* @param string $currentType
* @return string
...
...
lib/Doctrine/DBAL/Schema/Column.php
View file @
b066e54f
...
...
@@ -100,7 +100,7 @@ class Column extends AbstractAsset
/**
* Create a new Column
*
*
* @param string $columnName
* @param Doctrine\DBAL\Types\Type $type
* @param int $length
...
...
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
b066e54f
...
...
@@ -163,7 +163,7 @@ class Comparator
$changes
++
;
}
}
foreach
(
$table1Columns
as
$columnName
=>
$column
)
{
if
(
$table2
->
hasColumn
(
$columnName
)
)
{
$changedProperties
=
$this
->
diffColumn
(
$column
,
$table2
->
getColumn
(
$columnName
)
);
...
...
@@ -241,7 +241,7 @@ class Comparator
/**
* Try to find columns that only changed their name, rename operations maybe cheaper than add/drop
* however ambiguouties between different possibilites should not lead to renaming at all.
*
*
* @param TableDiff $tableDifferences
*/
private
function
detectColumnRenamings
(
TableDiff
$tableDifferences
)
...
...
@@ -278,7 +278,7 @@ class Comparator
if
(
array_map
(
'strtolower'
,
$key1
->
getLocalColumns
())
!=
array_map
(
'strtolower'
,
$key2
->
getLocalColumns
()))
{
return
true
;
}
if
(
array_map
(
'strtolower'
,
$key1
->
getForeignColumns
())
!=
array_map
(
'strtolower'
,
$key2
->
getForeignColumns
()))
{
return
true
;
}
...
...
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
View file @
b066e54f
...
...
@@ -48,7 +48,7 @@ class DB2SchemaManager extends AbstractSchemaManager
$sql
.=
" AND CREATOR = UPPER('"
.
$this
->
_conn
->
getUsername
()
.
"')"
;
$tables
=
$this
->
_conn
->
fetchAll
(
$sql
);
return
$this
->
_getPortableTablesList
(
$tables
);
}
...
...
@@ -70,7 +70,7 @@ class DB2SchemaManager extends AbstractSchemaManager
$precision
=
false
;
$type
=
$this
->
_platform
->
getDoctrineTypeMapping
(
$tableColumn
[
'typename'
]);
switch
(
strtolower
(
$tableColumn
[
'typename'
]))
{
case
'varchar'
:
$length
=
$tableColumn
[
'length'
];
...
...
lib/Doctrine/DBAL/Schema/Index.php
View file @
b066e54f
...
...
@@ -76,10 +76,10 @@ class Index extends AbstractAsset implements Constraint
{
return
$this
->
_columns
;
}
/**
* Is the index neither unique nor primary key?
*
*
* @return bool
*/
public
function
isSimpleIndex
()
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
b066e54f
...
...
@@ -89,7 +89,7 @@ class OracleSchemaManager extends AbstractSchemaManager
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
{
$tableColumn
=
\array_change_key_case
(
$tableColumn
,
CASE_LOWER
);
$dbType
=
strtolower
(
$tableColumn
[
'data_type'
]);
if
(
strpos
(
$dbType
,
"timestamp("
)
===
0
)
{
if
(
strpos
(
$dbType
,
"WITH TIME ZONE"
))
{
...
...
lib/Doctrine/DBAL/Schema/Schema.php
View file @
b066e54f
...
...
@@ -40,7 +40,7 @@ class Schema extends AbstractAsset
* @var array
*/
protected
$_tables
=
array
();
/**
* @var array
*/
...
...
@@ -109,7 +109,7 @@ class Schema extends AbstractAsset
/**
* Get all tables of this schema.
*
*
* @return array
*/
public
function
getTables
()
...
...
@@ -133,7 +133,7 @@ class Schema extends AbstractAsset
/**
* Does this schema have a table with the given name?
*
*
* @param string $tableName
* @return Schema
*/
...
...
@@ -177,7 +177,7 @@ class Schema extends AbstractAsset
/**
* Create a new table
*
*
* @param string $tableName
* @return Table
*/
...
...
@@ -221,7 +221,7 @@ class Schema extends AbstractAsset
/**
* Create a new sequence
*
*
* @param string $sequenceName
* @param int $allocationSize
* @param int $initialValue
...
...
@@ -301,7 +301,7 @@ class Schema extends AbstractAsset
public
function
visit
(
Visitor
$visitor
)
{
$visitor
->
acceptSchema
(
$this
);
foreach
(
$this
->
_tables
AS
$table
)
{
$table
->
visit
(
$visitor
);
}
...
...
lib/Doctrine/DBAL/Schema/Sequence.php
View file @
b066e54f
...
...
@@ -66,7 +66,7 @@ class Sequence extends AbstractAsset
{
return
$this
->
_initialValue
;
}
public
function
setAllocationSize
(
$allocationSize
)
{
$this
->
_allocationSize
=
(
is_numeric
(
$allocationSize
))
?
$allocationSize
:
1
;
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
b066e54f
...
...
@@ -33,7 +33,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
{
/**
* {@inheritdoc}
*
*
* @override
*/
public
function
dropDatabase
(
$database
)
...
...
@@ -45,7 +45,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
/**
* {@inheritdoc}
*
*
* @override
*/
public
function
createDatabase
(
$database
)
...
...
lib/Doctrine/DBAL/Schema/Visitor/CreateSchemaSqlCollector.php
View file @
b066e54f
...
...
@@ -83,7 +83,7 @@ class CreateSchemaSqlCollector implements Visitor
public
function
acceptColumn
(
Table
$table
,
Column
$column
)
{
}
/**
...
...
@@ -108,7 +108,7 @@ class CreateSchemaSqlCollector implements Visitor
*/
public
function
acceptIndex
(
Table
$table
,
Index
$index
)
{
}
/**
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
b066e54f
...
...
@@ -37,18 +37,18 @@ class ReservedWordsCommand extends Command
'oracle'
=>
'Doctrine\DBAL\Platforms\Keywords\OracleKeywords'
,
'db2'
=>
'Doctrine\DBAL\Platforms\Keywords\DB2Keywords'
,
);
/**
* If you want to add or replace a keywords list use this command
*
*
* @param string $name
* @param string $class
* @param string $class
*/
public
function
setKeywordListClass
(
$name
,
$class
)
{
$this
->
keywordListClasses
[
$name
]
=
$class
;
}
/**
* @see Console\Command\Command
*/
...
...
@@ -70,12 +70,12 @@ By default SQLite, MySQL, PostgreSQL, MsSQL and Oracle
keywords are checked:
<info>doctrine dbal:reserved-words</info>
If you want to check against specific dialects you can
pass them to the command:
<info>doctrine dbal:reserved-words mysql pgsql</info>
The following keyword lists are currently shipped with Doctrine:
* mysql
...
...
@@ -87,7 +87,7 @@ The following keyword lists are currently shipped with Doctrine:
EOT
);
}
/**
* @see Console\Command\Command
*/
...
...
@@ -95,12 +95,12 @@ EOT
{
/* @var $conn Doctrine\DBAL\Connection */
$conn
=
$this
->
getHelper
(
'db'
)
->
getConnection
();
$keywordLists
=
(
array
)
$input
->
getOption
(
'list'
);
if
(
!
$keywordLists
)
{
$keywordLists
=
array
(
'mysql'
,
'pgsql'
,
'sqlite'
,
'oracle'
,
'mssql'
);
}
$keywords
=
array
();
foreach
(
$keywordLists
AS
$keywordList
)
{
if
(
!
isset
(
$this
->
keywordListClasses
[
$keywordList
]))
{
...
...
@@ -112,14 +112,14 @@ EOT
$class
=
$this
->
keywordListClasses
[
$keywordList
];
$keywords
[]
=
new
$class
;
}
$output
->
write
(
'Checking keyword violations for <comment>'
.
implode
(
", "
,
$keywordLists
)
.
"</comment>..."
,
true
);
/* @var $schema \Doctrine\DBAL\Schema\Schema */
$schema
=
$conn
->
getSchemaManager
()
->
createSchema
();
$visitor
=
new
ReservedKeywordsValidator
(
$keywords
);
$schema
->
visit
(
$visitor
);
$violations
=
$visitor
->
getViolations
();
if
(
count
(
$violations
)
==
0
)
{
$output
->
write
(
"No reserved keywords violations have been found!"
,
true
);
...
...
lib/Doctrine/DBAL/Types/BooleanType.php
View file @
b066e54f
...
...
@@ -39,7 +39,7 @@ class BooleanType extends Type
{
return
$platform
->
convertBooleans
(
$value
);
}
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
return
(
null
===
$value
)
?
null
:
(
bool
)
$value
;
...
...
lib/Doctrine/DBAL/Types/ConversionException.php
View file @
b066e54f
...
...
@@ -35,7 +35,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
{
/**
* Thrown when a Database to Doctrine Type Conversion fails.
*
*
* @param string $value
* @param string $toType
* @return ConversionException
...
...
@@ -45,11 +45,11 @@ class ConversionException extends \Doctrine\DBAL\DBALException
$value
=
(
strlen
(
$value
)
>
32
)
?
substr
(
$value
,
0
,
20
)
.
"..."
:
$value
;
return
new
self
(
'Could not convert database value "'
.
$value
.
'" to Doctrine Type '
.
$toType
);
}
/**
* Thrown when a Database to Doctrine Type Conversion fails and we can make a statement
* about the expected format.
*
*
* @param string $value
* @param string $toType
* @return ConversionException
...
...
lib/Doctrine/DBAL/Types/DateTimeType.php
View file @
b066e54f
...
...
@@ -43,7 +43,7 @@ class DateTimeType extends Type
return
(
$value
!==
null
)
?
$value
->
format
(
$platform
->
getDateTimeFormatString
())
:
null
;
}
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
if
(
$value
===
null
)
{
...
...
lib/Doctrine/DBAL/Types/DateTimeTzType.php
View file @
b066e54f
...
...
@@ -52,7 +52,7 @@ class DateTimeTzType extends Type
{
return
Type
::
DATETIMETZ
;
}
public
function
getSQLDeclaration
(
array
$fieldDeclaration
,
AbstractPlatform
$platform
)
{
return
$platform
->
getDateTimeTzTypeDeclarationSQL
(
$fieldDeclaration
);
...
...
lib/Doctrine/DBAL/Types/DateType.php
View file @
b066e54f
...
...
@@ -40,10 +40,10 @@ class DateType extends Type
public
function
convertToDatabaseValue
(
$value
,
AbstractPlatform
$platform
)
{
return
(
$value
!==
null
)
return
(
$value
!==
null
)
?
$value
->
format
(
$platform
->
getDateFormatString
())
:
null
;
}
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
if
(
$value
===
null
)
{
...
...
lib/Doctrine/DBAL/Types/TimeType.php
View file @
b066e54f
...
...
@@ -46,7 +46,7 @@ class TimeType extends Type
*/
public
function
convertToDatabaseValue
(
$value
,
AbstractPlatform
$platform
)
{
return
(
$value
!==
null
)
return
(
$value
!==
null
)
?
$value
->
format
(
$platform
->
getTimeFormatString
())
:
null
;
}
...
...
lib/Doctrine/DBAL/Version.php
View file @
b066e54f
...
...
@@ -16,7 +16,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL
;
/**
...
...
@@ -42,7 +42,7 @@ class Version
* Compares a Doctrine version with the current one.
*
* @param string $version Doctrine version to compare.
* @return int Returns -1 if older, 0 if it is the same, 1 if version
* @return int Returns -1 if older, 0 if it is the same, 1 if version
* passed as argument is newer.
*/
public
static
function
compare
(
$version
)
...
...
tests/Doctrine/Tests/DBAL/ConnectionTest.php
View file @
b066e54f
...
...
@@ -8,7 +8,7 @@ use Doctrine\DBAL\Connection;
use
Doctrine\Common\EventManager
;
use
Doctrine\DBAL\Configuration
;
use
Doctrine\DBAL\Events
;
class
ConnectionTest
extends
\Doctrine\Tests\DbalTestCase
{
/**
...
...
tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
View file @
b066e54f
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\Tests\DBAL
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
OCI8StatementTest
extends
\Doctrine\Tests\DbalTestCase
{
public
function
setUp
()
...
...
@@ -11,7 +11,7 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
if
(
!
extension_loaded
(
'oci8'
))
{
$this
->
markTestSkipped
(
'oci8 is not installed.'
);
}
parent
::
setUp
();
}
...
...
@@ -21,7 +21,7 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
$statement
=
"update table set field1 = ?, field2 = ? where field3 = ?"
;
$executeMode
=
OCI_COMMIT_ON_SUCCESS
;
return
$this
->
getMock
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Statement'
,
return
$this
->
getMock
(
'\Doctrine\DBAL\Driver\OCI8\OCI8Statement'
,
array
(
'bindValue'
,
'errorInfo'
),
array
(
null
,
$statement
,
$executeMode
),
''
,
false
);
}
...
...
@@ -29,7 +29,7 @@ class OCI8StatementTest extends \Doctrine\Tests\DbalTestCase
/**
* This scenario shows that when the first parameter is not null
* it properly sets $hasZeroIndex to 1 and calls bindValue starting at 1.
*
*
* The expected exception is due to oci_execute failing due to no valid connection.
*
* @dataProvider executeDataProvider
...
...
tests/Doctrine/Tests/DBAL/DriverManagerTest.php
View file @
b066e54f
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\Tests\DBAL
;
require_once
__DIR__
.
'/../TestInit.php'
;
class
DriverManagerTest
extends
\Doctrine\Tests\DbalTestCase
{
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
b066e54f
...
...
@@ -39,7 +39,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
try
{
$this
->
_conn
->
beginTransaction
();
$this
->
assertEquals
(
1
,
$this
->
_conn
->
getTransactionNestingLevel
());
try
{
$this
->
_conn
->
beginTransaction
();
$this
->
assertEquals
(
2
,
$this
->
_conn
->
getTransactionNestingLevel
());
...
...
@@ -48,7 +48,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
catch
(
\Exception
$e
)
{
$this
->
_conn
->
rollback
();
$this
->
assertEquals
(
1
,
$this
->
_conn
->
getTransactionNestingLevel
());
//no rethrow
//no rethrow
}
$this
->
assertTrue
(
$this
->
_conn
->
isRollbackOnly
());
...
...
@@ -164,9 +164,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
try
{
$this
->
_conn
->
beginTransaction
();
$this
->
assertEquals
(
1
,
$this
->
_conn
->
getTransactionNestingLevel
());
throw
new
\Exception
;
$this
->
_conn
->
commit
();
// never reached
}
catch
(
\Exception
$e
)
{
$this
->
assertEquals
(
1
,
$this
->
_conn
->
getTransactionNestingLevel
());
...
...
tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
View file @
b066e54f
...
...
@@ -185,7 +185,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt
->
closeCursor
();
return
$data
;
}
private
function
hydrateStmtIterator
(
$stmt
,
$fetchStyle
=
\PDO
::
FETCH_ASSOC
)
{
$data
=
array
();
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/MsSqlSchemaManagerTest.php
View file @
b066e54f
...
...
@@ -5,8 +5,8 @@ namespace Doctrine\Tests\DBAL\Functional\Schema;
use
Doctrine\DBAL\Schema
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
MsSqlSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
{
}
\ No newline at end of file
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\Table;
use
Doctrine\DBAL\Schema\Schema
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
MySqlSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
{
public
function
testSwitchPrimaryKeyColumns
()
...
...
@@ -41,7 +41,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
_sm
->
createTable
(
$table
);
$tableFetched
=
$this
->
_sm
->
listTableDetails
(
"diffbug_routing_translations"
);
$comparator
=
new
\Doctrine\DBAL\Schema\Comparator
;
$diff
=
$comparator
->
diffTable
(
$tableFetched
,
$table
);
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
View file @
b066e54f
...
...
@@ -5,7 +5,7 @@ namespace Doctrine\Tests\DBAL\Functional\Schema;
use
Doctrine\DBAL\Schema
;
require_once
__DIR__
.
'/../../../TestInit.php'
;
class
OracleSchemaManagerTest
extends
SchemaManagerFunctionalTestCase
{
public
function
setUp
()
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
b066e54f
...
...
@@ -35,7 +35,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
$this
->
_sm
->
renameTable
(
'oldname'
,
'newname'
);
}
public
function
testAutoincrementDetection
()
{
$this
->
markTestSkipped
(
...
...
tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
View file @
b066e54f
...
...
@@ -81,7 +81,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
foreach
(
$platform
->
getCreateTableSQL
(
$table
)
AS
$sql
)
{
$this
->
_conn
->
executeQuery
(
$sql
);
}
$this
->
_conn
->
beginTransaction
();
$this
->
_conn
->
insert
(
"nontemporary"
,
array
(
"id"
=>
1
));
...
...
tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
View file @
b066e54f
...
...
@@ -39,7 +39,7 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this
->
_conn
->
executeQuery
(
$sql
);
}
}
catch
(
\Exception
$e
)
{
}
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
b066e54f
...
...
@@ -243,7 +243,7 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
_platform
->
getDropTableSQL
(
'TABLE'
);
}
public
function
testGetAlterTableSqlDispatchEvent
()
{
$events
=
array
(
...
...
@@ -335,7 +335,7 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
{
$this
->
markTestSkipped
(
'Platform does not support Column comments.'
);
}
/**
* @group DBAL-45
*/
...
...
@@ -343,7 +343,7 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
{
$keywordList
=
$this
->
_platform
->
getReservedKeywordsList
();
$this
->
assertInstanceOf
(
'Doctrine\DBAL\Platforms\Keywords\KeywordList'
,
$keywordList
);
$this
->
assertTrue
(
$keywordList
->
isKeyword
(
'table'
));
}
}
tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
View file @
b066e54f
...
...
@@ -8,7 +8,7 @@ use Doctrine\DBAL\Schema\Table;
use
Doctrine\DBAL\Schema\Schema
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
MySqlPlatformTest
extends
AbstractPlatformTestCase
{
public
function
createPlatform
()
...
...
@@ -129,7 +129,7 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
public
function
testDoesSupportSavePoints
()
{
$this
->
assertTrue
(
$this
->
_platform
->
supportsSavepoints
());
$this
->
assertTrue
(
$this
->
_platform
->
supportsSavepoints
());
}
public
function
getGenerateIndexSql
()
...
...
@@ -146,27 +146,27 @@ class MySqlPlatformTest extends AbstractPlatformTestCase
{
return
'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)'
;
}
/**
* @group DBAL-126
*/
public
function
testUniquePrimaryKey
()
{
{
$keyTable
=
new
Table
(
"foo"
);
$keyTable
->
addColumn
(
"bar"
,
"integer"
);
$keyTable
->
addColumn
(
"baz"
,
"string"
);
$keyTable
->
setPrimaryKey
(
array
(
"bar"
));
$keyTable
->
addUniqueIndex
(
array
(
"baz"
));
$oldTable
=
new
Table
(
"foo"
);
$oldTable
->
addColumn
(
"bar"
,
"integer"
);
$oldTable
->
addColumn
(
"baz"
,
"string"
);
$c
=
new
\Doctrine\DBAL\Schema\Comparator
;
$diff
=
$c
->
diffTable
(
$oldTable
,
$keyTable
);
$sql
=
$this
->
_platform
->
getAlterTableSQL
(
$diff
);
$this
->
assertEquals
(
array
(
"ALTER TABLE foo ADD PRIMARY KEY (bar)"
,
"CREATE UNIQUE INDEX UNIQ_8C73652178240498 ON foo (baz)"
,
...
...
tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\OraclePlatform;
use
Doctrine\DBAL\Types\Type
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
OraclePlatformTest
extends
AbstractPlatformTestCase
{
public
function
createPlatform
()
...
...
@@ -94,7 +94,7 @@ class OraclePlatformTest extends AbstractPlatformTestCase
public
function
testDropTable
()
{
$this
->
assertEquals
(
'DROP TABLE foobar'
,
$this
->
_platform
->
getDropTableSQL
(
'foobar'
));
$this
->
assertEquals
(
'DROP TABLE foobar'
,
$this
->
_platform
->
getDropTableSQL
(
'foobar'
));
}
public
function
testGeneratesTypeDeclarationForIntegers
()
...
...
@@ -145,9 +145,9 @@ class OraclePlatformTest extends AbstractPlatformTestCase
public
function
testSupportsSavePoints
()
{
$this
->
assertTrue
(
$this
->
_platform
->
supportsSavepoints
());
$this
->
assertTrue
(
$this
->
_platform
->
supportsSavepoints
());
}
public
function
getGenerateIndexSql
()
{
return
'CREATE INDEX my_idx ON mytable (user_name, last_login)'
;
...
...
@@ -212,8 +212,8 @@ class OraclePlatformTest extends AbstractPlatformTestCase
public
function
getBitOrComparisonExpressionSql
(
$value1
,
$value2
)
{
return
'('
.
$value1
.
'-'
.
$this
->
getBitAndComparisonExpressionSql
(
$value1
,
$value2
)
return
'('
.
$value1
.
'-'
.
$this
->
getBitAndComparisonExpressionSql
(
$value1
,
$value2
)
.
'+'
.
$value2
.
')'
;
}
}
\ No newline at end of file
tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use
Doctrine\DBAL\Types\Type
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
PostgreSqlPlatformTest
extends
AbstractPlatformTestCase
{
public
function
createPlatform
()
...
...
tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php
View file @
b066e54f
...
...
@@ -13,32 +13,32 @@ class ReservedKeywordsValidatorTest extends \Doctrine\Tests\DbalTestCase
* @var ReservedKeywordsValidator
*/
private
$validator
;
public
function
setUp
()
{
$this
->
validator
=
new
ReservedKeywordsValidator
(
array
(
new
\Doctrine\DBAL\Platforms\Keywords\MySQLKeywords
()
));
}
public
function
testReservedTableName
()
{
$table
=
new
Table
(
"TABLE"
);
$this
->
validator
->
acceptTable
(
$table
);
$this
->
assertEquals
(
array
(
'Table TABLE keyword violations: MySQL'
),
$this
->
validator
->
getViolations
()
);
}
public
function
testReservedColumnName
()
{
$table
=
new
Table
(
"TABLE"
);
$column
=
$table
->
addColumn
(
'table'
,
'string'
);
$this
->
validator
->
acceptColumn
(
$table
,
$column
);
$this
->
assertEquals
(
array
(
'Table TABLE column table keyword violations: MySQL'
),
$this
->
validator
->
getViolations
()
...
...
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
use
Doctrine\DBAL\Types\Type
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
SqlitePlatformTest
extends
AbstractPlatformTestCase
{
public
function
createPlatform
()
...
...
@@ -37,19 +37,19 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
public
function
testGeneratesTransactionCommands
()
{
$this
->
assertEquals
(
'PRAGMA read_uncommitted = 0'
,
'PRAGMA read_uncommitted = 0'
,
$this
->
_platform
->
getSetTransactionIsolationSQL
(
\Doctrine\DBAL\Connection
::
TRANSACTION_READ_UNCOMMITTED
)
);
$this
->
assertEquals
(
'PRAGMA read_uncommitted = 1'
,
'PRAGMA read_uncommitted = 1'
,
$this
->
_platform
->
getSetTransactionIsolationSQL
(
\Doctrine\DBAL\Connection
::
TRANSACTION_READ_COMMITTED
)
);
$this
->
assertEquals
(
'PRAGMA read_uncommitted = 1'
,
'PRAGMA read_uncommitted = 1'
,
$this
->
_platform
->
getSetTransactionIsolationSQL
(
\Doctrine\DBAL\Connection
::
TRANSACTION_REPEATABLE_READ
)
);
$this
->
assertEquals
(
'PRAGMA read_uncommitted = 1'
,
'PRAGMA read_uncommitted = 1'
,
$this
->
_platform
->
getSetTransactionIsolationSQL
(
\Doctrine\DBAL\Connection
::
TRANSACTION_SERIALIZABLE
)
);
}
...
...
tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php
View file @
b066e54f
...
...
@@ -14,67 +14,67 @@ class CompositeExpressionTest extends \Doctrine\Tests\DbalTestCase
public
function
testCount
()
{
$expr
=
new
CompositeExpression
(
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
));
$this
->
assertEquals
(
1
,
count
(
$expr
));
$expr
->
add
(
'u.group_id = 2'
);
$this
->
assertEquals
(
2
,
count
(
$expr
));
}
/**
* @dataProvider provideDataForConvertToString
*/
public
function
testCompositeUsageAndGeneration
(
$type
,
$parts
,
$expects
)
{
$expr
=
new
CompositeExpression
(
$type
,
$parts
);
$this
->
assertEquals
(
$expects
,
(
string
)
$expr
);
}
public
function
provideDataForConvertToString
()
{
return
array
(
array
(
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
),
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
),
'u.user = 1'
),
array
(
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
,
'u.group_id = 1'
),
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
,
'u.group_id = 1'
),
'(u.user = 1) AND (u.group_id = 1)'
),
array
(
CompositeExpression
::
TYPE_OR
,
array
(
'u.user = 1'
),
CompositeExpression
::
TYPE_OR
,
array
(
'u.user = 1'
),
'u.user = 1'
),
array
(
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
,
'u.group_id = 2'
),
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
,
'u.group_id = 2'
),
'(u.group_id = 1) OR (u.group_id = 2)'
),
array
(
CompositeExpression
::
TYPE_AND
,
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
,
'u.user = 1'
,
new
CompositeExpression
(
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
,
'u.group_id = 2'
)
)
),
),
'(u.user = 1) AND ((u.group_id = 1) OR (u.group_id = 2))'
),
array
(
CompositeExpression
::
TYPE_OR
,
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
,
'u.group_id = 1'
,
new
CompositeExpression
(
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
,
'u.group_id = 2'
)
)
),
),
'(u.group_id = 1) OR ((u.user = 1) AND (u.group_id = 2))'
),
);
...
...
tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
View file @
b066e54f
...
...
@@ -13,140 +13,140 @@ require_once __DIR__ . '/../../../TestInit.php';
class
ExpressionBuilderTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
$expr
;
public
function
setUp
()
{
$conn
=
$this
->
getMock
(
'Doctrine\DBAL\Connection'
,
array
(),
array
(),
''
,
false
);
$this
->
expr
=
new
ExpressionBuilder
(
$conn
);
$conn
->
expects
(
$this
->
any
())
->
method
(
'getExpressionBuilder'
)
->
will
(
$this
->
returnValue
(
$this
->
expr
));
}
/**
* @dataProvider provideDataForAndX
*/
public
function
testAndX
(
$parts
,
$expected
)
{
$composite
=
$this
->
expr
->
andX
();
foreach
(
$parts
as
$part
)
{
$composite
->
add
(
$part
);
}
$this
->
assertEquals
(
$expected
,
(
string
)
$composite
);
}
public
function
provideDataForAndX
()
{
return
array
(
array
(
array
(
'u.user = 1'
),
array
(
'u.user = 1'
),
'u.user = 1'
),
array
(
array
(
'u.user = 1'
,
'u.group_id = 1'
),
array
(
'u.user = 1'
,
'u.group_id = 1'
),
'(u.user = 1) AND (u.group_id = 1)'
),
array
(
array
(
'u.user = 1'
),
array
(
'u.user = 1'
),
'u.user = 1'
),
array
(
array
(
'u.group_id = 1'
,
'u.group_id = 2'
),
array
(
'u.group_id = 1'
,
'u.group_id = 2'
),
'(u.group_id = 1) AND (u.group_id = 2)'
),
array
(
array
(
'u.user = 1'
,
'u.user = 1'
,
new
CompositeExpression
(
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
,
'u.group_id = 2'
)
)
),
),
'(u.user = 1) AND ((u.group_id = 1) OR (u.group_id = 2))'
),
array
(
array
(
'u.group_id = 1'
,
'u.group_id = 1'
,
new
CompositeExpression
(
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
,
'u.group_id = 2'
)
)
),
),
'(u.group_id = 1) AND ((u.user = 1) AND (u.group_id = 2))'
),
);
}
/**
* @dataProvider provideDataForOrX
*/
public
function
testOrX
(
$parts
,
$expected
)
{
$composite
=
$this
->
expr
->
orX
();
foreach
(
$parts
as
$part
)
{
$composite
->
add
(
$part
);
}
$this
->
assertEquals
(
$expected
,
(
string
)
$composite
);
}
public
function
provideDataForOrX
()
{
return
array
(
array
(
array
(
'u.user = 1'
),
array
(
'u.user = 1'
),
'u.user = 1'
),
array
(
array
(
'u.user = 1'
,
'u.group_id = 1'
),
array
(
'u.user = 1'
,
'u.group_id = 1'
),
'(u.user = 1) OR (u.group_id = 1)'
),
array
(
array
(
'u.user = 1'
),
array
(
'u.user = 1'
),
'u.user = 1'
),
array
(
array
(
'u.group_id = 1'
,
'u.group_id = 2'
),
array
(
'u.group_id = 1'
,
'u.group_id = 2'
),
'(u.group_id = 1) OR (u.group_id = 2)'
),
array
(
array
(
'u.user = 1'
,
'u.user = 1'
,
new
CompositeExpression
(
CompositeExpression
::
TYPE_OR
,
array
(
'u.group_id = 1'
,
'u.group_id = 2'
)
)
),
),
'(u.user = 1) OR ((u.group_id = 1) OR (u.group_id = 2))'
),
array
(
array
(
'u.group_id = 1'
,
'u.group_id = 1'
,
new
CompositeExpression
(
CompositeExpression
::
TYPE_AND
,
array
(
'u.user = 1'
,
'u.group_id = 2'
)
)
),
),
'(u.group_id = 1) OR ((u.user = 1) AND (u.group_id = 2))'
),
);
}
/**
* @dataProvider provideDataForComparison
*/
public
function
testComparison
(
$leftExpr
,
$operator
,
$rightExpr
,
$expected
)
{
$part
=
$this
->
expr
->
comparison
(
$leftExpr
,
$operator
,
$rightExpr
);
$this
->
assertEquals
(
$expected
,
(
string
)
$part
);
}
public
function
provideDataForComparison
()
{
return
array
(
...
...
@@ -158,42 +158,42 @@ class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase
array
(
'u.salary'
,
ExpressionBuilder
::
GTE
,
'10000'
,
'u.salary >= 10000'
),
);
}
public
function
testEq
()
{
$this
->
assertEquals
(
'u.user_id = 1'
,
$this
->
expr
->
eq
(
'u.user_id'
,
'1'
));
}
public
function
testNeq
()
{
$this
->
assertEquals
(
'u.user_id <> 1'
,
$this
->
expr
->
neq
(
'u.user_id'
,
'1'
));
}
public
function
testLt
()
{
$this
->
assertEquals
(
'u.salary < 10000'
,
$this
->
expr
->
lt
(
'u.salary'
,
'10000'
));
}
public
function
testLte
()
{
$this
->
assertEquals
(
'u.salary <= 10000'
,
$this
->
expr
->
lte
(
'u.salary'
,
'10000'
));
}
public
function
testGt
()
{
$this
->
assertEquals
(
'u.salary > 10000'
,
$this
->
expr
->
gt
(
'u.salary'
,
'10000'
));
}
public
function
testGte
()
{
$this
->
assertEquals
(
'u.salary >= 10000'
,
$this
->
expr
->
gte
(
'u.salary'
,
'10000'
));
}
public
function
testIsNull
()
{
$this
->
assertEquals
(
'u.deleted IS NULL'
,
$this
->
expr
->
isNull
(
'u.deleted'
));
}
public
function
testIsNotNull
()
{
$this
->
assertEquals
(
'u.updated IS NOT NULL'
,
$this
->
expr
->
isNotNull
(
'u.updated'
));
...
...
tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
View file @
b066e54f
...
...
@@ -19,7 +19,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
// none
array
(
'SELECT * FROM Foo'
,
true
,
array
()),
array
(
'SELECT * FROM Foo'
,
false
,
array
()),
// Positionals
array
(
'SELECT ?'
,
true
,
array
(
7
)),
array
(
'SELECT * FROM Foo WHERE bar IN (?, ?, ?)'
,
true
,
array
(
32
,
35
,
38
)),
...
...
@@ -28,7 +28,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array
(
"SELECT '?' FROM foo"
,
true
,
array
()),
array
(
'SELECT "?" FROM foo WHERE bar = ?'
,
true
,
array
(
32
)),
array
(
"SELECT '?' FROM foo WHERE bar = ?"
,
true
,
array
(
32
)),
// named
array
(
'SELECT :foo FROM :bar'
,
false
,
array
(
':foo'
=>
array
(
7
),
':bar'
=>
array
(
17
))),
array
(
'SELECT * FROM Foo WHERE bar IN (:name1, :name2)'
,
false
,
array
(
':name1'
=>
array
(
32
),
':name2'
=>
array
(
40
))),
...
...
@@ -36,7 +36,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array
(
"SELECT ':foo' FROM Foo WHERE bar IN (:name1, :name2)"
,
false
,
array
(
':name1'
=>
array
(
37
),
':name2'
=>
array
(
45
))),
);
}
/**
* @dataProvider dataGetPlaceholderPositions
* @param type $query
...
...
@@ -48,7 +48,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
$actualParamPos
=
SQLParserUtils
::
getPlaceholderPositions
(
$query
,
$isPositional
);
$this
->
assertEquals
(
$expectedParamPos
,
$actualParamPos
);
}
static
public
function
dataExpandListParameters
()
{
return
array
(
...
...
@@ -106,7 +106,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array
(
1
),
array
(
\PDO
::
PARAM_INT
)
),
// Named parameters : Very simple with param int and string
array
(
"SELECT * FROM Foo WHERE foo = :foo AND bar = :bar"
,
...
...
@@ -116,7 +116,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
array
(
1
,
'Some String'
),
array
(
\PDO
::
PARAM_INT
,
\PDO
::
PARAM_STR
)
),
// Named parameters : Very simple with one needle
array
(
"SELECT * FROM Foo WHERE foo IN (:foo)"
,
...
...
@@ -182,7 +182,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
),
);
}
/**
* @dataProvider dataExpandListParameters
* @param type $q
...
...
@@ -195,7 +195,7 @@ class SQLParserUtilsTest extends \Doctrine\Tests\DbalTestCase
public
function
testExpandListParameters
(
$q
,
$p
,
$t
,
$expectedQuery
,
$expectedParams
,
$expectedTypes
)
{
list
(
$query
,
$params
,
$types
)
=
SQLParserUtils
::
expandListParameters
(
$q
,
$p
,
$t
);
$this
->
assertEquals
(
$expectedQuery
,
$query
,
"Query was not rewritten correctly."
);
$this
->
assertEquals
(
$expectedParams
,
$params
,
"Params dont match"
);
$this
->
assertEquals
(
$expectedTypes
,
$types
,
"Types dont match"
);
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
b066e54f
...
...
@@ -89,12 +89,12 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$schemaConfig
=
new
\Doctrine\DBAL\Schema\SchemaConfig
;
$table
=
new
Table
(
'bugdb'
,
array
(
'integerfield1'
=>
new
Column
(
'integerfield1'
,
Type
::
getType
(
'integer'
))));
$table
->
setSchemaConfig
(
$schemaConfig
);
$schema1
=
new
Schema
(
array
(
$table
),
array
(),
$schemaConfig
);
$schema2
=
new
Schema
(
array
(),
array
(),
$schemaConfig
);
$expected
=
new
SchemaDiff
(
array
(),
array
(),
array
(
'bugdb'
=>
$table
)
);
$this
->
assertEquals
(
$expected
,
Comparator
::
compareSchemas
(
$schema1
,
$schema2
)
);
}
...
...
@@ -200,7 +200,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$column1
->
setCustomSchemaOption
(
'foo'
,
'bar'
);
$column2
->
setCustomSchemaOption
(
'foo'
,
'bar'
);
$column1
->
setCustomSchemaOption
(
'foo1'
,
'bar1'
);
$column2
->
setCustomSchemaOption
(
'foo2'
,
'bar2'
);
...
...
@@ -518,7 +518,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$schemaB
->
createSequence
(
'Bar'
);
$schemaB
->
createSequence
(
'baz'
);
$schemaB
->
createSequence
(
'old'
);
$c
=
new
Comparator
();
$diff
=
$c
->
compare
(
$schemaA
,
$schemaB
);
...
...
@@ -612,7 +612,7 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$tableB
=
new
Table
(
"foo"
);
$tableB
->
addColumn
(
'baz'
,
'integer'
);
$c
=
new
Comparator
();
$tableDiff
=
$c
->
diffTable
(
$tableA
,
$tableB
);
...
...
@@ -668,8 +668,8 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
array
(
'logged_in_at'
),
array_keys
(
$tableDiff
->
addedColumns
));
$this
->
assertEquals
(
0
,
count
(
$tableDiff
->
removedColumns
));
}
/**
* @group DBAL-112
*/
...
...
@@ -677,14 +677,14 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
{
$schema
=
new
Schema
();
$sequence
=
$schema
->
createSequence
(
'baz'
);
$schemaNew
=
clone
$schema
;
/* @var $schemaNew Schema */
$schemaNew
->
getSequence
(
'baz'
)
->
setAllocationSize
(
20
);
$c
=
new
\Doctrine\DBAL\Schema\Comparator
;
$diff
=
$c
->
compare
(
$schema
,
$schemaNew
);
$this
->
assertSame
(
$diff
->
changedSequences
[
0
]
,
$schemaNew
->
getSequence
(
'baz'
));
}
...
...
tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
ArrayTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
BooleanTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/DBAL/Types/DateTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
DateTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
@@ -61,7 +61,7 @@ class DateTest extends \Doctrine\Tests\DbalTestCase
$this
->
assertEquals
(
'00:00:00'
,
$date
->
format
(
'H:i:s'
));
$this
->
assertEquals
(
'2009-11-01'
,
$date
->
format
(
'Y-m-d'
));
}
public
function
testInvalidDateFormatConversion
()
{
$this
->
setExpectedException
(
'Doctrine\DBAL\Types\ConversionException'
);
...
...
tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
DecimalTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
ObjectTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
SmallIntTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/DBAL/Types/StringTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
StringTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/DBAL/Types/TimeTest.php
View file @
b066e54f
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
TimeTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
tests/Doctrine/Tests/Mocks/DriverMock.php
View file @
b066e54f
...
...
@@ -13,7 +13,7 @@ class DriverMock implements \Doctrine\DBAL\Driver
{
return
new
DriverConnectionMock
();
}
/**
* Constructs the Sqlite PDO DSN.
*
...
...
tests/Doctrine/Tests/Mocks/HydratorMockStatement.php
View file @
b066e54f
...
...
@@ -10,8 +10,8 @@ namespace Doctrine\Tests\Mocks;
*/
class
HydratorMockStatement
implements
\Doctrine\DBAL\Driver\Statement
{
private
$_resultSet
;
private
$_resultSet
;
/**
* Creates a new mock statement that will serve the provided fake result set to clients.
*
...
...
@@ -21,7 +21,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
{
$this
->
_resultSet
=
$resultSet
;
}
/**
* Fetches all rows from the result set.
*
...
...
@@ -31,7 +31,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
{
return
$this
->
_resultSet
;
}
public
function
fetchColumn
(
$columnNumber
=
0
)
{
$row
=
current
(
$this
->
_resultSet
);
...
...
@@ -39,10 +39,10 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
$val
=
array_shift
(
$row
);
return
$val
!==
null
?
$val
:
false
;
}
/**
* Fetches the next row in the result set.
*
*
*/
public
function
fetch
(
$fetchStyle
=
null
)
{
...
...
@@ -50,7 +50,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
next
(
$this
->
_resultSet
);
return
$current
;
}
/**
* Closes the cursor, enabling the statement to be executed again.
*
...
...
@@ -60,13 +60,13 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
{
return
true
;
}
public
function
setResultSet
(
array
$resultSet
)
{
reset
(
$resultSet
);
$this
->
_resultSet
=
$resultSet
;
}
public
function
bindColumn
(
$column
,
&
$param
,
$type
=
null
)
{
}
...
...
@@ -78,7 +78,7 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
public
function
bindParam
(
$column
,
&
$variable
,
$type
=
null
,
$length
=
null
,
$driverOptions
=
array
())
{
}
public
function
columnCount
()
{
}
...
...
@@ -86,16 +86,16 @@ class HydratorMockStatement implements \Doctrine\DBAL\Driver\Statement
public
function
errorCode
()
{
}
public
function
errorInfo
()
{
}
public
function
execute
(
$params
=
array
())
{
}
public
function
rowCount
()
{
}
}
}
\ No newline at end of file
tests/Doctrine/Tests/Mocks/SchemaManagerMock.php
View file @
b066e54f
...
...
@@ -8,6 +8,6 @@ class SchemaManagerMock extends \Doctrine\DBAL\Schema\AbstractSchemaManager
{
parent
::
__construct
(
$conn
);
}
protected
function
_getPortableTableColumnDefinition
(
$tableColumn
)
{}
}
\ No newline at end of file
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