take(n)ã§æ´æ°ä»¶æ°ãçµããã¨ã¯ã§ããªãããã
ä¹ ã ã«Play Frameworkããã£ã¦ããã¤ãã§ã«Play-Slickå°å ¥ãã¦ããã JSONãPOSTãã¦JSONãè¿ãã ãã®ç°¡åãªãµã¼ãã¹ãæ¸ãã¦ã¿ãããå¤ãªã¨ããã§ã¯ã¾ã£ãã
// ã¦ãã¼ã¯ã«ãªãã¨ã¯éããªãã¯ã¨ãª val q1 = tbl.filter(_.name === name).map(_.color) val q2 = tbl.filter(_.name === name).map(_.color).take(1) // ããã¯éã q1.update("#cccccc") // ããã¯éããªã q2.update("#cccccc")
æ´æ°ãããè¡ã¯ä¸è¡ãªã®ã§takeããã®ãã¾ããã£ãæ§åãå
¨é¨æ¸ãæããã®ãæ®éã ããããæ¤ç´¢æ¡ä»¶ã®æç¹ã§æ´æ°ãããè¡ããåããªãããè¨å®ãã¦ããã¨ãããã¨ãã
ã¡ãªã¿ã«ãå¾è
ãå®è¡ããã¨ãããªã¹ã¿ãã¯ãã¬ã¼ã¹ãåãããã
ç§ã®è±èªåã§ã¯æå³ããã¨ãããã¤ãããªãã£ãã
play.api.Application$$anon$1: Execution exception[[SlickException: A query for an UPDATE statement must resolve to a comprehension with a single table -- Unsupported shape: Comprehension(fetch = None, offset = None)]] at play.api.Application$class.handleError(Application.scala:296) ~[play_2.10-2.3.0.jar:2.3.0] at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.10-2.3.0.jar:2.3.0] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.0.jar:2.3.0] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.10-2.3.0.jar:2.3.0] at scala.Option.map(Option.scala:145) [scala-library.jar:na] Caused by: scala.slick.SlickException: A query for an UPDATE statement must resolve to a comprehension with a single table -- Unsupported shape: Comprehension(fetch = None, offset = None) at scala.slick.driver.JdbcStatementBuilderComponent$QueryBuilder.buildUpdate(JdbcStatementBuilderComponent.scala:313) ~[slick_2.10-2.0.2.jar:2.0.2] at scala.slick.driver.JdbcProfile$$anonfun$updateCompiler$1.apply(JdbcProfile.scala:34) ~[slick_2.10-2.0.2.jar:2.0.2] at scala.slick.driver.JdbcProfile$$anonfun$updateCompiler$1.apply(JdbcProfile.scala:34) ~[slick_2.10-2.0.2.jar:2.0.2] at scala.slick.jdbc.JdbcMappingCompilerComponent$JdbcCodeGen$$anonfun$apply$2.apply(JdbcMappingCompilerComponent.scala:42) ~[slick_2.10-2.0.2.jar:2.0.2] at scala.slick.jdbc.JdbcMappingCompilerComponent$JdbcCodeGen$$anonfun$apply$2.apply(JdbcMappingCompilerComponent.scala:41) ~[slick_2.10-2.0.2.jar:2.0.2]