view m-toolbox/classes/+utils/@repository/getObjectType.m @ 11:9174aadb93a5 database-connection-manager

Add LTPDA Repository utility functions into utils.repository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents
children
line wrap: on
line source

function type = getObjectType(conn, id)
% GETOBJECTTYPE  Return the type of the object.
%
% CALL:
%
%   ids = utils.repository.getObjectType(conn, cid)
%
% PARAMETERS:
%
%   CONN   database connection implementing java.sql.Connection
%   ID     object id
%

  rows = utils.mysql.execute(conn, 'SELECT obj_type FROM objmeta WHERE obj_id = ?', id);
  if isempty(rows)
    error('### object %d not found', id);
  end
  type = rows{1};
  
end