statement = assembly.createStatement(connection);
set = statement.executeQuery();
if (set.next())
throw new RegistrationException(
"Email address is already in use by another user.");
close(null, statement, set);
assembly = new StatementAssembly();
assembly.newLine("SELECT PERSON_ID");
assembly.newLine("FROM PERSON");
assembly.newLine("WHERE ");
assembly.add("LOWER(FIRST_NAME) = ");
assembly.addParameter(trimmedFirstName);
assembly.addSep(" AND ");
assembly.add("LOWER(LAST_NAME) = ");
assembly.addParameter(trimmedLastName);
statement = assembly.createStatement(connection);
set = statement.executeQuery();
if (set.next())
throw new RegistrationException(
"Name provided is already in use by another user.");
}
catch (SQLException e)
{
throw new RegistrationException("Could not access database: "
+ e.getMessage(), e);
}
finally
{
close(connection, statement, set);