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
470cde99
Commit
470cde99
authored
Jan 18, 2015
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make host and server connection parameters optional for sqlanywhere driver
parent
06e64e27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
Driver.php
lib/Doctrine/DBAL/Driver/SQLAnywhere/Driver.php
+9
-13
No files found.
lib/Doctrine/DBAL/Driver/SQLAnywhere/Driver.php
View file @
470cde99
...
@@ -35,24 +35,15 @@ class Driver extends AbstractSQLAnywhereDriver
...
@@ -35,24 +35,15 @@ class Driver extends AbstractSQLAnywhereDriver
* {@inheritdoc}
* {@inheritdoc}
*
*
* @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
* @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
* @throws SQLAnywhereException if a mandatory connection parameter is missing.
*/
*/
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
{
{
if
(
!
isset
(
$params
[
'host'
]))
{
throw
new
SQLAnywhereException
(
"Missing 'host' in configuration for sqlanywhere driver."
);
}
if
(
!
isset
(
$params
[
'server'
]))
{
throw
new
SQLAnywhereException
(
"Missing 'server' in configuration for sqlanywhere driver."
);
}
try
{
try
{
return
new
SQLAnywhereConnection
(
return
new
SQLAnywhereConnection
(
$this
->
buildDsn
(
$this
->
buildDsn
(
$params
[
'host'
]
,
isset
(
$params
[
'host'
])
?
$params
[
'host'
]
:
null
,
isset
(
$params
[
'port'
])
?
$params
[
'port'
]
:
null
,
isset
(
$params
[
'port'
])
?
$params
[
'port'
]
:
null
,
$params
[
'server'
]
,
isset
(
$params
[
'server'
])
?
$params
[
'server'
]
:
null
,
isset
(
$params
[
'dbname'
])
?
$params
[
'dbname'
]
:
null
,
isset
(
$params
[
'dbname'
])
?
$params
[
'dbname'
]
:
null
,
$username
,
$username
,
$password
,
$password
,
...
@@ -90,11 +81,16 @@ class Driver extends AbstractSQLAnywhereDriver
...
@@ -90,11 +81,16 @@ class Driver extends AbstractSQLAnywhereDriver
*/
*/
private
function
buildDsn
(
$host
,
$port
,
$server
,
$dbname
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
private
function
buildDsn
(
$host
,
$port
,
$server
,
$dbname
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
{
{
$host
=
$host
?:
'localhost'
;
$port
=
$port
?:
2638
;
$port
=
$port
?:
2638
;
if
(
!
empty
(
$server
))
{
$server
=
';ServerName='
.
$server
;
}
return
return
'
LINKS=tcpip(HOST='
.
$host
.
';PORT='
.
$port
.
';DoBroadcast=Direct)'
.
'
HOST='
.
$host
.
':'
.
$port
.
';ServerName='
.
$server
.
$server
.
';DBN='
.
$dbname
.
';DBN='
.
$dbname
.
';UID='
.
$username
.
';UID='
.
$username
.
';PWD='
.
$password
.
';PWD='
.
$password
.
...
...
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