Mercurial > hg > ltpda
comparison m-toolbox/classes/+utils/@mysql/getUserID.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % GETUSERID gets the user ID number corresponding to the given user name. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: GETUSERID gets the user ID number corresponding to the | |
5 % user name that connected to the MySQL database. | |
6 % | |
7 % CALL: userid = getUserID(conn) | |
8 % | |
9 % VERSION: $Id: getUserID.m,v 1.3 2010/01/22 12:46:08 ingo Exp $ | |
10 % | |
11 % HISTORY: 24-05-2007 M Hewitson | |
12 % Creation | |
13 % | |
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
15 | |
16 function [userid,dbuser] = getUserID(conn, username) | |
17 | |
18 error('### Obsolete as of LTPDA version 2.2. Replaced my the utils class jmysql (utils.jmysql.%s)', mfilename()); | |
19 | |
20 userid = []; | |
21 try | |
22 q = sprintf('select id from users where username="%s"', conn.Username); | |
23 curs = exec(conn, q); | |
24 curs = fetch(curs); | |
25 userid = curs.Data{1}; | |
26 close(curs); | |
27 catch curs | |
28 warning('!!! Unable to retrieve user ID. [Server returned: %s]', curs.message); | |
29 end | |
30 | |
31 end | |
32 |