view m-toolbox/classes/+utils/@mysql/getsinfo.m @ 0:f0afece42f48
Import.
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Wed, 23 Nov 2011 19:22:13 +0100 (2011-11-23)
parents
children
line source
+ − % GETSINFO This function returns an sinfo object containing many useful information about an object retrieved from the repository
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % usage: sinfo = getsinfo(id, conn)
+ − %
+ − % inputs: id = obj_id from objmeta table
+ − % conn = utils.mysql.connect(server, dbname);
+ − %
+ − % outputs: sinfo cell array object containing info about object having the
+ − % given obj_id on the repository.
+ − % sinfo contains the following fields:
+ − % - name
+ − % - experiment_title
+ − % - experiment_desc
+ − % - analysis_desc
+ − % - quantity
+ − % - additional_authors
+ − % - additional_comments
+ − % - keywords and reference_ids
+ − %
+ − % A Monsky 05-02-2009
+ − %
+ − % version: $Id: getsinfo.m,v 1.6 2011/03/29 13:40:17 hewitson Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − function [varargout] = getsinfo(varargin)
+ −
+ − error('### Obsolete as of LTPDA version 2.2. Replaced my the utils class jmysql (utils.jmysql.%s)', mfilename());
+ −
+ − import utils.const.*
+ − utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
+ −
+ − % Collect input variable names
+ − in_names = cell(size(varargin));
+ − for ii = 1:nargin,in_names{ii} = inputname(ii);end
+ −
+ − % Collect all ids and plists and connections
+ − pl = utils.helper.collect_objects(varargin(:), 'plist');
+ − id = utils.helper.collect_objects(varargin(:), 'double');
+ − conn = utils.helper.collect_objects(varargin(:), 'database');
+ −
+ − if isempty(conn)
+ − error('### This method needs a MATLAB connection.');
+ − end
+ −
+ − if isempty(id)
+ − error('### This method needs at least one object id.');
+ − end
+ −
+ − if nargout == 0
+ − error('### lscov can not be used as a modifier method. Please give at least one output');
+ − end
+ −
+ − % combine plists
+ − pl = combine(pl, plist());
+ −
+ − % Algorithm
+ − % Get complete experiment information for each input id
+ − sinfo = [];
+ − for ii=1:length(id)
+ − qall = ['select name,experiment_title,experiment_desc,analysis_desc,quantity, '...
+ − 'additional_authors,additional_comments,keywords,reference_ids FROM objmeta ' ...
+ − sprintf('where objmeta.obj_id=%d',id(ii))];
+ −
+ − infoall = utils.mysql.dbquery(conn, qall);
+ − s.conn = conn;
+ − s.name = infoall{1};
+ − s.experiment_title = infoall{2};
+ − s.experiment_description = infoall{3};
+ − s.analysis_description = infoall{4};
+ − s.quantity = infoall{5};
+ − s.additional_authors = infoall{6};
+ − s.additional_comments = infoall{7};
+ − s.keywords = infoall{8};
+ − s.reference_ids = infoall{9};
+ − sinfo = [sinfo s];
+ − end
+ −
+ − % Set output
+ − varargout{1} = sinfo;
+ − end