0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 function ts = fromRepository(f, pli)
0016
0017 VERSION = '$Id: fromRepository.m,v 1.3 2008/08/11 13:14:35 hewitson Exp $';
0018
0019 ii = timespan.getInfo('timespan', 'From Repository');
0020
0021
0022 ii.setMversion([VERSION '-->' ii.mversion]);
0023
0024
0025 pl = combine(pli, ii.plists);
0026
0027
0028 conn = find(pl, 'conn');
0029 hostname = find(pl, 'hostname');
0030 database = find(pl, 'database');
0031 ids = find(pl, 'id');
0032
0033
0034 closeConn = 0;
0035 if isempty(conn)
0036 closeConn = 1;
0037
0038 conn = utils.mysql.connect(hostname, database);
0039 end
0040 if ~isa(conn, 'database')
0041 error('### connection failed.');
0042 end
0043
0044
0045 Nids = length(ids);
0046 ts = [];
0047 for kk=1:Nids
0048
0049
0050 id = ids(kk);
0051 utils.helper.msg(utils.const.msg.OPROC2, 'retrieving ID %d', id);
0052
0053
0054 tt = utils.mysql.getObjType(conn, id);
0055
0056 if strcmp(tt, mfilename)
0057
0058 a = ltpda_uo.retrieve(conn, id);
0059
0060
0061 ts = [ts a];
0062 else
0063 warning(' !skipping ID %d, type %s', id, tt);
0064 end
0065
0066 end
0067
0068
0069 if closeConn
0070 close(conn);
0071 end
0072
0073 end
0074