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
33430b01
Commit
33430b01
authored
Apr 30, 2015
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix retrieving the database name connected to for SQL Anywhere
parent
ded8e089
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
AbstractSQLAnywhereDriver.php
lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php
+5
-1
DriverTest.php
...e/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php
+48
-0
No files found.
lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php
View file @
33430b01
...
...
@@ -116,7 +116,11 @@ abstract class AbstractSQLAnywhereDriver implements Driver, ExceptionConverterDr
{
$params
=
$conn
->
getParams
();
return
$params
[
'dbname'
];
if
(
isset
(
$params
[
'dbname'
]))
{
return
$params
[
'dbname'
];
}
return
$conn
->
query
(
'SELECT DB_NAME()'
)
->
fetchColumn
();
}
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php
0 → 100644
View file @
33430b01
<?php
namespace
Doctrine\Tests\DBAL\Functional\Driver\SQLAnywhere
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Driver\SQLAnywhere\Driver
;
use
Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest
;
class
DriverTest
extends
AbstractDriverTest
{
protected
function
setUp
()
{
if
(
!
extension_loaded
(
'sqlanywhere'
))
{
$this
->
markTestSkipped
(
'sqlanywhere is not installed.'
);
}
parent
::
setUp
();
if
(
!
$this
->
_conn
->
getDriver
()
instanceof
Driver
)
{
$this
->
markTestSkipped
(
'sqlanywhere only test.'
);
}
}
public
function
testReturnsDatabaseNameWithoutDatabaseNameParameter
()
{
$params
=
$this
->
_conn
->
getParams
();
unset
(
$params
[
'dbname'
]);
$connection
=
new
Connection
(
$params
,
$this
->
_conn
->
getDriver
(),
$this
->
_conn
->
getConfiguration
(),
$this
->
_conn
->
getEventManager
()
);
// SQL Anywhere has no "default" database. The name of the default database
// is defined on server startup and therefore can be arbitrary.
$this
->
assertInternalType
(
'string'
,
$this
->
driver
->
getDatabase
(
$connection
));
}
/**
* {@inheritdoc}
*/
protected
function
createDriver
()
{
return
new
Driver
();
}
}
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