Project

General

Profile

« Previous | Next » 

Revision 1953

Added by Matt Jones over 20 years ago

Added new function "getLastId" to the Metacat.pm perl Metacat client. Returns
the hisghest docid in use in a given scope.

View differences:

Metacat.pm
277 277
}
278 278

  
279 279
#############################################################
280
# subroutine to get the maximimum id in a series
281
# If success, return max id, else return 0
282
#############################################################
283
sub getLastId {
284
  my $self = shift;
285
  my $scope = shift;
286

  
287
  my $returnval = 0;
288

  
289
  my %postData = ( action => 'getlastdocid',
290
                   scope => $scope
291
                 );
292

  
293
  my $response = $self->sendData(%postData);
294
  if (($response) && $response->content =~ /<docid>(.*)<\/docid>/s) {
295
      $returnval = "$1";
296
  } elsif (($response)) {
297
    $returnval = 0;
298
    #print "Error response from sendData!\n";
299
    #print $response->content, "\n";
300
  } else {
301
    $returnval = 0;
302
    #print "Invalid response from sendData!\n";
303
  }
304

  
305
  return $returnval;
306
}
307
#############################################################
280 308
# subroutine to get the message returned from the last executed
281 309
# metacat action.  These are generally XML formatted messages.
282 310
#############################################################
......
324 352
  $resultset = $metacat->squery($pathquery); 
325 353
  print $resultset;
326 354
  $response = $metacat->delete($docid); 
355
  my $lastid = $metacat->getLastId("obfs");
327 356
  print $metacat->getMessage();
328 357
  $response = $metacat->getCookies(); 
329 358
  print $metacat->getMessage();

Also available in: Unified diff