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
7032140c
Commit
7032140c
authored
20 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Finding max existing ids now done more elegantly with selectall_arrayref.
parent
cfd9d305
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
misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
+10
-13
10 additions, 13 deletions
misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
with
10 additions
and
13 deletions
misc-scripts/xref_mapping/XrefMapper/BasicMapper.pm
+
10
−
13
View file @
7032140c
...
...
@@ -687,24 +687,22 @@ sub store {
# get current max object_xref_id
# TODO use selectall_arrayref
my
$max_object_xref_id
=
0
;
my
$sth
=
$self
->
dbi
()
->
prepare
("
SELECT MAX(object_xref_id) FROM object_xref
");
$sth
->
execute
();
my
$max_object_xref_id
=
(
$sth
->
fetchrow_array
())[
0
];
my
$row
=
@
{
$self
->
dbi
()
->
selectall_arrayref
("
SELECT MAX(object_xref_id) FROM object_xref
")}[
0
];
my
$max_object_xref_id
=
@
{
$row
}[
0
];
if
(
!
defined
$max_object_xref_id
)
{
print
"
Can't get highest existing object_xref_id, using 1
\n
)
";
}
else
{
print
"
Maximum existing object_xref_id =
$max_object_xref_id
\n
";
$max_object_xref_id
=
1
;
}
my
$max_xref_id
=
0
;
my
$core_sth
=
$self
->
dbi
->
prepare
("
SELECT MAX(xref_id) FROM xref
");
$core_sth
->
execute
();
my
$max_xref_id
=
(
$core_sth
->
fetchrow_array
())[
0
];
$row
=
@
{
$self
->
dbi
->
selectall_arrayref
("
SELECT MAX(xref_id) FROM xref
")}[
0
];
my
$max_xref_id
=
@$row
[
0
];
if
(
!
defined
$max_xref_id
)
{
print
"
Can't get highest existing xref_id, using 0
\n
)
";
}
else
{
print
"
Maximum existing xref_id =
$max_xref_id
\n
";
$max_object_xref_id
=
1
;
}
my
$xref_id_offset
=
$max_xref_id
+
1
;
...
...
@@ -987,14 +985,13 @@ sub dump_core_xrefs {
open
(
EXTERNAL_DB
,
"
>external_db.txt
");
# get current highest internal ID from external_db
my
$max_edb_id
=
0
;
my
$core_sth
=
$core_dbi
->
prepare
("
SELECT MAX(external_db_id) FROM external_db
");
$core_sth
->
execute
();
my
$max_edb_id
=
(
$core_sth
->
fetchrow_array
())[
0
];
my
$row
=
@
{
$core_dbi
->
selectall_arrayref
("
SELECT MAX(external_db_id) FROM external_db
")}[
0
];
my
$max_edb_id
=
@
{
$row
}[
0
];
if
(
!
defined
$max_edb_id
)
{
print
"
Can't get highest existing external_db_id, using
0
\n
)
";
print
"
Can't get highest existing external_db_id, using
1
\n
)
";
}
else
{
print
"
Maximum existing external_db_id =
$max_edb_id
\n
";
$max_edb_id
=
0
;
}
my
$edb_id
=
$max_edb_id
+
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