0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % DESCRIPTION: Returns a table enty for the given inputs: database table,
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % column name, object ID
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % VERSION: $Id: getTableEntry.m,v 1.2 2011/05/25 16:20:37 ingo Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 function val = getTableEntry(utp, dbTable, tableField, objID)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 utp.conn.setLocked(true);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 utp.conn.openConnection();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 c = utp.conn.getConn();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 q = sprintf('SELECT %s.%s FROM %s WHERE %s.obj_id=%d', dbTable, tableField, dbTable, dbTable, objID);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 val = utils.jmysql.execute(c, q);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 catch Me
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 utp.conn.setLocked(false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 utp.conn.closeConnection();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 rethrow(Me);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 utp.conn.setLocked(false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 utp.conn.closeConnection();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 end
|