Project

General

Profile

Bug #248

id finder needed for metacat

Added by Chad Berkley over 18 years ago. Updated over 17 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 startupResolved07/12/2001

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

History

#1 Updated by Jivka Bojilova over 18 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

#2 Updated by Jivka Bojilova over 18 years ago

DONE

#3 Updated by Dan Higgins about 18 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.

#4 Updated by Matt Jones about 18 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.

#5 Updated by Dan Higgins almost 18 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.

#6 Updated by Matt Jones almost 18 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"
);

#7 Updated by Matt Jones almost 18 years ago

FIXED with previosuly committed changes.

#8 Updated by Matt Jones almost 18 years ago

Resolved/FIXED.

#9 Updated by Redmine Admin over 6 years ago

Original Bugzilla ID was 248

Also available in: Atom PDF