--
---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/0f039c2a-1b12-4473-aac9-ee489e37b6e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scalaquery/eN8YMGE-GSY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/53D10BE2.7090005%40gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/53D2475A.4020105%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Can you elaborate on the tradeoff?
Also couldn't it be fixed with an overload?
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/53D2475A.4020105%40gmail.com.
/**
** A fix for warnings when using Slick's SQL interpolation with no $vals in the string
** to use,
** import myutils.SQI.interpolation
** rather then
** import scala.slick.jdbc.StaticQuery.interpolation
**/
package myutils
class SQLInterpolation_WarningsFixed(val s: StringContext) extends AnyVal {
import scala.slick.jdbc._
def sql[P](param: P)(implicit pconv: SetParameter[P]) =
new SQLInterpolationResult[P](s.parts, param, pconv)
def sqlu[P](param: P)(implicit pconv: SetParameter[P]) = sql(param).asUpdate
// The warning occurs because when there are no $vars in the string interpolation, param is Unit
// and Scala now warns if we're not explicit about it. The methods below satisfy that need:
def sql[P]()(implicit pconv: SetParameter[Unit]) =
new SQLInterpolationResult[Unit](s.parts, (), pconv)
def sqlu[P]()(implicit pconv: SetParameter[Unit]) = sql(()).asUpdate
}
object SQI {
import scala.language.implicitConversions
@inline implicit def interpolation(s: StringContext) = new SQLInterpolation_WarningsFixed(s)
}