comparison 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
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % GETSINFO This function returns an sinfo object containing many useful information about an object retrieved from the repository
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % usage: sinfo = getsinfo(id, conn)
5 %
6 % inputs: id = obj_id from objmeta table
7 % conn = utils.mysql.connect(server, dbname);
8 %
9 % outputs: sinfo cell array object containing info about object having the
10 % given obj_id on the repository.
11 % sinfo contains the following fields:
12 % - name
13 % - experiment_title
14 % - experiment_desc
15 % - analysis_desc
16 % - quantity
17 % - additional_authors
18 % - additional_comments
19 % - keywords and reference_ids
20 %
21 % A Monsky 05-02-2009
22 %
23 % version: $Id: getsinfo.m,v 1.6 2011/03/29 13:40:17 hewitson Exp $
24 %
25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 function [varargout] = getsinfo(varargin)
27
28 error('### Obsolete as of LTPDA version 2.2. Replaced my the utils class jmysql (utils.jmysql.%s)', mfilename());
29
30 import utils.const.*
31 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename);
32
33 % Collect input variable names
34 in_names = cell(size(varargin));
35 for ii = 1:nargin,in_names{ii} = inputname(ii);end
36
37 % Collect all ids and plists and connections
38 pl = utils.helper.collect_objects(varargin(:), 'plist');
39 id = utils.helper.collect_objects(varargin(:), 'double');
40 conn = utils.helper.collect_objects(varargin(:), 'database');
41
42 if isempty(conn)
43 error('### This method needs a MATLAB connection.');
44 end
45
46 if isempty(id)
47 error('### This method needs at least one object id.');
48 end
49
50 if nargout == 0
51 error('### lscov can not be used as a modifier method. Please give at least one output');
52 end
53
54 % combine plists
55 pl = combine(pl, plist());
56
57 % Algorithm
58 % Get complete experiment information for each input id
59 sinfo = [];
60 for ii=1:length(id)
61 qall = ['select name,experiment_title,experiment_desc,analysis_desc,quantity, '...
62 'additional_authors,additional_comments,keywords,reference_ids FROM objmeta ' ...
63 sprintf('where objmeta.obj_id=%d',id(ii))];
64
65 infoall = utils.mysql.dbquery(conn, qall);
66 s.conn = conn;
67 s.name = infoall{1};
68 s.experiment_title = infoall{2};
69 s.experiment_description = infoall{3};
70 s.analysis_description = infoall{4};
71 s.quantity = infoall{5};
72 s.additional_authors = infoall{6};
73 s.additional_comments = infoall{7};
74 s.keywords = infoall{8};
75 s.reference_ids = infoall{9};
76 sinfo = [sinfo s];
77 end
78
79 % Set output
80 varargout{1} = sinfo;
81 end