Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3459944
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:10:10+00:00 2026-05-18T10:10:10+00:00

As far as I understand the only thing LINQ supports, which Scala currently doesn’t

  • 0

As far as I understand the only thing LINQ supports, which Scala currently doesn’t with its collection library, is the integration with a SQL Database.

As far as I understand LINQ can “accumulate” various operations and can give “the whole” statement to the database when queried to process it there, preventing that a simple SELECT first copies the whole table into data structures of the VM.

If I’m wrong, I would be happy to be corrected.

If not, what is necessary to support the same in Scala?

Wouldn’t it possible to write a library which implements the collection interface, but doesn’t have any data structures backing it but a String which gets assembled with following collection into the required Database statement?

Or am I completely wrong with my observations?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:10:11+00:00Added an answer on May 18, 2026 at 10:10 am

    As the author of ScalaQuery, I don’t have much to add to Stilgar’s explanation. The part of LINQ which is missing in Scala is indeed the expression trees. That is the reason why ScalaQuery performs all its computations on Column and Table types instead of the basic types of those entities.

    You declare a table as a Table object with a projection (tuple) of its columns, e.g.:

    class User extends Table[(Int, String)] {
      def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
      def name = column[String]("name")
      def * = id ~ name
    }
    

    User.id and User.name are now of type Column[Int] and Column[String] respectively. All computations are performed in the Query monad (which is a more natural representation of database queries than the SQL statements that have to be created from it). Take the following query:

    val q = for(u <- User if u.id < 5) yield u.name
    

    After some implicit conversions and desugaring this translates to:

    val q:Query[String] =
      Query[User.type](User).filter(u => u.id < ConstColumn[Int](5)).map(u => u.name)
    

    The filter and map methods do not have to inspect their arguments as expression trees in order to build the query, they just run them. As you can see from the types, what looks superficially like “u.id:Int < 5:Int” is actually “u.id:Column[Int] < u.id:Column[Int]”. Running this expression results in a query AST like Operator.Relational(“<“, NamedColumn(“user”, “id”), ConstColumn(5)). Similarly, the “filter” and “map” methods of the Query monad do not actually perform filtering and mapping but instead build up an AST that describes these operations.

    The QueryBuilder then uses this AST to construct the actual SQL statement for the database (with a DBMS-specific syntax).

    An alternative approach has been taken by ScalaQL which uses a compiler plugin to work directly with expression trees, ensure that they only contain the language subset which is allowed in database queries, and construct the queries statically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As far as I understand, if you only declare a checked exception it will
As far as I understand it, each transaction sees its own version of the
As far as I understand it, there is no way in Scala to have
As far as I understand, https is http plus SSL/TLS. What do I need
As far as I understand, the onchange event of a text input element is
As far as I understand the serial port so far, transferring data is done
As far as I understand WebRequest.PreAuthenticate is almost always good. If I enable it
As far as I understand the branch-on-sign is the name of some kind of
As far as I understand Objective C / iOS is very dynamic language, so
As far as I understand, visitor pattern is often used to add methods to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.