Skip to content

Instantly share code, notes, and snippets.

@patientplatypus
Created November 2, 2019 19:25
Show Gist options
  • Save patientplatypus/822b6d3ee2290fd0b1774733dc1636fd to your computer and use it in GitHub Desktop.
Save patientplatypus/822b6d3ee2290fd0b1774733dc1636fd to your computer and use it in GitHub Desktop.
//I have the following code
val password_hash_db = Future{
database.db.withConnection { implicit connection =>
SQL("SELECT * FROM user WHERE username = {username}").on("username"->newAdmin.username)
// .as(SqlParser.str("user.password_hash").single)
}
}(ec)
//when the `.as` statement is included I get the following error:
anorm.AnormException: SqlMappingError(No rows when expecting a single one)
//otherwise I get the following:
SimpleSql(SqlQuery(TokenizedStatement(List(TokenGroup(List("SELECT * FROM user WHERE username = "), Some(username))),List(username)), List(username), timeout = None, fetchSize = None),Map(username -> ParameterValue("patientplatypus")),<function1>,false)
//after I denest the future
//How do I return the value of password_hash and why am I getting an exception when the row is properly returning?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment