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
57186d5c
Commit
57186d5c
authored
Jun 26, 2014
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #525 from marcini/master
Added flags support for mysqli::real_connect in Mysqli driver.
parents
8f2fbf11
c55e891a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
MysqliConnection.php
lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
+12
-1
No files found.
lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
View file @
57186d5c
...
...
@@ -29,6 +29,11 @@ use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
*/
class
MysqliConnection
implements
Connection
,
PingableConnection
,
ServerInfoAwareConnection
{
/**
* Name of the option to set connection flags
*/
const
OPTION_FLAGS
=
'flags'
;
/**
* @var \mysqli
*/
...
...
@@ -47,6 +52,8 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$port
=
isset
(
$params
[
'port'
])
?
$params
[
'port'
]
:
ini_get
(
'mysqli.default_port'
);
$socket
=
isset
(
$params
[
'unix_socket'
])
?
$params
[
'unix_socket'
]
:
ini_get
(
'mysqli.default_socket'
);
$flags
=
isset
(
$driverOptions
[
static
::
OPTION_FLAGS
])
?
$driverOptions
[
static
::
OPTION_FLAGS
]
:
null
;
$this
->
_conn
=
mysqli_init
();
$this
->
setDriverOptions
(
$driverOptions
);
...
...
@@ -54,7 +61,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$previousHandler
=
set_error_handler
(
function
()
{
});
if
(
!
$this
->
_conn
->
real_connect
(
$params
[
'host'
],
$username
,
$password
,
$params
[
'dbname'
],
$port
,
$socket
))
{
if
(
!
$this
->
_conn
->
real_connect
(
$params
[
'host'
],
$username
,
$password
,
$params
[
'dbname'
],
$port
,
$socket
,
$flags
))
{
set_error_handler
(
$previousHandler
);
$sqlState
=
'HY000'
;
...
...
@@ -216,6 +223,10 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
foreach
(
$driverOptions
as
$option
=>
$value
)
{
if
(
$option
===
static
::
OPTION_FLAGS
)
{
continue
;
}
if
(
!
in_array
(
$option
,
$supportedDriverOptions
,
true
))
{
throw
new
MysqliException
(
sprintf
(
$exceptionMsg
,
'Unsupported'
,
$option
,
$value
)
...
...
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