Skip to content

Instantly share code, notes, and snippets.

@chad
Created July 10, 2013 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chad/5964015 to your computer and use it in GitHub Desktop.
Save chad/5964015 to your computer and use it in GitHub Desktop.
hello nilanjan
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import play.api.db.slick.Config.driver.simple._
import play.api.db.slick.Config.driver.simple._
scala> new play.core.StaticApplication(new java.io.File("."))[info] play - database [default] connected at jdbc:mysql://localhost/scala_speakers?characterEncoding=UTF8
[info] play - Application started (Prod)
res0: play.core.StaticApplication = play.core.StaticApplication@4aa65618
scala> import play.api.Play.currentimport play.api.Play.current
scala> import models.alltables._
import models.alltables._
scala> import models._
import models._
scala> DB.withSession { implicit session =>
| val q = for {
| t <- Query(talks)
|
| s <- t.speaker
| } yield { (t.description, s.name) }
| q.list()
| }
<console>:18: error: not found: value DB
DB.withSession { implicit session =>
^
scala> import play.api.db.slick._
import play.api.db.slick._
scala> DB.withSession { implicit session =>
| val q = for {
| t <- Query(talks)
|
| s <- t.speaker
| } yield { (t.description, s.name) }
| q.list()
| }
res2: List[(String, String)] = List((blah,Dave))
scala> DB.withSession { implicit session =>
| val q = for {
| t <- talks
|
| s <- t.speaker
| } yield { (t.description, s.name) }
| q.list()
| }
res3: List[(String, String)] = List((blah,Dave))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment