view m-toolbox/classes/+utils/@mysql/getMaxId.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents f0afece42f48
children
line wrap: on
line source

% GETMAXID get the maximum Id from the objs table.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: GETMAXID get the maximum Id from the objs table.
%
% CALL:        id = getMaxId()
%
% VERSION:     $Id: getMaxId.m,v 1.2 2010/01/22 12:46:08 ingo Exp $
%
% HISTORY:     24-05-2007 M Hewitson
%                 Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function id = getMaxId(conn)

  error('### Obsolete as of LTPDA version 2.2. Replaced my the utils class jmysql (utils.jmysql.%s)', mfilename());
  q    = 'select max(id) from objs';
  curs = exec(conn, q);
  curs = fetch(curs);
  id   = curs.Data{1};
  close(curs);

  if isnan(id)
    id = 0;
  end

end