Home > m > mysql > mysql_getObjType.m

mysql_getObjType

PURPOSE ^

MYSQL_GETOBJTYPE gets the object type associated with the given object id.

SYNOPSIS ^

function type = mysql_getObjType(conn, id)

DESCRIPTION ^

 MYSQL_GETOBJTYPE gets the object type associated with the given object id.
 
 Usage: ids = mysql_getObjType(conn,id);
 
 Inputs:
     conn - a database connection object
     id   - an object id
 
 Outputs:
     type - the type of this object
 
 M Hewitson 30-08-07
 
 $Id: mysql_getObjType.m,v 1.3 2008/02/22 09:25:18 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function type = mysql_getObjType(conn, id)
0002 
0003 % MYSQL_GETOBJTYPE gets the object type associated with the given object id.
0004 %
0005 % Usage: ids = mysql_getObjType(conn,id);
0006 %
0007 % Inputs:
0008 %     conn - a database connection object
0009 %     id   - an object id
0010 %
0011 % Outputs:
0012 %     type - the type of this object
0013 %
0014 % M Hewitson 30-08-07
0015 %
0016 % $Id: mysql_getObjType.m,v 1.3 2008/02/22 09:25:18 hewitson Exp $
0017 %
0018 
0019 
0020 try
0021   curs    = exec(conn, sprintf('select obj_type from objmeta where obj_id="%d"', id));
0022   curs    = fetch(curs);
0023   type    = curs.Data{1};
0024   close(curs);
0025 catch
0026   warning('!!! Unable to get object type for ID %d. [Server returned: %s]', id, curs.Message);
0027   type = '';
0028 end
0029

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