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
92866f59
Commit
92866f59
authored
6 years ago
by
Mark McDowall
Browse files
Options
Downloads
Patches
Plain Diff
Added further details to the pod and modified the checking for the status of the db_handle
parent
40580867
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!358
Added prepare_cached as a wrapper to the DBConnect.pm module
,
!358
Added prepare_cached as a wrapper to the DBConnect.pm module
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
+14
-7
14 additions, 7 deletions
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
with
14 additions
and
7 deletions
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
+
14
−
7
View file @
92866f59
...
...
@@ -722,6 +722,13 @@ sub prepare {
Description: Prepares a SQL statement using the internal DBI database handle
and returns the DBI statement handle. The prepared statement is
cached so that it does not have to be prepared again.
When using this function it is important to ensure either
completel retrieval of all information from the request when
performing execute() or call finish(). An Active error will be
raised if there are currently active handles
For further information please consult https://metacpan.org/pod/DBI#prepare_cached
Returntype : DBI statement handle
Exceptions : thrown if the SQL statement is empty, or if the internal
database handle is not present
...
...
@@ -731,25 +738,25 @@ sub prepare {
=cut
sub
prepare_cached
{
my
(
$self
,
@args
)
=
@_
;
my
(
$self
,
@args
)
=
@_
;
if
(
!
$args
[
0
]
)
{
throw
("
Attempting to prepare_cached an empty SQL query.
");
}
#warn "SQL(".$self->dbname."):" . join(' ', @args) . "\n";
if
(
(
$self
->
reconnect_when_lost
())
and
(
!
$self
->
db_handle
()
->
ping
()
)
)
{
$self
->
reconnect
();
if
(
(
$self
->
reconnect_when_lost
()
)
and
(
!
$self
->
db_handle
()
->
{
Active
}
)
)
{
$self
->
reconnect
();
}
my
$sth
=
$self
->
db_handle
->
prepare_cached
(
@args
);
my
$sth
=
$self
->
db_handle
->
prepare_cached
(
@args
);
# return an overridden statement handle that provides us with
# the means to disconnect inactive statement handles automatically
bless
$sth
,
"
Bio::EnsEMBL::DBSQL::StatementHandle
";
$sth
->
dbc
(
$self
);
$sth
->
sql
(
$args
[
0
]);
$sth
->
dbc
(
$self
);
$sth
->
sql
(
$args
[
0
]
);
$self
->
query_count
(
$self
->
query_count
()
+
1
);
$self
->
query_count
(
$self
->
query_count
()
+
1
);
return
$sth
;
}
...
...
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