Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl
Commits
7ad23a6a
Commit
7ad23a6a
authored
Oct 25, 2010
by
Andreas Kusalananda Kähäri
Browse files
Store database handles in a hash rather than in a list.
parent
a71033d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
misc-scripts/production_database/scripts/push_master_tables.pl
...scripts/production_database/scripts/push_master_tables.pl
+7
-4
No files found.
misc-scripts/production_database/scripts/push_master_tables.pl
View file @
7ad23a6a
...
...
@@ -176,17 +176,20 @@ my %master;
}
}
my
@
db_handles
;
my
%
db_handles
;
foreach
my
$server
(
@servers
)
{
my
$dsn
=
sprintf
(
'
DBI:mysql:host=%s;port=%d
',
$server
,
$dbport
);
my
$dbh
=
DBI
->
connect
(
$dsn
,
$dbuser
,
$dbpass
,
{
'
PrintError
'
=>
1
}
);
push
(
@
db_handles
,
$dbh
)
;
$
db_handles
{
$server
}
=
$dbh
;
}
my
%sql
;
foreach
my
$dbh
(
@db_handles
)
{
foreach
my
$server
(
@servers
)
{
printf
(
"
###> Looking at '%s'
\n
",
$server
);
my
$dbh
=
$db_handles
{
$server
};
my
$sth
=
$dbh
->
prepare
('
SHOW DATABASES LIKE ?
');
foreach
my
$dbtype
(
@dbtypes
)
{
...
...
@@ -438,7 +441,7 @@ if ( scalar( keys(%sql) ) > 0 ) {
}
END
{
foreach
my
$dbh
(
@
db_handles
)
{
foreach
my
$dbh
(
values
(
%
db_handles
)
)
{
$dbh
->
disconnect
();
}
}
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