Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-hive
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
7
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-hive
Commits
a27cac4b
Commit
a27cac4b
authored
14 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
track insert_ids of separate commands and make them available for dataflow
parent
959a679e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Hive/RunnableDB/SqlCmd.pm
+21
-11
21 additions, 11 deletions
modules/Bio/EnsEMBL/Hive/RunnableDB/SqlCmd.pm
with
21 additions
and
11 deletions
modules/Bio/EnsEMBL/Hive/RunnableDB/SqlCmd.pm
+
21
−
11
View file @
a27cac4b
...
...
@@ -91,16 +91,9 @@ sub fetch_input {
?
$self
->
db
->
get_AnalysisDataAdaptor
->
fetch_by_dbID
(
$self
->
param
('
did
')
)
:
die
"
Could not find the command defined in input_id(), param('sql') or param('did')
";
#
Perform parameter substitution
:
#
Store the sql command array
:
#
my
@substituted_sqls
=
();
foreach
my
$unsubst
((
ref
(
$sql
)
eq
'
ARRAY
')
?
@$sql
:
(
$sql
)
)
{
push
@substituted_sqls
,
$self
->
param_substitute
(
$unsubst
);
}
# Store the substituted sql command array
#
$self
->
param
('
sqls
',
\
@substituted_sqls
);
$self
->
param
('
sqls
',
(
ref
(
$sql
)
eq
'
ARRAY
')
?
$sql
:
[
$sql
]
);
# Use connection parameters to another database if supplied, otherwise use the current database as default:
#
...
...
@@ -126,20 +119,37 @@ sub run {
my
$dbc
=
$self
->
param
('
dbc
');
my
$sqls
=
$self
->
param
('
sqls
');
my
%output_id
;
# What would be a generic way of indicating an error in (My)SQL statement, that percolates through PerlDBI?
foreach
my
$sql
(
@$sqls
)
{
my
$counter
=
0
;
foreach
my
$unsubst_sql
(
@$sqls
)
{
# Perform parameter substitution:
my
$sql
=
$self
->
param_substitute
(
$unsubst_sql
);
$dbc
->
do
(
$sql
);
my
$insert_id_name
=
'
_insert_id_
'
.
$counter
++
;
my
$insert_id_value
=
$dbc
->
db_handle
->
{'
mysql_insertid
'};
$output_id
{
$insert_id_name
}
=
$insert_id_value
;
$self
->
param
(
$insert_id_name
,
$insert_id_value
);
# for templates
}
$self
->
param
('
output_id
',
\
%output_id
);
}
=head2 write_output
Description : Implements write_output() interface method of Bio::EnsEMBL::Hive::Process that is used to deal with job's output after the execution.
Here we
have nothing to do, as the wrapper is very generic
.
Here we
only flow out the insert_ids
.
=cut
sub
write_output
{
my
$self
=
shift
;
$self
->
dataflow_output_id
(
$self
->
param
('
output_id
'),
2
);
}
1
;
...
...
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