So far as I realize the only real factor LINQ supports, which Scala presently does not using its collection library, may be the integration having a SQL Database.

So far as I realize LINQ can "accumulate" various procedures and may give "the entireInch statement towards the database when queried to process it there, stopping that the simple SELECT first copies the entire table into data structures from the VM.

If I am wrong, I'd gladly be remedied.

Otherwise, what's essential to offer the same in Scala?

Would it not possible to create a library which implements the gathering interface, but does not have data structures backing it but a String which will get put together with following collection in to the needed Database statement?

Or am I drastically wrong with my findings?

I ought to point out that Scala comes with experimental support for expression trees. Should you pass an anonymous work as a disagreement to some method expecting a parameter of type scala.reflect.Code[A], you receive an AST.

scala> import scala.reflect.Code      
import scala.reflect.Code 
scala> def codeOf[A](code: Code[A]) = code
codeOf: [A](code:scala.reflect.Code[A])scala.reflect.Code[A]
scala> codeOf((x: Int) => x * x).tree 
res8: scala.reflect.Tree=Function(List(LocalValue(NoSymbol,x,PrefixedType(ThisType(Class(scala)),Class(scala.Int)))),Apply(Select(Ident(LocalValue(NoSymbol,x,PrefixedType(ThisType(Class(scala)),Class(scala.Int)))),Method(scala.Int.$times,MethodType(List(LocalValue(NoSymbol,x$1,PrefixedType(ThisType(Class(scala)),Class(scala.Int)))),PrefixedType(ThisType(Class(scala)),Class(scala.Int))))),List(Ident(LocalValue(NoSymbol,x,PrefixedType(ThisType(Class(scala)),Class(scala.Int)))))))

This has been utilized within the bytecode generation library 'Mnemonics', that was presented by its author Johannes Rudolph at Scala Days 2010.

Because the author of ScalaQuery, I do not cash to increase Stilgar's explanation. Negligence LINQ that is missing in Scala is definitely the expression trees. That's the key reason why ScalaQuery works its computations on Column and Table types rather than the fundamental kinds of individuals organizations.

You declare a table like a Table object having a projection (tuple) of their posts, 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
} and User.title are actually of type Column[Int] and Column[String] correspondingly. All computations are carried out within the Query monad (the industry natural representation of database queries compared to SQL claims that has to be produced from this). Go ahead and take following query:

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

After a little implicit conversions and desugaring this means:

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

The filter and map techniques don't have to inspect their arguments as expression trees to be able to build the query, they simply run them. As you can tell in the types, what looks superficially like " < 5:Int" is really "[Int] <[Int]". Running this expression produces a query AST like Operator.Relational("<", NamedColumn("user", "id"), ConstColumn(5)). Similarly, the "filter" and "map" techniques from the Query monad don't really perform blocking and mapping but rather develop an AST that describes these procedures.

The QueryBuilder then uses this AST to create the particular SQL statement for that database (having a DBMS-specific syntax).

An alternate approach continues to be taken by ScalaQL which utilizes a compiler wordpress plugin to operate directly with expression trees, make sure that they merely retain the language subset that is permitted in database queries, and construct the queries statically.