Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Emmanuel QUEVILLON
BIGSdb
Commits
4457a436
Commit
4457a436
authored
Feb 03, 2015
by
Keith Jolley
Browse files
Dataconnector method to drop all connections - needed for REST.
parent
956d4097
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/BIGSdb/Dataconnector.pm
View file @
4457a436
...
@@ -33,10 +33,7 @@ sub new {
...
@@ -33,10 +33,7 @@ sub new {
sub
DESTROY
{
sub
DESTROY
{
my
(
$self
)
=
@_
;
my
(
$self
)
=
@_
;
foreach
my
$db
(
keys
%
{
$self
->
{'
db
'}
}
)
{
$self
->
drop_all_connections
;
$self
->
_finish_active_statement_handles
(
$self
->
{'
db
'}
->
{
$db
},
1
);
eval
{
$self
->
{'
db
'}
->
{
$db
}
->
disconnect
and
$logger
->
info
("
Disconnected from database
$self
->{'db'}->{
$db
}->{'Name'}
")
};
}
return
;
return
;
}
}
...
@@ -72,6 +69,16 @@ sub drop_connection {
...
@@ -72,6 +69,16 @@ sub drop_connection {
return
;
return
;
}
}
sub
drop_all_connections
{
my
(
$self
)
=
@_
;
foreach
my
$db
(
keys
%
{
$self
->
{'
db
'}
}
)
{
$self
->
_finish_active_statement_handles
(
$self
->
{'
db
'}
->
{
$db
},
1
);
eval
{
$self
->
{'
db
'}
->
{
$db
}
->
disconnect
and
$logger
->
info
("
Disconnected from database
$self
->{'db'}->{
$db
}->{'Name'}
")
};
delete
$self
->
{'
db
'}
->
{
$db
};
}
return
;
}
sub
get_connection
{
sub
get_connection
{
my
(
$self
,
$attributes
)
=
@_
;
my
(
$self
,
$attributes
)
=
@_
;
my
$host
=
$attributes
->
{'
host
'}
||
$self
->
{'
system
'}
->
{'
host
'};
my
$host
=
$attributes
->
{'
host
'}
||
$self
->
{'
system
'}
->
{'
host
'};
...
...
lib/BIGSdb/Scheme.pm
View file @
4457a436
#Written by Keith Jolley
#Written by Keith Jolley
#Copyright (c) 2010-201
4
, University of Oxford
#Copyright (c) 2010-201
5
, University of Oxford
#E-mail: keith.jolley@zoo.ox.ac.uk
#E-mail: keith.jolley@zoo.ox.ac.uk
#
#
#This file is part of Bacterial Isolate Genome Sequence Database (BIGSdb).
#This file is part of Bacterial Isolate Genome Sequence Database (BIGSdb).
...
@@ -130,6 +130,7 @@ sub get_field_values_by_designations {
...
@@ -130,6 +130,7 @@ sub get_field_values_by_designations {
while
(
my
$data
=
$self
->
{'
sql
'}
->
{"
field_values_
$query_key
"}
->
fetchrow_hashref
)
{
while
(
my
$data
=
$self
->
{'
sql
'}
->
{"
field_values_
$query_key
"}
->
fetchrow_hashref
)
{
push
@$field_data
,
$data
;
push
@$field_data
,
$data
;
}
}
$self
->
{'
db
'}
->
commit
;
#Prevent IDLE in transaction locks in long-running REST process.
return
$field_data
;
return
$field_data
;
}
}
...
...
Write
Preview
Supports
Markdown
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