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
8289410e
Commit
8289410e
authored
16 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
For Compara, Funcgen, and Variation databases, do not try to access a
species_id column in the meta table. Unit-tests passes.
parent
1507aefa
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/DBSQL/BaseMetaContainer.pm
+75
-61
75 additions, 61 deletions
modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm
with
75 additions
and
61 deletions
modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm
+
75
−
61
View file @
8289410e
...
...
@@ -97,16 +97,20 @@ sub list_value_by_key {
}
my
$sth
;
if
(
!
$self
->
_species_specific_key
(
$key
)
)
{
if
(
ref
(
$self
)
=~
/Compara|Funcgen|Variation/
)
{
$sth
=
$self
->
prepare
(
"
SELECT meta_value
"
.
"
FROM meta
"
.
"
WHERE meta_key = ?
"
.
"
ORDER BY meta_id
"
);
}
elsif
(
!
$self
->
_species_specific_key
(
$key
)
)
{
$sth
=
$self
->
prepare
(
"
SELECT meta_value
"
.
"
FROM meta
"
.
"
WHERE meta_key = ?
"
.
"
AND species_id IS NULL
"
.
"
ORDER BY meta_id
"
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
execute
();
}
else
{
$sth
=
$self
->
prepare
(
"
SELECT meta_value
"
...
...
@@ -114,12 +118,12 @@ sub list_value_by_key {
.
"
WHERE meta_key = ?
"
.
"
AND species_id = ?
"
.
"
ORDER BY meta_id
"
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$self
->
species_id
(),
SQL_INTEGER
);
$sth
->
execute
();
}
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
execute
();
my
@result
;
while
(
my
$arrRef
=
$sth
->
fetchrow_arrayref
()
)
{
push
(
@result
,
$arrRef
->
[
0
]
);
...
...
@@ -156,25 +160,26 @@ sub store_key_value {
return
;
}
if
(
!
$self
->
_species_specific_key
(
$key
)
)
{
my
$sth
=
$self
->
prepare
(
'
INSERT INTO meta (species_id, meta_key, meta_value)
'
.
'
VALUES(\N, ?, ?)
'
);
my
$sth
;
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
if
(
ref
(
$self
)
=~
/Compara|Funcgen|Variation/
)
{
$sth
=
$self
->
prepare
(
'
INSERT INTO meta (meta_key, meta_value) VALUES(?, ?)
');
}
elsif
(
!
$self
->
_species_specific_key
(
$key
)
)
{
$sth
=
$self
->
prepare
(
'
INSERT INTO meta (meta_key, meta_value, species_id)
'
.
'
VALUES(?, ?, \N)
'
);
}
else
{
my
$sth
=
$self
->
prepare
(
'
INSERT INTO meta (
species_id,
meta_key, meta_value)
'
$sth
=
$self
->
prepare
(
'
INSERT INTO meta (meta_key, meta_value
, species_id
)
'
.
'
VALUES (?, ?, ?)
'
);
$sth
->
bind_param
(
1
,
$self
->
species_id
(),
SQL_INTEGER
);
$sth
->
bind_param
(
2
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
$sth
->
bind_param
(
3
,
$self
->
species_id
(),
SQL_INTEGER
);
}
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
$self
->
{'
cache
'}
||=
{};
delete
$self
->
{'
cache
'}
->
{
$key
};
...
...
@@ -198,27 +203,29 @@ sub store_key_value {
sub
update_key_value
{
my
(
$self
,
$key
,
$value
)
=
@_
;
if
(
!
$self
->
_species_specific_key
(
$key
)
)
{
my
$sth
=
my
$sth
;
if
(
ref
(
$self
)
=~
/Compara|Funcgen|Variation/
)
{
$sth
=
$self
->
prepare
(
'
UPDATE meta SET meta_value = ? WHERE meta_key = ?
'
);
}
elsif
(
!
$self
->
_species_specific_key
(
$key
)
)
{
$sth
=
$self
->
prepare
(
'
UPDATE meta SET meta_value = ?
'
.
'
WHERE meta_key = ?
'
.
'
AND species_id IS NULL
'
);
$sth
->
bind_param
(
1
,
$value
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$key
,
SQL_VARCHAR
);
$sth
->
execute
();
}
else
{
my
$sth
=
$sth
=
$self
->
prepare
(
'
UPDATE meta
'
.
'
SET meta_value = ?
'
.
'
WHERE meta_key = ?
'
.
'
AND species_id = ?
'
);
$sth
->
bind_param
(
1
,
$value
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$self
->
species_id
(),
SQL_INTEGER
);
$sth
->
execute
();
}
$sth
->
bind_param
(
1
,
$value
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$key
,
SQL_VARCHAR
);
$sth
->
execute
();
}
## end sub update_key_value
...
...
@@ -239,25 +246,26 @@ sub update_key_value {
sub
delete_key
{
my
(
$self
,
$key
)
=
@_
;
if
(
!
$self
->
_species_specific_key
(
$key
)
)
{
my
$sth
=
my
$sth
;
if
(
ref
(
$self
)
=~
/Compara|Funcgen|Variation/
)
{
$sth
=
$self
->
prepare
(
'
DELETE FROM meta WHERE meta_key = ?
'
);
}
elsif
(
!
$self
->
_species_specific_key
(
$key
)
)
{
$sth
=
$self
->
prepare
(
'
DELETE FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND species_id IS NULL
'
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
execute
();
}
else
{
my
$sth
=
$sth
=
$self
->
prepare
(
'
DELETE FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND species_id = ?
'
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$self
->
species_id
(),
SQL_INTEGER
);
$sth
->
execute
();
}
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
execute
();
delete
$self
->
{'
cache
'}
->
{
$key
};
}
...
...
@@ -280,29 +288,32 @@ sub delete_key {
sub
delete_key_value
{
my
(
$self
,
$key
,
$value
)
=
@_
;
if
(
!
$self
->
_species_specific_key
(
$key
)
)
{
my
$sth
=
my
$sth
;
if
(
ref
(
$self
)
=~
/Compara|Funcgen|Variation/
)
{
$sth
=
$self
->
prepare
(
'
DELETE FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND meta_value = ?
'
);
}
elsif
(
!
$self
->
_species_specific_key
(
$key
)
)
{
$sth
=
$self
->
prepare
(
'
DELETE FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND meta_value = ?
'
.
'
AND species_id IS NULL
'
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
}
else
{
my
$sth
=
$sth
=
$self
->
prepare
(
'
DELETE FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND meta_value = ?
'
.
'
AND species_id = ?
'
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$self
->
species_id
(),
SQL_INTEGER
);
$sth
->
execute
();
}
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
delete
$self
->
{'
cache
'}
->
{
$key
};
}
## end sub delete_key_value
...
...
@@ -326,17 +337,20 @@ sub key_value_exists {
my
(
$self
,
$key
,
$value
)
=
@_
;
my
$sth
;
if
(
!
$self
->
_species_specific_key
(
$key
)
)
{
if
(
ref
(
$self
)
=~
/Compara|Funcgen|Variation/
)
{
$sth
=
$self
->
prepare
(
'
SELECT meta_value
'
.
'
FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND meta_value = ?
'
);
}
elsif
(
!
$self
->
_species_specific_key
(
$key
)
)
{
$sth
=
$self
->
prepare
(
'
SELECT meta_value
'
.
'
FROM meta
'
.
'
WHERE meta_key = ?
'
.
'
AND meta_value = ?
'
.
'
AND species_id IS NULL
'
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
}
else
{
$sth
=
$self
->
prepare
(
'
SELECT meta_value
'
...
...
@@ -344,13 +358,13 @@ sub key_value_exists {
.
'
WHERE meta_key = ?
'
.
'
AND meta_value = ?
'
.
'
AND species_id = ?
'
);
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
bind_param
(
3
,
$self
->
species_id
(),
SQL_INTEGER
);
$sth
->
execute
();
}
$sth
->
bind_param
(
1
,
$key
,
SQL_VARCHAR
);
$sth
->
bind_param
(
2
,
$value
,
SQL_VARCHAR
);
$sth
->
execute
();
while
(
my
$arrRef
=
$sth
->
fetchrow_arrayref
()
)
{
if
(
$arrRef
->
[
0
]
eq
$value
)
{
$sth
->
finish
();
...
...
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