Mercurial > hg > ltpda
annotate m-toolbox/classes/@ltpda_uo/retrieve.m @ 49:0bcdf74587d1 database-connection-manager
Cleanup
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:36 +0100 |
parents | a59cdb8aaf31 |
children |
rev | line source |
---|---|
0 | 1 % RETRIEVE retrieves a collection of objects from an LTPDA repository. |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: This static method retrieves a collection of objects from an | |
5 % LTPDA repository. | |
6 % | |
7 % CALL: objs = retrieve(conn, obj_id_1, obj_id_2) | |
8 % [o1,o2] = retrieve(conn, obj_id_1, obj_id_2) | |
9 % [o1,o2] = retrieve(conn, 'binary', obj_id_1, obj_id_2) | |
10 % objs = retrieve(conn, 'Collection', coll_id) | |
11 % objs = retrieve(conn, 'binary', 'Collection', coll_id) | |
12 % | |
13 % INPUTS: | |
14 % conn - database connection object | |
15 % obj_id_N - an object ID | |
16 % coll_id - a collection ID | |
17 % 'binary' - to retrieve a binary representation of the object | |
18 % (if stored) | |
19 % | |
20 % OUTPUTS: | |
21 % objs - the retrieved object(s) as a cell array.* | |
22 % o1,o2,...,oN - returns the first N objects | |
23 % | |
24 % | |
25 % If more than one object is retrieved and only one output is specified | |
26 % then the output is a cell array of objects. | |
27 % | |
28 % If only a single object is requested, it is returned as an object, | |
29 % not packed in a cell array. | |
30 % | |
43 | 31 % VERSION: $Id: retrieve.m,v 1.29 2011/11/30 06:49:01 hewitson Exp $ |
0 | 32 % |
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
34 | |
49 | 35 function varargout = retrieve(conn, varargin) |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
36 |
0 | 37 import utils.const.* |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
38 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
39 |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
40 if numel(varargin) < 2 |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
41 error('### invalid usage'); |
0 | 42 end |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
43 |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
44 % connection |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
45 if ~isa(conn, 'java.sql.Connection') |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
46 error('### the first argument should be a java.sql.Connection object'); |
0 | 47 end |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
48 |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
49 binary = false; |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
50 if ischar(varargin{1}) && strcmpi(varargin{1}, 'binary') |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
51 % binary |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
52 binary = true; |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
53 varargin = varargin(2:end); |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
54 utils.helper.msg(msg.PROC1, 'binary retrieve'); |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
55 end |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
56 |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
57 if ischar(varargin{1}) && strcmpi(varargin{1}, 'collection') |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
58 % collection |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
59 cid = varargin{2}; |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
60 varargin = varargin(3:end); |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
61 if ~isempty(varargin) |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
62 error('### wrong number of arguments'); |
0 | 63 end |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
64 utils.helper.msg(msg.PROC1, 'retrieving collection %d', cid); |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
65 |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
66 % get list of object IDs from the collection ID |
12
86aabb42dd84
Use utils.repository utilities
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
10
diff
changeset
|
67 ids = utils.repository.getCollectionIDs(conn, cid); |
49 | 68 |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
69 else |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
70 % IDs list |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
71 if isnumeric([varargin{:}]) |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
72 ids = [varargin{:}]; |
0 | 73 else |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
74 error('### invalid usage'); |
0 | 75 end |
8
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
76 end |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
77 |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
78 utils.helper.msg(msg.PROC1, ['retrieving objects' sprintf(' %d', ids)]); |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
79 |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
80 % output vector |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
81 objs = []; |
2f5c9bd7d95d
Clarify ltpda_uo.retrieve parameters handling
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
7
diff
changeset
|
82 |
0 | 83 try |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
84 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
85 % get username and user id |
12
86aabb42dd84
Use utils.repository utilities
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
10
diff
changeset
|
86 [username, userid] = utils.repository.getUser(conn); |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
87 |
0 | 88 v = ver('LTPDA'); |
89 for j=1:length(ids) | |
90 | |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
91 rows = utils.mysql.execute(conn, 'SELECT version, obj_type FROM objmeta WHERE obj_id = ?', ids(j)); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
92 if isempty(rows) |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
93 error('### object %d not found', ids(j)); |
0 | 94 end |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
95 objver = rows{1}; |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
96 objtype = rows{2}; |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
97 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
98 % it is only possible to download the object if the object in the |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
99 % database was submitted with the same or lower LTPDA version as |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
100 % the current version |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
101 if utils.helper.ver2num(v.Version) < utils.helper.ver2num(objver) |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
102 error(['### object %d was submitted with newer LTPDA version (%s) '... |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
103 'than this one (%s). please update'], ids(j), objver, v.Version); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
104 end |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
105 |
0 | 106 if binary |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
107 % binary download |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
108 |
0 | 109 % Retrieve the bytes |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
110 rows = utils.mysql.execute(conn, 'SELECT mat FROM bobjs WHERE obj_id = ?', ids(j)); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
111 if isempty(rows) |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
112 error('### failed to get binary data for object %d', ids(j)); |
0 | 113 end |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
114 dd = rows{1}; |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
115 |
0 | 116 % Write bytes out to a temp MAT file |
117 fname = [tempname '.mat']; | |
118 fd = fopen(fname, 'w+'); | |
119 fwrite(fd, dd, 'int8'); | |
120 fclose(fd); | |
121 % Load the MAT data to a structure | |
122 obj = load(fname); | |
123 % Delete temp file | |
124 delete(fname); | |
125 % Get the struct out | |
126 obj = obj.objs; | |
127 | |
128 % Check if the retrieved object is a struct | |
129 if isstruct(obj) | |
130 % Call the constructor with this struct | |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
131 fcn_name = [objtype '.update_struct']; |
0 | 132 obj = feval(fcn_name, obj, obj.tbxver); |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
133 obj = feval(objtype, obj); |
0 | 134 end |
135 % Add tyo object array | |
136 objs = [objs {obj}]; | |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
137 |
0 | 138 else |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
139 % xml download |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
140 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
141 % get xml |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
142 rows = utils.mysql.execute(conn, 'SELECT xml FROM objs WHERE id = ?', ids(j)); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
143 if isempty(rows) |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
144 error('### failed to get data for object %d', ids(j)); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
145 end |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
146 |
10
75007001cbfe
Check for binary only objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
9
diff
changeset
|
147 % check xml |
75007001cbfe
Check for binary only objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
9
diff
changeset
|
148 if strcmp(rows{1}(1:13), 'binary submit') |
75007001cbfe
Check for binary only objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
9
diff
changeset
|
149 error('### object %d has binary representation only', ids(j)); |
75007001cbfe
Check for binary only objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
9
diff
changeset
|
150 end |
49 | 151 |
152 % parse xml | |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
153 stream = java.io.StringBufferInputStream(java.lang.String(rows{1})); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
154 builder = javax.xml.parsers.DocumentBuilderFactory.newInstance.newDocumentBuilder(); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
155 xdoc = builder.parse(stream); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
156 obj = utils.xml.xmlread(xdoc); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
157 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
158 % add to output array |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
159 objs = [objs {obj}]; |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
160 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
161 % make transaction entry |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
162 t = time().format('yyyy-mm-dd HH:MM:SS', 'UTC'); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
163 utils.mysql.execute(conn, ['INSERT INTO transactions (obj_id, user_id, transdate, direction) ' ... |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
164 'VALUES (?, ?, ?, ?)'], ids(j), userid, t, 'out'); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
165 utils.helper.msg(msg.PROC1, 'updated transactions table'); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
166 end |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
167 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
168 end |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
169 |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
170 catch ex |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
171 utils.helper.msg(msg.PROC1, '### retrieve error'); |
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
172 rethrow(ex) |
0 | 173 end |
7
1e91f84a4be8
Make ltpda_up.retrieve work with java.sql.Connection objects
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
0
diff
changeset
|
174 |
0 | 175 % Set outputs |
176 if nargout == 1 | |
177 if length(objs) == 1 | |
178 varargout{1} = objs{1}; | |
179 else | |
180 varargout{1} = objs; | |
181 end | |
182 else | |
183 for k=1:nargout | |
184 varargout{k} = objs{k}; | |
185 end | |
186 end | |
187 end |