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
bf068443
Commit
bf068443
authored
Mar 17, 2019
by
Ahmed Abdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable two rules for phpcs
parent
26d35871
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
61 additions
and
8 deletions
+61
-8
AbstractMySQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
+8
-0
AbstractOracleDriver.php
lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php
+8
-0
AbstractPostgreSQLDriver.php
lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
+8
-0
DB2Statement.php
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
+6
-0
MysqliConnection.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
+2
-2
MysqliStatement.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
+3
-0
OCI8Statement.php
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
+2
-0
SQLAnywhereStatement.php
...Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
+6
-0
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+6
-6
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+3
-0
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+3
-0
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+3
-0
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+1
-0
phpcs.xml.dist
phpcs.xml.dist
+2
-0
No files found.
lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
View file @
bf068443
...
...
@@ -36,28 +36,34 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
return
new
Exception\LockWaitTimeoutException
(
$message
,
$exception
);
case
'1050'
:
return
new
Exception\TableExistsException
(
$message
,
$exception
);
case
'1051'
:
case
'1146'
:
return
new
Exception\TableNotFoundException
(
$message
,
$exception
);
case
'1216'
:
case
'1217'
:
case
'1451'
:
case
'1452'
:
case
'1701'
:
return
new
Exception\ForeignKeyConstraintViolationException
(
$message
,
$exception
);
case
'1062'
:
case
'1557'
:
case
'1569'
:
case
'1586'
:
return
new
Exception\UniqueConstraintViolationException
(
$message
,
$exception
);
case
'1054'
:
case
'1166'
:
case
'1611'
:
return
new
Exception\InvalidFieldNameException
(
$message
,
$exception
);
case
'1052'
:
case
'1060'
:
case
'1110'
:
return
new
Exception\NonUniqueFieldNameException
(
$message
,
$exception
);
case
'1064'
:
case
'1149'
:
case
'1287'
:
...
...
@@ -71,6 +77,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case
'1554'
:
case
'1626'
:
return
new
Exception\SyntaxErrorException
(
$message
,
$exception
);
case
'1044'
:
case
'1045'
:
case
'1046'
:
...
...
@@ -84,6 +91,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case
'2002'
:
case
'2005'
:
return
new
Exception\ConnectionException
(
$message
,
$exception
);
case
'1048'
:
case
'1121'
:
case
'1138'
:
...
...
lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php
View file @
bf068443
...
...
@@ -24,22 +24,30 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
case
'2299'
:
case
'38911'
:
return
new
Exception\UniqueConstraintViolationException
(
$message
,
$exception
);
case
'904'
:
return
new
Exception\InvalidFieldNameException
(
$message
,
$exception
);
case
'918'
:
case
'960'
:
return
new
Exception\NonUniqueFieldNameException
(
$message
,
$exception
);
case
'923'
:
return
new
Exception\SyntaxErrorException
(
$message
,
$exception
);
case
'942'
:
return
new
Exception\TableNotFoundException
(
$message
,
$exception
);
case
'955'
:
return
new
Exception\TableExistsException
(
$message
,
$exception
);
case
'1017'
:
case
'12545'
:
return
new
Exception\ConnectionException
(
$message
,
$exception
);
case
'1400'
:
return
new
Exception\NotNullConstraintViolationException
(
$message
,
$exception
);
case
'2266'
:
case
'2291'
:
case
'2292'
:
...
...
lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
View file @
bf068443
...
...
@@ -43,20 +43,28 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
break
;
case
'23502'
:
return
new
Exception\NotNullConstraintViolationException
(
$message
,
$exception
);
case
'23503'
:
return
new
Exception\ForeignKeyConstraintViolationException
(
$message
,
$exception
);
case
'23505'
:
return
new
Exception\UniqueConstraintViolationException
(
$message
,
$exception
);
case
'42601'
:
return
new
Exception\SyntaxErrorException
(
$message
,
$exception
);
case
'42702'
:
return
new
Exception\NonUniqueFieldNameException
(
$message
,
$exception
);
case
'42703'
:
return
new
Exception\InvalidFieldNameException
(
$message
,
$exception
);
case
'42P01'
:
return
new
Exception\TableNotFoundException
(
$message
,
$exception
);
case
'42P07'
:
return
new
Exception\TableExistsException
(
$message
,
$exception
);
case
'7'
:
// In some case (mainly connection errors) the PDO exception does not provide a SQLSTATE via its code.
// The exception code is always set to 7 here.
...
...
lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
View file @
bf068443
...
...
@@ -261,10 +261,13 @@ class DB2Statement implements IteratorAggregate, Statement
switch
(
$fetchMode
)
{
case
FetchMode
::
COLUMN
:
return
$this
->
fetchColumn
();
case
FetchMode
::
MIXED
:
return
db2_fetch_both
(
$this
->
stmt
);
case
FetchMode
::
ASSOCIATIVE
:
return
db2_fetch_assoc
(
$this
->
stmt
);
case
FetchMode
::
CUSTOM_OBJECT
:
$className
=
$this
->
defaultFetchClass
;
$ctorArgs
=
$this
->
defaultFetchClassCtorArgs
;
...
...
@@ -282,10 +285,13 @@ class DB2Statement implements IteratorAggregate, Statement
}
return
$result
;
case
FetchMode
::
NUMERIC
:
return
db2_fetch_array
(
$this
->
stmt
);
case
FetchMode
::
STANDARD_OBJECT
:
return
db2_fetch_object
(
$this
->
stmt
);
default
:
throw
new
DB2Exception
(
'Given Fetch-Style '
.
$fetchMode
.
' is not supported.'
);
}
...
...
lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
View file @
bf068443
...
...
@@ -57,7 +57,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$socket
=
$params
[
'unix_socket'
]
??
ini_get
(
'mysqli.default_socket'
);
$dbname
=
$params
[
'dbname'
]
??
null
;
$flags
=
$driverOptions
[
s
elf
::
OPTION_FLAGS
]
??
null
;
$flags
=
$driverOptions
[
s
tatic
::
OPTION_FLAGS
]
??
null
;
$this
->
conn
=
mysqli_init
();
...
...
@@ -239,7 +239,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$exceptionMsg
=
"%s option '%s' with value '%s'"
;
foreach
(
$driverOptions
as
$option
=>
$value
)
{
if
(
$option
===
s
elf
::
OPTION_FLAGS
)
{
if
(
$option
===
s
tatic
::
OPTION_FLAGS
)
{
continue
;
}
...
...
lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
View file @
bf068443
...
...
@@ -338,10 +338,13 @@ class MysqliStatement implements IteratorAggregate, Statement
switch
(
$fetchMode
)
{
case
FetchMode
::
ASSOCIATIVE
:
return
$assoc
;
case
FetchMode
::
MIXED
:
return
$assoc
+
$values
;
case
FetchMode
::
STANDARD_OBJECT
:
return
(
object
)
$assoc
;
default
:
throw
new
MysqliException
(
sprintf
(
"Unknown fetch type '%s'"
,
$fetchMode
));
}
...
...
lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
View file @
bf068443
...
...
@@ -306,8 +306,10 @@ class OCI8Statement implements IteratorAggregate, Statement
switch
(
$type
)
{
case
ParameterType
::
BINARY
:
return
OCI_B_BIN
;
case
ParameterType
::
LARGE_OBJECT
:
return
OCI_B_BLOB
;
default
:
return
SQLT_CHR
;
}
...
...
lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
View file @
bf068443
...
...
@@ -210,10 +210,13 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
switch
(
$fetchMode
)
{
case
FetchMode
::
COLUMN
:
return
$this
->
fetchColumn
();
case
FetchMode
::
ASSOCIATIVE
:
return
sasql_fetch_assoc
(
$this
->
result
);
case
FetchMode
::
MIXED
:
return
sasql_fetch_array
(
$this
->
result
,
SASQL_BOTH
);
case
FetchMode
::
CUSTOM_OBJECT
:
$className
=
$this
->
defaultFetchClass
;
$ctorArgs
=
$this
->
defaultFetchClassCtorArgs
;
...
...
@@ -231,10 +234,13 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
}
return
$result
;
case
FetchMode
::
NUMERIC
:
return
sasql_fetch_row
(
$this
->
result
);
case
FetchMode
::
STANDARD_OBJECT
:
return
sasql_fetch_object
(
$this
->
result
);
default
:
throw
new
SQLAnywhereException
(
'Fetch mode is not supported: '
.
$fetchMode
);
}
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
bf068443
...
...
@@ -247,15 +247,15 @@ class MySqlPlatform extends AbstractPlatform
if
(
!
empty
(
$field
[
'length'
])
&&
is_numeric
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
if
(
$length
<=
s
elf
::
LENGTH_LIMIT_TINYTEXT
)
{
if
(
$length
<=
s
tatic
::
LENGTH_LIMIT_TINYTEXT
)
{
return
'TINYTEXT'
;
}
if
(
$length
<=
s
elf
::
LENGTH_LIMIT_TEXT
)
{
if
(
$length
<=
s
tatic
::
LENGTH_LIMIT_TEXT
)
{
return
'TEXT'
;
}
if
(
$length
<=
s
elf
::
LENGTH_LIMIT_MEDIUMTEXT
)
{
if
(
$length
<=
s
tatic
::
LENGTH_LIMIT_MEDIUMTEXT
)
{
return
'MEDIUMTEXT'
;
}
}
...
...
@@ -1137,15 +1137,15 @@ SQL
if
(
!
empty
(
$field
[
'length'
])
&&
is_numeric
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
if
(
$length
<=
s
elf
::
LENGTH_LIMIT_TINYBLOB
)
{
if
(
$length
<=
s
tatic
::
LENGTH_LIMIT_TINYBLOB
)
{
return
'TINYBLOB'
;
}
if
(
$length
<=
s
elf
::
LENGTH_LIMIT_BLOB
)
{
if
(
$length
<=
s
tatic
::
LENGTH_LIMIT_BLOB
)
{
return
'BLOB'
;
}
if
(
$length
<=
s
elf
::
LENGTH_LIMIT_MEDIUMBLOB
)
{
if
(
$length
<=
s
tatic
::
LENGTH_LIMIT_MEDIUMBLOB
)
{
return
'MEDIUMBLOB'
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
bf068443
...
...
@@ -114,6 +114,7 @@ class OraclePlatform extends AbstractPlatform
}
return
'ADD_MONTHS('
.
$date
.
', '
.
$operator
.
$interval
.
')'
;
default
:
$calculationClause
=
''
;
...
...
@@ -742,9 +743,11 @@ SQL
// NO ACTION cannot be declared explicitly,
// therefore returning empty string to indicate to OMIT the referential clause.
return
''
;
case
'CASCADE'
:
case
'SET NULL'
:
return
$action
;
default
:
// SET DEFAULT is not supported, throw exception instead.
throw
new
InvalidArgumentException
(
'Invalid foreign key action: '
.
$action
);
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
bf068443
...
...
@@ -49,10 +49,13 @@ class SQLAnywherePlatform extends AbstractPlatform
switch
(
true
)
{
case
$lockMode
===
LockMode
::
NONE
:
return
$fromClause
.
' WITH (NOLOCK)'
;
case
$lockMode
===
LockMode
::
PESSIMISTIC_READ
:
return
$fromClause
.
' WITH (UPDLOCK)'
;
case
$lockMode
===
LockMode
::
PESSIMISTIC_WRITE
:
return
$fromClause
.
' WITH (XLOCK)'
;
default
:
return
$fromClause
;
}
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
bf068443
...
...
@@ -1548,10 +1548,13 @@ SQL
switch
(
true
)
{
case
$lockMode
===
LockMode
::
NONE
:
return
$fromClause
.
' WITH (NOLOCK)'
;
case
$lockMode
===
LockMode
::
PESSIMISTIC_READ
:
return
$fromClause
.
' WITH (HOLDLOCK, ROWLOCK)'
;
case
$lockMode
===
LockMode
::
PESSIMISTIC_WRITE
:
return
$fromClause
.
' WITH (UPDLOCK, ROWLOCK)'
;
default
:
return
$fromClause
;
}
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
bf068443
...
...
@@ -128,6 +128,7 @@ class SqlitePlatform extends AbstractPlatform
case
DateIntervalUnit
::
MINUTE
:
case
DateIntervalUnit
::
HOUR
:
return
'DATETIME('
.
$date
.
",'"
.
$operator
.
$interval
.
' '
.
$unit
.
"')"
;
default
:
switch
(
$unit
)
{
case
DateIntervalUnit
::
WEEK
:
...
...
phpcs.xml.dist
View file @
bf068443
...
...
@@ -19,6 +19,8 @@
<exclude
name=
"SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"
/>
<exclude
name=
"SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"
/>
<exclude
name=
"SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"
/>
<exclude
name=
"SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"
/>
<exclude
name=
"SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"
/>
</rule>
<rule
ref=
"PSR1.Classes.ClassDeclaration.MultipleClasses"
>
...
...
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