Home > m > mysql > mysql_getMaxId.m

mysql_getMaxId

PURPOSE ^

MYSQL_GETMAXID get the maximum Id from the objs table.

SYNOPSIS ^

function id = mysql_getMaxId(conn)

DESCRIPTION ^

 MYSQL_GETMAXID get the maximum Id from the objs table.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: MYSQL_GETMAXID get the maximum Id from the objs table.

 CALL:        id = mysql_getMaxId()

 VERSION:     $Id: mysql_getMaxId.m,v 1.3 2007/08/31 17:29:22 hewitson Exp $

 HISTORY:     24-05-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function id = mysql_getMaxId(conn)
0002 % MYSQL_GETMAXID get the maximum Id from the objs table.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: MYSQL_GETMAXID get the maximum Id from the objs table.
0007 %
0008 % CALL:        id = mysql_getMaxId()
0009 %
0010 % VERSION:     $Id: mysql_getMaxId.m,v 1.3 2007/08/31 17:29:22 hewitson Exp $
0011 %
0012 % HISTORY:     24-05-2007 M Hewitson
0013 %                 Creation
0014 %
0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0016 
0017 q    = 'select max(id) from objs';
0018 curs = exec(conn, q);
0019 curs = fetch(curs);
0020 id   = curs.Data{1};
0021 close(curs);
0022 
0023 if isnan(id)
0024   id = 0;
0025 end
0026 
0027 % END

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003