Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
1ff5c5c1
Commit
1ff5c5c1
authored
Jun 13, 2005
by
Jessica Severin
Browse files
extended syntax of URL to allow disconnect (;discon=1)
parent
aadc55d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
modules/Bio/EnsEMBL/Hive/URLFactory.pm
modules/Bio/EnsEMBL/Hive/URLFactory.pm
+19
-4
No files found.
modules/Bio/EnsEMBL/Hive/URLFactory.pm
View file @
1ff5c5c1
...
...
@@ -146,6 +146,7 @@ sub _get_db_connection
my
$path
=
'';
my
$module
=
"
Bio::EnsEMBL::Hive::DBSQL::DBAdaptor
";
$type
=
'
hive
'
unless
(
$type
);
my
$discon
=
0
;
my
(
$p
,
$p2
,
$p3
);
#print("FETCH $url\n");
...
...
@@ -156,14 +157,28 @@ sub _get_db_connection
my
$conn
=
substr
(
$url
,
0
,
$p
);
$dbname
=
substr
(
$url
,
$p
+
1
,
length
(
$url
));
if
((
$p2
=
rindex
(
$dbname
,
"
;type=
"))
!=
-
1
)
{
$type
=
substr
(
$dbname
,
$p2
+
6
,
length
(
$dbname
));
my
$params
=
undef
;
if
((
$p2
=
index
(
$dbname
,
"
;
"))
!=
-
1
)
{
$params
=
substr
(
$dbname
,
$p2
+
1
,
length
(
$dbname
));
$dbname
=
substr
(
$dbname
,
0
,
$p2
);
}
if
((
$p2
=
index
(
$dbname
,
"
/
"))
!=
-
1
)
{
$path
=
substr
(
$dbname
,
$p2
+
1
,
length
(
$dbname
));
$dbname
=
substr
(
$dbname
,
0
,
$p2
);
}
while
(
$params
)
{
my
$token
=
$params
;
if
((
$p2
=
rindex
(
$params
,
"
;
"))
!=
-
1
)
{
$token
=
substr
(
$params
,
0
,
$p2
);
$params
=
substr
(
$params
,
$p2
+
1
,
length
(
$params
));
}
else
{
$params
=
undef
;
}
if
(
$token
=~
/type=(.*)/
)
{
$type
=
$
1
;
}
if
(
$token
=~
/discon=(.*)/
)
{
$discon
=
$
1
;
}
}
#print(" conn=$conn\n dbname=$dbname\n path=$path\n");
...
...
@@ -195,7 +210,7 @@ sub _get_db_connection
$dba
=
$_URLFactory_global_instance
->
{
$connectionKey
};
return
(
$dba
,
$path
)
if
(
$dba
);
#print("CONNECT via\n user=$user\n pass=$pass\n host=$host\n port=$port\n dbname=$dbname\n path=$path\n type=$type\n");
#print("CONNECT via\n user=$user\n pass=$pass\n host=$host\n port=$port\n dbname=$dbname\n path=$path\n type=$type\n
discon=$discon\n
");
switch
(
$type
)
{
case
'
core
'
{
$module
=
"
Bio::EnsEMBL::DBSQL::DBAdaptor
";
}
case
'
pipeline
'
{
$module
=
"
Bio::EnsEMBL::Pipeline::DBSQL::DBAdaptor
";
}
...
...
@@ -206,7 +221,7 @@ sub _get_db_connection
}
$dba
=
"
$module
"
->
new
(
-
disconnect_when_inactive
=>
0
,
-
disconnect_when_inactive
=>
$discon
,
-
driver
=>
'
mysql
',
-
user
=>
$user
,
-
pass
=>
$pass
,
...
...
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