slick

Slick 3.1 - Printing SQL from DBIOAction (insert statements)

ε祈祈猫儿з 提交于 2019-12-23 06:58:05
问题 In Slick 3.1, with the complete redesign of the new API, it seems to be impossible to view the generated SQL statements when doing an insert. If you have something like this val action = DBIO.seq( SomeTables ++= Seq(TableData(1,"First"),TableData(2,"Second")) ) It doesn't seem you are actually able to see the generated SQL from the action . The result method doesn't actually exist, and variations of statements just print ? in place of the actual values if you don't use DBIO.seq , if you are

Slick 3.1 - Printing SQL from DBIOAction (insert statements)

余生长醉 提交于 2019-12-23 06:56:11
问题 In Slick 3.1, with the complete redesign of the new API, it seems to be impossible to view the generated SQL statements when doing an insert. If you have something like this val action = DBIO.seq( SomeTables ++= Seq(TableData(1,"First"),TableData(2,"Second")) ) It doesn't seem you are actually able to see the generated SQL from the action . The result method doesn't actually exist, and variations of statements just print ? in place of the actual values if you don't use DBIO.seq , if you are

compare 2 dates in a slick query seems hard

耗尽温柔 提交于 2019-12-23 03:15:32
问题 helllo I can't adapt this example of code : https://github.com/pedrofurla/slick-demo/blob/master/src/main/scala/slickdemo/domain/Person.scala. it deals with the capacity of comparing dates in a slick query. The difficulty is you can't access to the date field(to extract for example the year, the month and the day) because the query uses Column types. I searched and found the example above, but I can't adapt it. here is my code: the Table: class Personnes( tag : Tag ) extends Table[ Rdv ]( tag

Scala Slick. Wrong pagination \w Postgres

二次信任 提交于 2019-12-23 01:19:28
问题 I'm trying to make simple pagination using Slick with Postgres, but it does not work as expected. // Table // "users_pkey" PRIMARY KEY, btree (id) // "users_id_idx" btree (id) val id: Column[Option[Long]] = column("id", O.PrimaryKey, O.AutoInc, O.DBType(BigSerial)) // Pagination queries users.drop(0).take(20).sortBy(_.id.desc).list users.drop(20).take(20).sortBy(_.id.desc).list But results are not ordered as expected. Users ordered by id on inside page, e.g. first page will be like 40, 35, 34

Cache Slick DBIO Actions

こ雲淡風輕ζ 提交于 2019-12-22 11:37:18
问题 I am trying to speed up "SELECT * FROM WHERE name=?" kind of queries in Play! + Scala app. I am using Play 2.4 + Scala 2.11 + play-slick-1.1.1 package. This package uses Slick-3.1 version. My hypothesis was that slick generates Prepared statements from DBIO actions and they get executed. So I tried to cache them buy turning on flag cachePrepStmts=true However I still see "Preparing statement..." messages in the log which means that PS are not getting cached! How should one instructs slick to

When overloading `apply` method: Slick error message 'value tupled is not a member of object'

放肆的年华 提交于 2019-12-22 11:33:55
问题 I need an ability to create a User object by providing all the values except id in certain cases, such that the User object takes care of assigning itself an auto-generated value. For this I have overloaded the apply method in the companion object, like shown below. But this is causing the compile time error: value tupled is not a member of object . Solutions mentioned on StackOverflow and other blogs aren't working, such as: http://queirozf.com/entries/slick-error-message-value-tupled-is-not

Scala: how to define an abstract copyable superclass for any case class?

流过昼夜 提交于 2019-12-22 11:01:40
问题 Please bear with me, there is some context until the OP makes sense. I'm using Slick 3.1.x and the slick code generator. btw The whole source code can be found in the play-authenticate-usage-scala github project. For this project I'd like to have a slick generic Dao to avoid repeating the same boilerplate code for every model. I have a postgres sql script that creates the database using evolutions here: 1.sql I then invoke a generator that generates the following data model: Tables.scala To

Slick Slider - how to keep the active pagination (dot) always centered

喜夏-厌秋 提交于 2019-12-22 10:02:22
问题 The bounty expires in 2 days . Answers to this question are eligible for a +100 reputation bounty. Revti Shah wants to draw more attention to this question. I am trying to achieve something which I haven't seen done so far on the web. I want the active pagination dot in the slick slider to always be in the center. This is the expected result: In other words I would expect the page to load showing the first slide but the pagination dot for the first slide should be centered. If a user clicks

Creating a generic update counter method

断了今生、忘了曾经 提交于 2019-12-22 10:02:16
问题 I'm trying to create a generic counter update method for a particular table. My table has many columns that are simply counters, and in my application I need to increment/decrement these counters. I was trying to create a method like this: private def updateCounter(column: String, id: Int, incr: Int)(implicit session: Session): Unit = { sqlu"update table1 set $column = $column + $incr where id=$id".first } I would then create a method that would call this (I don't want to expose this method

How do I resolve “error: bad symbolic reference” for dependencies using maven-scala plugin?

十年热恋 提交于 2019-12-22 06:18:11
问题 I'm building a small database query utility using Scala and Slick, with Maven as my build and packaging tool. My code compiles without any syntax errors, but the build fails with this: [INFO] --- maven-scala-plugin:2.15.0:compile (default) @ origdups --- [INFO] Checking for multiple versions of scala [INFO] includes = [**/*.scala,**/*.java,] [INFO] excludes = [] [INFO] /home/lreeder/dev/scala/origdups/src/main/scala:-1: info: compiling [INFO] Compiling 4 source files to /home/lreeder/dev