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
546c8ea2
Commit
546c8ea2
authored
16 years ago
by
Daniel Rios
Browse files
Options
Downloads
Patches
Plain Diff
bind parameters in update & store methods
parent
91995ddb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm
+21
-12
21 additions, 12 deletions
modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm
with
21 additions
and
12 deletions
modules/Bio/EnsEMBL/DBSQL/AnalysisAdaptor.pm
+
21
−
12
View file @
546c8ea2
...
@@ -445,9 +445,9 @@ sub store {
...
@@ -445,9 +445,9 @@ sub store {
$sth
->
bind_param
(
2
,
$analysis
->
display_label
(),
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$analysis
->
display_label
(),
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$analysis
->
description
,
SQL_LONGVARCHAR
);
$sth
->
bind_param
(
3
,
$analysis
->
description
,
SQL_LONGVARCHAR
);
$sth
->
bind_param
(
4
,
$analysis
->
displayable
,
SQL_TINYINT
);
$sth
->
bind_param
(
4
,
$analysis
->
displayable
,
SQL_TINYINT
);
#
$sth->bind_param(5,$analysis->web_data(),SQL_LONGVARCHAR);
#
$sth->bind_param(5,$analysis->web_data(),SQL_LONGVARCHAR);
my
$web_data
;
my
$web_data
=
$self
->
dump_data
(
$analysis
->
web_data
());
$web_data
=
$self
->
dump_data
(
$analysis
->
web_data
())
if
(
$analysis
->
web_data
())
;
$sth
->
bind_param
(
5
,
$web_data
,
SQL_LONGVARCHAR
);
$sth
->
bind_param
(
5
,
$web_data
,
SQL_LONGVARCHAR
);
$sth
->
execute
();
$sth
->
execute
();
...
@@ -524,24 +524,33 @@ sub update {
...
@@ -524,24 +524,33 @@ sub update {
# not already there
# not already there
$sth
=
$self
->
prepare
("
SELECT description FROM analysis_description WHERE analysis_id= ?
");
$sth
=
$self
->
prepare
("
SELECT description FROM analysis_description WHERE analysis_id= ?
");
$sth
->
execute
(
$a
->
dbID
);
$sth
->
execute
(
$a
->
dbID
);
my
$web_data
;
#this is an anonymous reference to a hash, will have to be dumped into string before writing to db
if
(
$sth
->
fetchrow_hashref
)
{
# update if exists
if
(
$sth
->
fetchrow_hashref
)
{
# update if exists
my
$web_data
;
$web_data
=
$self
->
dump_data
(
$a
->
web_data
())
if
(
$a
->
web_data
());
$web_data
=
$self
->
dump_data
(
$a
->
web_data
())
if
(
$a
->
web_data
());
$sth
=
$self
->
prepare
$sth
=
$self
->
prepare
("
UPDATE analysis_description SET description = ?, display_label = ?, displayable = ?, web_data = ? WHERE analysis_id = ?
");
("
UPDATE analysis_description SET description = ?, display_label = ?, displayable = ?, web_data = ? WHERE analysis_id = ?
");
$sth
->
bind_param
(
1
,
$a
->
description
,
SQL_LONGVARCHAR
);
$sth
->
execute
(
$a
->
description
(),
$a
->
display_label
(),
$a
->
displayable
(),
$web_data
,
$a
->
dbID
);
$sth
->
bind_param
(
2
,
$a
->
display_label
(),
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$a
->
displayable
,
SQL_TINYINT
);
# print "after $web_data\n";
$sth
->
bind_param
(
4
,
$web_data
,
SQL_LONGVARCHAR
);
$sth
->
bind_param
(
5
,
$a
->
dbID
,
SQL_INTEGER
);
$sth
->
execute
();
}
else
{
# create new entry
}
else
{
# create new entry
if
(
$a
->
description
()
||
$a
->
display_label
()
||
$a
->
web_data
)
{
if
(
$a
->
description
()
||
$a
->
display_label
()
||
$a
->
web_data
)
{
my
$web_data
;
$web_data
=
$self
->
dump_data
(
$a
->
web_data
())
if
(
$a
->
web_data
());
$web_data
=
$self
->
dump_data
(
$a
->
web_data
())
if
(
$a
->
web_data
());
#my $web_data = $self->dump_data($a->web_data());
#my $web_data = $self->dump_data($a->web_data());
$sth
=
$self
->
prepare
(
"
INSERT IGNORE INTO analysis_description (analysis_id, display_label, description, displayable, web_data) VALUES (?,?,?,?,?)
");
$sth
=
$self
->
prepare
(
"
INSERT IGNORE INTO analysis_description (analysis_id, display_label, description, displayable, web_data) VALUES (?,?,?,?,?)
");
$sth
->
execute
(
$a
->
dbID
(),
$a
->
display_label
(),
$a
->
description
(),
$a
->
displayable
(),
$web_data
);
$sth
->
bind_param
(
1
,
$a
->
dbID
,
SQL_INTEGER
);
$sth
->
finish
();
$sth
->
bind_param
(
2
,
$a
->
display_label
(),
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$a
->
description
,
SQL_LONGVARCHAR
);
$sth
->
bind_param
(
4
,
$a
->
displayable
,
SQL_TINYINT
);
#my $web_data = $self->dump_data($a->web_data());
$sth
->
bind_param
(
5
,
$web_data
,
SQL_LONGVARCHAR
);
$sth
->
execute
();
}
}
}
}
...
...
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