MCPcopy Create free account
hub / github.com/OWASP/SecurityShepherd / getUserIdFromName

Method getUserIdFromName

src/main/java/dbProcs/Getter.java:1809–1832  ·  view source on GitHub ↗

@param ApplicationRoot The current running context of the application @param userName The username of the user @return The user id of the submitted user name

(String ApplicationRoot, String userName)

Source from the content-addressed store, hash-verified

1807 * @return The user id of the submitted user name
1808 */
1809 public static String getUserIdFromName (String ApplicationRoot, String userName)
1810 {
1811 log.debug("*** Getter.getUserIdFromName ***");
1812 String result = new String();
1813 Connection conn = Database.getCoreConnection(ApplicationRoot);
1814 try
1815 {
1816 CallableStatement callstmt = conn.prepareCall("call userGetIdByName(?)");
1817 log.debug("Gathering userGetIdByName ResultSet");
1818 callstmt.setString(1, userName);
1819 ResultSet resultSet = callstmt.executeQuery();
1820 log.debug("Opening Result Set from userGetIdByName");
1821 resultSet.next();
1822 result = resultSet.getString(1);
1823 }
1824 catch (SQLException e)
1825 {
1826 log.error("Could not execute query: " + e.toString());
1827 result = null;
1828 }
1829 Database.closeConnection(conn);
1830 log.debug("*** END getUserIdFromName ***");
1831 return result;
1832 }
1833
1834 /**
1835 * @param ApplicationRoot The current running context of the application

Calls 2

getCoreConnectionMethod · 0.95
closeConnectionMethod · 0.95