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
c69c0c5d
Commit
c69c0c5d
authored
Oct 08, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for persistent connections, fixes #447
parent
9a0ef8e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
Connection.php
lib/Doctrine/Connection.php
+9
-1
Manager.php
lib/Doctrine/Manager.php
+20
-2
No files found.
lib/Doctrine/Connection.php
View file @
c69c0c5d
...
...
@@ -177,6 +177,12 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
$this
->
options
[
'dsn'
]
=
$adapter
[
'dsn'
];
$this
->
options
[
'username'
]
=
$adapter
[
'user'
];
$this
->
options
[
'password'
]
=
$adapter
[
'pass'
];
$this
->
options
[
'other'
]
=
array
();
if
(
isset
(
$adapter
[
'other'
]))
{
$this
->
options
[
'other'
]
=
array
(
Doctrine
::
ATTR_PERSISTENT
=>
$adapter
[
'persistent'
]);
}
}
$this
->
setParent
(
$manager
);
...
...
@@ -336,7 +342,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
if
(
extension_loaded
(
'pdo'
))
{
if
(
in_array
(
$e
[
0
],
PDO
::
getAvailableDrivers
()))
{
$this
->
dbh
=
new
PDO
(
$this
->
options
[
'dsn'
],
$this
->
options
[
'username'
],
$this
->
options
[
'password'
]);
$this
->
dbh
=
new
PDO
(
$this
->
options
[
'dsn'
],
$this
->
options
[
'username'
],
$this
->
options
[
'password'
],
$this
->
options
[
'other'
]);
$this
->
dbh
->
setAttribute
(
PDO
::
ATTR_ERRMODE
,
PDO
::
ERRMODE_EXCEPTION
);
$found
=
true
;
}
...
...
lib/Doctrine/Manager.php
View file @
c69c0c5d
...
...
@@ -231,8 +231,13 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
public
function
openConnection
(
$adapter
,
$name
=
null
,
$setCurrent
=
true
)
{
if
(
is_object
(
$adapter
))
{
if
(
!
(
$adapter
instanceof
PDO
)
&&
!
in_array
(
'Doctrine_Adapter_Interface'
,
class_implements
(
$adapter
)))
{
throw
new
Doctrine_Manager_Exception
(
"First argument should be an instance of PDO or implement Doctrine_Adapter_Interface"
);
if
(
!
(
$adapter
instanceof
PDO
)
&&
!
in_array
(
'Doctrine_Adapter_Interface'
,
class_implements
(
$adapter
)))
{
$msg
=
'First argument should be an instance of PDO or '
.
'implement Doctrine_Adapter_Interface'
;
throw
new
Doctrine_Manager_Exception
(
$msg
);
}
$driverName
=
$adapter
->
getAttribute
(
Doctrine
::
ATTR_DRIVER_NAME
);
...
...
@@ -369,6 +374,19 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
// append port to dsn if supplied
$parts
[
'dsn'
]
.=
';port='
.
$parts
[
'port'
];
}
$options
=
array
();
if
(
isset
(
$parts
[
'query'
])
&&
$parts
[
'query'
]
!=
null
)
{
// parse options
parse_str
(
$parts
[
'query'
],
$options
);
}
if
(
isset
(
$options
[
'persistent'
]))
{
// set persistent
$parts
[
'persistent'
]
=
(
bool
)
$options
[
'persistent'
];
}
break
;
default
:
throw
new
Doctrine_Manager_Exception
(
'Unknown driver '
.
$parts
[
'scheme'
]);
...
...
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