Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
b6b91c04
Commit
b6b91c04
authored
11 years ago
by
Andy Yates
Browse files
Options
Downloads
Patches
Plain Diff
Adding aliases in for user, hostname and pass because this drives me crazy once a month.
parent
8f76cc83
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
+43
-0
43 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
modules/t/dbConnection.t
+8
-0
8 additions, 0 deletions
modules/t/dbConnection.t
with
51 additions
and
0 deletions
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
+
43
−
0
View file @
b6b91c04
...
...
@@ -526,6 +526,21 @@ sub username {
$self
->
{
_username
};
}
=head2 user
Arg [1] : (optional) string $arg
The new value of the username used by this connection.
Example : $user = $db_connection->user()
Description: Convenience alias for the username method
Returntype : String
=cut
sub
user
{
my
(
$self
,
$arg
)
=
@_
;
return
$self
->
username
(
$arg
);
}
=head2 host
...
...
@@ -550,6 +565,21 @@ sub host {
$self
->
{
_host
};
}
=head2 hostname
Arg [1] : (optional) string $arg
The new value of the host used by this connection.
Example : $hostname = $db_connection->hostname()
Description: Convenience alias for the host method
Returntype : String
=cut
sub
hostname
{
my
(
$self
,
$arg
)
=
@_
;
return
$self
->
host
(
$arg
);
}
=head2 password
...
...
@@ -582,7 +612,20 @@ sub password {
return
(
ref
(
$self
->
{
_password
}
)
&&
&
{
$self
->
{
_password
}
}
)
||
'';
}
=head2 pass
Arg [1] : (optional) string $arg
The new value of the password used by this connection.
Example : $pass = $db_connection->pass()
Description: Convenience alias for the password method
Returntype : String
=cut
sub
pass
{
my
(
$self
,
$arg
)
=
@_
;
return
$self
->
password
(
$arg
);
}
=head2 disconnect_when_inactive
...
...
This diff is collapsed.
Click to expand it.
modules/t/dbConnection.t
+
8
−
0
View file @
b6b91c04
...
...
@@ -79,17 +79,25 @@ ok(test_getter_setter($dbc, 'dbname' , 'ensembl_db_name'));
# 6 username
#
ok
(
test_getter_setter
(
$dbc
,
'
username
',
'
ensembl_user
'));
is
(
$dbc
->
user
(),
$dbc
->
username
(),
'
Checking user() returns same as username()
');
#
# 7 password
#
ok
(
test_getter_setter
(
$dbc
,
'
password
',
'
ensembl_password
'));
is
(
$dbc
->
pass
(),
$dbc
->
password
(),
'
Checking pass() returns same as password()
');
#
# 10 dbhandle
#
ok
(
test_getter_setter
(
$dbc
,
'
db_handle
',
$dbc
->
db_handle
));
#
# dbname
#
ok
(
test_getter_setter
(
$dbc
,
'
host
',
$dbc
->
host
));
is
(
$dbc
->
hostname
(),
$dbc
->
host
(),
'
Checking hostname() returns same as host()
');
# Check the to_hash() works
is_deeply
(
$dbc
->
to_hash
(),
\
%dbc_args
,
'
Checking to_hash() can roundtrip a DBConnection
');
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment