0
用下面的DB腳本:斯卡拉ANORM選擇查詢
# Tasks schema
# --- !Ups
CREATE TABLE HashToUrl (
hash integer,
url varchar(255)
);
# --- !Downs
DROP TABLE HashToUrl;
...爲什麼我得到這個錯誤:
[NoSuchElementException: key not found: hash]
...這種方法
def getTask(hash: Int): String = DB.withConnection { implicit c =>
val result = SQL(
"""
select count(*) as url from HashToUrl where hash={hash}
"""
).apply().head
val url = result[String]("url")
url
}