Mercurial > hg > ltpda
comparison m-toolbox/classes/tests/database/@ltpda_database/getTableEntry.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children | 79dc7091dbbc |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % | |
2 % DESCRIPTION: Returns a table enty for the given inputs: database table, | |
3 % column name, object ID | |
4 % | |
5 % VERSION: $Id: getTableEntry.m,v 1.2 2011/05/25 16:20:37 ingo Exp $ | |
6 % | |
7 function val = getTableEntry(utp, dbTable, tableField, objID) | |
8 | |
9 utp.conn.setLocked(true); | |
10 utp.conn.openConnection(); | |
11 c = utp.conn.getConn(); | |
12 | |
13 q = sprintf('SELECT %s.%s FROM %s WHERE %s.obj_id=%d', dbTable, tableField, dbTable, dbTable, objID); | |
14 try | |
15 val = utils.jmysql.execute(c, q); | |
16 catch Me | |
17 utp.conn.setLocked(false); | |
18 utp.conn.closeConnection(); | |
19 rethrow(Me); | |
20 end | |
21 | |
22 utp.conn.setLocked(false); | |
23 utp.conn.closeConnection(); | |
24 end |