protected RealmUser fetchByName(final String name)
throws SQLException
{
final Slot<RealmUser> u = new Slot<RealmUser>();
final DBConnection connection = getConnection();
try {
connection.query(REALM_USER_BY_ALIAS, new DBQueryHandler() {
public void prepare(PreparedStatement s)
throws SQLException
{
s.setInt(1,realm.getId());
s.setString(2,name);
}
public void onResults(ResultSet set)
throws SQLException
{
if (set.next()) {
User user = userCache.get(set.getInt(2));
u.set(new RealmUser(AuthDB.this,set.getInt(1),realm,user,name,set.getString(3),set.getString(4)));
}
}
});
} finally {
release(connection);
}
if (u.get()==null) {
final User user = userCache.getNamed(name);
if (user!=null) {
final DBConnection connection2 = getConnection();
try {
connection2.query(REALM_USER_BY_INHERITED_ALIAS, new DBQueryHandler() {
public void prepare(PreparedStatement s)
throws SQLException
{
s.setInt(1,realm.getId());
s.setInt(2,user.getId());