def insertIfNotExists(productInput: LocaldomainRow): Future[LocaldomainRow] = {val productAction = (selectQ.filter(_.LocaldomainId===productInput.LocaldomainId).result.headOption.flatMap {case Some(product) =>mylog("product was there: " + product)DBIO.successful(product)case None =>mylog("inserting product")(selectQ returning selectQ.map(_.LocaldomainId)into ((prod,LocaldomainId) => prod.copy(LocaldomainId=LocaldomainId))) += LocaldomainRow(0,productInput.LocaldomainDomain,productInput.LocaldomainDescription,productInput.LocaldomainName)}).transactionallyresult=db.run(productAction)}}
--
---
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/4a41f9c5-0a99-4295-9f4f-e8db887f7a45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
val f=LocalDomains.insertIfNotExists(man)
f.onComplete{
case Success(ok)=>println(ok)
case Failure(ex)=>println(ex)
}
--
---
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/d332d6c0-07a5-451f-96be-85674d074cff%40googlegroups.com.
yes that's right my program is terminating before the future has completed. How can i solve the problem
(excuse me because i'm beginning in Scala and Slick )
On Tuesday, July 11, 2017 at 1:18:35 AM UTC+4:30, Richard Dallaway wrote:One thought: perhaps your program is terminating before the future has completed.On Mon, 10 Jul 2017 at 19:00 <techlan...@gmail.com> wrote:val f=LocalDomains.insertIfNotExists(man)
f.onComplete{
case Success(ok)=>println(ok)
case Failure(ex)=>println(ex)
}i call insertIfNotExists like this but not print any in my console ? how can saw sql command execute ?--
---
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/d332d6c0-07a5-451f-96be-85674d074cff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
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/7bb0587d-92ea-432d-b561-455043a2adc2%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/7bb0587d-92ea-432d-b561-455043a2adc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/CAF_XbzDS-DT4v93-gQ_%3DgR47EvkSHUdoFo0ghknk4sRZx2YmTg%40mail.gmail.com.