Created
November 2, 2019 19:25
-
-
Save patientplatypus/822b6d3ee2290fd0b1774733dc1636fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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