view m-toolbox/classes/tests/database/@ltpda_database/getTableEntry.m @ 7:1e91f84a4be8
database-connection-manager
Make ltpda_up.retrieve work with java.sql.Connection objects
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
79dc7091dbbc |
line source
%
% DESCRIPTION: Returns a table enty for the given inputs: database table,
% column name, object ID
%
% VERSION: $Id: getTableEntry.m,v 1.2 2011/05/25 16:20:37 ingo Exp $
%
function val = getTableEntry(utp, dbTable, tableField, objID)
utp.conn.setLocked(true);
utp.conn.openConnection();
c = utp.conn.getConn();
q = sprintf('SELECT %s.%s FROM %s WHERE %s.obj_id=%d', dbTable, tableField, dbTable, dbTable, objID);
try
val = utils.jmysql.execute(c, q);
catch Me
utp.conn.setLocked(false);
utp.conn.closeConnection();
rethrow(Me);
end
utp.conn.setLocked(false);
utp.conn.closeConnection();
end