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
6de4aeae
Unverified
Commit
6de4aeae
authored
Jun 26, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add OCI8\Exception\Error
parent
a77c0074
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
20 deletions
+63
-20
ConnectionFailed.php
src/Driver/OCI8/Exception/ConnectionFailed.php
+26
-0
Error.php
src/Driver/OCI8/Exception/Error.php
+29
-0
OCI8Connection.php
src/Driver/OCI8/OCI8Connection.php
+6
-5
OCI8Exception.php
src/Driver/OCI8/OCI8Exception.php
+0
-13
OCI8Statement.php
src/Driver/OCI8/OCI8Statement.php
+2
-2
No files found.
src/Driver/OCI8/Exception/ConnectionFailed.php
0 → 100644
View file @
6de4aeae
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Driver\OCI8\Exception
;
use
Doctrine\DBAL\Driver\OCI8\OCI8Exception
;
use
function
assert
;
use
function
oci_error
;
/**
* @internal
*
* @psalm-immutable
*/
final
class
ConnectionFailed
extends
OCI8Exception
{
public
static
function
new
()
:
self
{
$error
=
oci_error
();
assert
(
$error
!==
false
);
return
new
self
(
$error
[
'message'
],
null
,
$error
[
'code'
]);
}
}
src/Driver/OCI8/Exception/Error.php
0 → 100644
View file @
6de4aeae
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Driver\OCI8\Exception
;
use
Doctrine\DBAL\Driver\OCI8\OCI8Exception
;
use
function
assert
;
use
function
oci_error
;
/**
* @internal
*
* @psalm-immutable
*/
final
class
Error
extends
OCI8Exception
{
/**
* @param resource $resource
*/
public
static
function
new
(
$resource
)
:
self
{
$error
=
oci_error
(
$resource
);
assert
(
$error
!==
false
);
return
new
self
(
$error
[
'message'
],
null
,
$error
[
'code'
]);
}
}
src/Driver/OCI8/OCI8Connection.php
View file @
6de4aeae
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
Doctrine\DBAL\Driver\OCI8
;
namespace
Doctrine\DBAL\Driver\OCI8
;
use
Doctrine\DBAL\Driver\Connection
as
ConnectionInterface
;
use
Doctrine\DBAL\Driver\Connection
as
ConnectionInterface
;
use
Doctrine\DBAL\Driver\OCI8\Exception\ConnectionFailed
;
use
Doctrine\DBAL\Driver\OCI8\Exception\Error
;
use
Doctrine\DBAL\Driver\OCI8\Exception\SequenceDoesNotExist
;
use
Doctrine\DBAL\Driver\OCI8\Exception\SequenceDoesNotExist
;
use
Doctrine\DBAL\Driver\Result
as
ResultInterface
;
use
Doctrine\DBAL\Driver\Result
as
ResultInterface
;
use
Doctrine\DBAL\Driver\ServerInfoAwareConnection
;
use
Doctrine\DBAL\Driver\ServerInfoAwareConnection
;
...
@@ -15,7 +17,6 @@ use function is_float;
...
@@ -15,7 +17,6 @@ use function is_float;
use
function
is_int
;
use
function
is_int
;
use
function
oci_commit
;
use
function
oci_commit
;
use
function
oci_connect
;
use
function
oci_connect
;
use
function
oci_error
;
use
function
oci_pconnect
;
use
function
oci_pconnect
;
use
function
oci_rollback
;
use
function
oci_rollback
;
use
function
oci_server_version
;
use
function
oci_server_version
;
...
@@ -63,7 +64,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
...
@@ -63,7 +64,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
:
@
oci_connect
(
$username
,
$password
,
$db
,
$charset
,
$sessionMode
);
:
@
oci_connect
(
$username
,
$password
,
$db
,
$charset
,
$sessionMode
);
if
(
$dbh
===
false
)
{
if
(
$dbh
===
false
)
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
()
);
throw
ConnectionFailed
::
new
(
);
}
}
$this
->
dbh
=
$dbh
;
$this
->
dbh
=
$dbh
;
...
@@ -81,7 +82,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
...
@@ -81,7 +82,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
$version
=
oci_server_version
(
$this
->
dbh
);
$version
=
oci_server_version
(
$this
->
dbh
);
if
(
$version
===
false
)
{
if
(
$version
===
false
)
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
dbh
)
);
throw
Error
::
new
(
$this
->
dbh
);
}
}
if
(
preg_match
(
'/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/'
,
$version
,
$matches
)
===
0
)
{
if
(
preg_match
(
'/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/'
,
$version
,
$matches
)
===
0
)
{
...
@@ -162,7 +163,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
...
@@ -162,7 +163,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
public
function
commit
()
public
function
commit
()
{
{
if
(
!
oci_commit
(
$this
->
dbh
))
{
if
(
!
oci_commit
(
$this
->
dbh
))
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
dbh
)
);
throw
Error
::
new
(
$this
->
dbh
);
}
}
$this
->
executionMode
->
enableAutoCommit
();
$this
->
executionMode
->
enableAutoCommit
();
...
@@ -176,7 +177,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
...
@@ -176,7 +177,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
public
function
rollBack
()
public
function
rollBack
()
{
{
if
(
!
oci_rollback
(
$this
->
dbh
))
{
if
(
!
oci_rollback
(
$this
->
dbh
))
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
dbh
)
);
throw
Error
::
new
(
$this
->
dbh
);
}
}
$this
->
executionMode
->
enableAutoCommit
();
$this
->
executionMode
->
enableAutoCommit
();
...
...
src/Driver/OCI8/OCI8Exception.php
View file @
6de4aeae
...
@@ -11,17 +11,4 @@ use Doctrine\DBAL\Driver\AbstractDriverException;
...
@@ -11,17 +11,4 @@ use Doctrine\DBAL\Driver\AbstractDriverException;
*/
*/
class
OCI8Exception
extends
AbstractDriverException
class
OCI8Exception
extends
AbstractDriverException
{
{
/**
* @param mixed[]|false $error
*
* @return OCI8Exception
*/
public
static
function
fromErrorInfo
(
$error
)
{
if
(
$error
===
false
)
{
return
new
self
(
'Database error occurred but no error information was retrieved from the driver.'
);
}
return
new
self
(
$error
[
'message'
],
null
,
$error
[
'code'
]);
}
}
}
src/Driver/OCI8/OCI8Statement.php
View file @
6de4aeae
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Doctrine\DBAL\Driver\OCI8
;
namespace
Doctrine\DBAL\Driver\OCI8
;
use
Doctrine\DBAL\Driver\OCI8\Exception\Error
;
use
Doctrine\DBAL\Driver\OCI8\Exception\UnknownParameterIndex
;
use
Doctrine\DBAL\Driver\OCI8\Exception\UnknownParameterIndex
;
use
Doctrine\DBAL\Driver\Result
as
ResultInterface
;
use
Doctrine\DBAL\Driver\Result
as
ResultInterface
;
use
Doctrine\DBAL\Driver\Statement
as
StatementInterface
;
use
Doctrine\DBAL\Driver\Statement
as
StatementInterface
;
...
@@ -11,7 +12,6 @@ use function assert;
...
@@ -11,7 +12,6 @@ use function assert;
use
function
is_int
;
use
function
is_int
;
use
function
is_resource
;
use
function
is_resource
;
use
function
oci_bind_by_name
;
use
function
oci_bind_by_name
;
use
function
oci_error
;
use
function
oci_execute
;
use
function
oci_execute
;
use
function
oci_new_descriptor
;
use
function
oci_new_descriptor
;
use
function
oci_parse
;
use
function
oci_parse
;
...
@@ -156,7 +156,7 @@ class OCI8Statement implements StatementInterface
...
@@ -156,7 +156,7 @@ class OCI8Statement implements StatementInterface
$ret
=
@
oci_execute
(
$this
->
_sth
,
$mode
);
$ret
=
@
oci_execute
(
$this
->
_sth
,
$mode
);
if
(
!
$ret
)
{
if
(
!
$ret
)
{
throw
OCI8Exception
::
fromErrorInfo
(
oci_error
(
$this
->
_sth
)
);
throw
Error
::
new
(
$this
->
_sth
);
}
}
return
new
Result
(
$this
->
_sth
);
return
new
Result
(
$this
->
_sth
);
...
...
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