score:0
ok, so here you are only counting, so perhaps you just need a variable of type long
:
sql("select count(*) from user where tel = {telephonenumber}")
.on('telephobenumber -> numberthatyoupassedtothemethod).executequery()
.as(sqlparser.scalar[long].single)
you just totally changed the question, anyway, for the error you mentioned in the comment, the reason is that you have no connection as well as you did not define the database you want to use (default
or otherwise). all the database calls are within the following block:
db.withconnection{
implicit connection =>
//sql queries live here.
}
moreover you need to db
is injected if it is not the default
database:
class mytestmodel @inject()(@nameddatabase("nondefaultdb") db: database){???}
follow mvc architecture: for consistency with model-view-controller architecture, all your database calls should be within models
classes. the controller method needs to call the models method for the result.
Source: stackoverflow.com
Related Query
- how to store Select Statemnt data to var in scala play2.6 slick
- Scala Slick how can I convert a select query to Json
- How to store timestamp data on spark using Scala
- How to filter Date Columns and store them as numbers in Data Frames using Scala
- How to select 13 digit timestamp column from parquet file,convert it to date and store as a data frame?
- SELECT DISTINCT in Scala slick
- How does Scala Slick translate Scala code into JDBC?
- How do I access post data from scala play?
- Parsing JSON in Play2 and Scala without Data Type
- How to implement enums in scala slick 3?
- How do you print the select statements for the following Slick queries?
- How can I negate "inSet" in a Scala Slick query?
- Scala Slick / ScalaQuery BigDecimal creates decimal(10,0) how to allow decimals?
- How to select max, min in same query in slick
- How do you change lifted types back to Scala types when using Slick lifted embedding?
- how to get paginated select on slick + postgresql
- How to send plain SQL queries (and retrieve results) using scala slick 3
- How to read json data using scala from kafka topic in apache spark
- how can I store a scala actor reference?
- How to mock db in Scala Slick
- How can I select a non-sequential subset elements from an array using Scala and Spark?
- How to select a object field for map value in Scala using groupby
- How do I convert the following var Scala code into vals?
- How do I use Scala to parse CSV data with empty columns?
- how to store a encrypt password in mysql in scala playframework 2.2?
- Scala - How to split the probability column (column of vectors) that we obtain when we fit the GMM model to the data in to two separate columns?
- how to read immutable data structures from file in scala
- How do I exclude values when doing json Reads and Writes in my Play2 scala application
- How to check isEmpty on Column Data Spark scala
- How can I get random data generated for scala case classes with the ability to "change some values" for unit testing?
More Query from same tag
- IntelliJ doesn't recognize TypeTag in Scala
- How to use UDF in where clause in Scala Spark
- Mock actor and its response in unit test
- How to correctly use ambiguous implicits for type negation in Scala
- Avoiding redundant generic parameters in Scala
- scala compiling error: Cannot resolve overloaded method 'withTransaction'
- How to find the proper URI of a file which is present on HDFS
- Json4s support for case class with trait mixin
- Slick 3.0 many-to-many query with the join as an iterable
- SBT rpm:package-bin fails with config not found error
- Specifying MongoDBObject as content of $set
- Unable to compare lists and array in scala
- Is it instance name/id that scala REPL prints?
- Non-blocking updates of mutable state with Akka Actors
- Surfaceholder.addCallback Not Working; surfaceCreated, surfaceChanged, and surfaceDestroyed Never Being Called
- Akka doesn't load application.conf
- Zip two lists based on specific condition in Scala
- Spark java.lang.NullPointerException Error when filter spark data frame on inside foreach iterator
- how to display value of case class in scala
- How to save dataframe to Elasticsearch with mappings
- Compress Output Scalding / Cascading TsvCompressed
- Scala Sub string combinations with delimiter
- How can I run evolutions step by step?
- How to compare Scala function values for equality
- Regex for getting the number after the last delimeter of the line in Scala
- Generation of Process definition Id in activiti
- How protect spray application from overloading?
- Expression of type B => List[B] doesn’t conform to expected type List[Int] when reverse a list in Scala
- Bidirectional binding fails to bind
- Cannot save variables in Gatling session when validated with 'checkIf'