Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@repository/getCollectionIDs.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 |
comparison
equal
deleted
inserted
replaced
10:75007001cbfe | 11:9174aadb93a5 |
---|---|
1 function ids = getCollectionIDs(conn, cid) | |
2 % GETCOLLECTIONIDS Return the IDs of the object composing a collection. | |
3 % | |
4 % CALL: | |
5 % | |
6 % ids = utils.repository.getCollectionIDs(conn, cid) | |
7 % | |
8 % PARAMETERS: | |
9 % | |
10 % CONN database connection implementing java.sql.Connection | |
11 % CID collection id | |
12 % | |
13 | |
14 rows = utils.mysql.execute(conn, 'SELECT nobjs, obj_ids FROM collections WHERE id = ?', cid); | |
15 if isempty(rows) | |
16 error('### collection %d not found', cid); | |
17 end | |
18 nobjs = rows{1}; | |
19 ids = strread(rows{2}, '%d', 'delimiter', ','); | |
20 if length(ids) ~= nobjs | |
21 error('### inconsistent collection description'); | |
22 end | |
23 % transform column vector in row vector | |
24 ids = ids'; | |
25 | |
26 end |