Project

General

Profile

Actions

Bug #248

closed

id finder needed for metacat

Added by Chad Berkley over 23 years ago. Updated over 22 years ago.

Status:
Resolved
Priority:
Immediate
Assignee:
Category:
metacat
Target version:
Start date:
07/10/2001
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
248

Description

Metacat needs a utility function so that morpho can query it and find the last
id used by a specific user. right now, if a user goes to another computer, his
id sequence is reset, causing id conflicts when the documents are uploaded.
the <profile>.xml file in morpho needs to be able to be updated with the latest
id that was used in metacat. this should be done dynamically when morpho
starts up. I will also enter a bug for morpho for this.


Related issues

Blocked by Morpho - Bug #254: Look up id sequence on morpho startupResolvedDan Higgins07/12/2001

Actions
Blocked by Morpho - Bug #301: use UID as scope, chek for conflictsResolvedChad Berkley10/16/2001

Actions
Actions #1

Updated by Jivka Bojilova over 23 years ago

DONE
Included utility function about gettig the latest docid for a user:
DBUtil.getLastDocid(username).
Required Metacat' parameters:
- action='getlastdocid'
- username

The SQL Statement used:
SELECT docid, rev, date_updated
FROM xml_documents
WHERE user_owner = @username
AND date_updated = (SELECT MAX
FROM xml_documents
WHERE user_owner = @username)
UNION
SELECT docid, rev, date_updated
FROM xml_revisions
WHERE user_owner = @username
AND date_updated = (SELECT MAX
FROM xml_revisions
WHERE user_owner = @username)
ORDER BY date_updated

Actions #2

Updated by Jivka Bojilova over 23 years ago

DONE

Actions #3

Updated by Dan Higgins about 23 years ago

It appears that Metacat does NOT return the LAST ID (It seems to return the last
id of a dataset document. But there are other documents in a dataset which have
larger ids.) Morpho adds 5 to the numbe returned, but this is not always a good fix.

Actions #4

Updated by Matt Jones about 23 years ago

Need to change this function so that metacat returns the largest id number used
for a particular scope, regardless of which user owns the documents. Thus, we
may need to rename the function to "getMaxIdForScope" or something similar.

Actions #5

Updated by Dan Higgins about 23 years ago

The current version of this code in Metacat will work correctly with the current
version of Morpho. The problem was related to accession numbers being assigned
in Morpho in a different order than documents were inserted into Metacat. (The
Metacat code checks insertion times rather than accession numbers.)

Morpho has been changed to insert documents in the same order that accession
numbere are assigned. Also, the next accession id stord in the profile is now
updated when Morpho starts up.

Actions #6

Updated by Matt Jones about 23 years ago

Rewrote the SQL function to select the MAX accession number used for a given
scope. The scope is now passed into Metacat using a "scope" parameter. Renamed
functions to properly reflect that they are selecting the MAX id rather than the
last id. The new SQL algorithm looks like this:

"SELECT docid, rev, acc FROM " +
"( " +
"SELECT docid, rev, acc FROM " +
"(" +
"SELECT docid, rev, " +
"SUBSTR(docid, INSTR(docid, '" + sep + "', 1)+1)+0 acc " +
"FROM xml_documents " +
"WHERE docid LIKE ? " +
"ORDER BY acc DESC " +
") " +
"WHERE rownum = 1 " +
"UNION " +
"SELECT docid, rev, acc FROM " +
"(" +
"SELECT docid, rev, " +
"SUBSTR(docid, INSTR(docid, '" + sep + "', 1)+1)+0 acc " +
"FROM xml_revisions " +
"WHERE docid LIKE ? " +
"ORDER BY acc DESC " +
") " +
"WHERE rownum = 1 " +
") " +
"ORDER BY acc DESC"
);
Actions #7

Updated by Matt Jones about 23 years ago

FIXED with previosuly committed changes.

Actions #8

Updated by Matt Jones about 23 years ago

Resolved/FIXED.

Actions #9

Updated by Redmine Admin over 11 years ago

Original Bugzilla ID was 248

Actions

Also available in: Atom PDF