[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Figuring out the highest EPrint ID?



I actually just created this for a tweepository last night:

http://websci-tweets.ecs.soton.ac.uk/cgi/tweepository/highest_tweetid

Here?s what?s in the cgi scrtipt directory (you?ll just need to globally replace ?tweet? with ?eprint? in the mysql query):

use EPrints;
use strict;

my $eprints = EPrints->new;
my $repo = $eprints->current_repository;
exit( 0 ) unless( defined $repo );

my $format = $repo->param( "format" );
$format = "default" if( !defined $format );

my $sql = 'SELECT MAX(tweetid) FROM tweet';

my $sth = $repo->database->prepare($sql);
$sth->execute;

my $high_id = $sth->fetchrow_arrayref->[0];


if ($format eq 'commas')
{
        print scalar reverse join ',', unpack '(A3)*', reverse $high_id;
}
else
{
        print $high_id;
}




[isc]<http://www.jisc.ac.uk/>

Adam Field
SHERPA services analyst developer



From: <eprints-tech-bounces at ecs.soton.ac.uk> on behalf of John Salter <J.Salter at leeds.ac.uk>
Reply-To: "eprints-tech at ecs.soton.ac.uk" <eprints-tech at ecs.soton.ac.uk>
Date: Wednesday, 15 February 2017 11:58
To: "eprints-tech at ecs.soton.ac.uk" <eprints-tech at ecs.soton.ac.uk>
Subject: Re: [EP-tech] Figuring out the highest EPrint ID?

Try the database:
mysql> SELECT MAX(eprintid) FROM eprint;
mysql> SELECT counter FROM counters WHERE counterid = 'eprintid';

There's probably a way to get this via an EPrints session too if you need that?

Cheers,
John


From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Andrew Beeken
Sent: 15 February 2017 11:46
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Figuring out the highest EPrint ID?

Hello again!

New one here, related to a different project! So, I?m trying to find the HIGHEST EPrint ID that we have in our live system. I was doing this by taking the ?Latest Additions? atom feed and looking at the topmost entry, however I have now realised this isn?t accurate as this could be representative of an item that has been sat in a work area for a number of weeks or even months. Is there an easy way, via endpoint or API access, that I could use to derive the highest number?

Andrew

The University of Lincoln, located in the heart of the city of Lincoln, has established an international reputation based on high student satisfaction, excellent graduate employment and world-class research.

The information in this e-mail and any attachments may be confidential. If you have received this email in error please notify the sender immediately and remove it from your system. Do not disclose the contents to another person or take copies.

Email is not secure and may contain viruses. The University of Lincoln makes every effort to ensure email is sent without viruses, but cannot guarantee this and recommends recipients take appropriate precautions.

The University may monitor email traffic data and content in accordance with its policies and English law. Further information can be found at: http://www.lincoln.ac.uk/legal.

Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc?s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800.

Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20170216/9c2e2fdb/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 1264 bytes
Desc: image001.png
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20170216/9c2e2fdb/attachment-0001.png