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
2422fedd
Unverified
Commit
2422fedd
authored
Jun 28, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse Mysqli\UnknownType as Exception\UnknownParameterType for other drivers
parent
bb9f47f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
UnknownParameterType.php
src/Driver/Exception/UnknownParameterType.php
+3
-3
Statement.php
src/Driver/Mysqli/Statement.php
+3
-3
Statement.php
src/Driver/PDO/Statement.php
+5
-2
No files found.
src/Driver/
Mysqli/Exception/Unknown
Type.php
→
src/Driver/
Exception/UnknownParameter
Type.php
View file @
2422fedd
...
...
@@ -2,7 +2,7 @@
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Driver\
Mysqli\
Exception
;
namespace
Doctrine\DBAL\Driver\Exception
;
use
Doctrine\DBAL\Driver\AbstractException
;
...
...
@@ -13,13 +13,13 @@ use function sprintf;
*
* @psalm-immutable
*/
final
class
UnknownType
extends
AbstractException
final
class
Unknown
Parameter
Type
extends
AbstractException
{
/**
* @param mixed $type
*/
public
static
function
new
(
$type
)
:
self
{
return
new
self
(
sprintf
(
'Unknown type, %d given.'
,
$type
));
return
new
self
(
sprintf
(
'Unknown
parameter
type, %d given.'
,
$type
));
}
}
src/Driver/Mysqli/Statement.php
View file @
2422fedd
...
...
@@ -3,10 +3,10 @@
namespace
Doctrine\DBAL\Driver\Mysqli
;
use
Doctrine\DBAL\Driver\Exception
;
use
Doctrine\DBAL\Driver\Exception\UnknownParameterType
;
use
Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError
;
use
Doctrine\DBAL\Driver\Mysqli\Exception\FailedReadingStreamOffset
;
use
Doctrine\DBAL\Driver\Mysqli\Exception\StatementError
;
use
Doctrine\DBAL\Driver\Mysqli\Exception\UnknownType
;
use
Doctrine\DBAL\Driver\Result
as
ResultInterface
;
use
Doctrine\DBAL\Driver\Statement
as
StatementInterface
;
use
Doctrine\DBAL\Exception\InvalidArgumentException
;
...
...
@@ -91,7 +91,7 @@ final class Statement implements StatementInterface
assert
(
is_int
(
$column
));
if
(
!
isset
(
self
::
$_paramTypeMap
[
$type
]))
{
throw
UnknownType
::
new
(
$type
);
throw
Unknown
Parameter
Type
::
new
(
$type
);
}
$this
->
_bindedValues
[
$column
]
=&
$variable
;
...
...
@@ -108,7 +108,7 @@ final class Statement implements StatementInterface
assert
(
is_int
(
$param
));
if
(
!
isset
(
self
::
$_paramTypeMap
[
$type
]))
{
throw
UnknownType
::
new
(
$type
);
throw
Unknown
Parameter
Type
::
new
(
$type
);
}
$this
->
_values
[
$param
]
=
$value
;
...
...
src/Driver/PDO/Statement.php
View file @
2422fedd
...
...
@@ -2,10 +2,11 @@
namespace
Doctrine\DBAL\Driver\PDO
;
use
Doctrine\DBAL\Driver\Exception
as
ExceptionInterface
;
use
Doctrine\DBAL\Driver\Exception\UnknownParameterType
;
use
Doctrine\DBAL\Driver\Result
as
ResultInterface
;
use
Doctrine\DBAL\Driver\Statement
as
StatementInterface
;
use
Doctrine\DBAL\ParameterType
;
use
InvalidArgumentException
;
use
PDO
;
use
PDOException
;
use
PDOStatement
;
...
...
@@ -89,11 +90,13 @@ class Statement implements StatementInterface
* Converts DBAL parameter type to PDO parameter type
*
* @param int $type Parameter type
*
* @throws ExceptionInterface
*/
private
function
convertParamType
(
int
$type
)
:
int
{
if
(
!
isset
(
self
::
PARAM_TYPE_MAP
[
$type
]))
{
throw
new
InvalidArgumentException
(
'Invalid parameter type: '
.
$type
);
throw
UnknownParameterType
::
new
(
$type
);
}
return
self
::
PARAM_TYPE_MAP
[
$type
];
...
...
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