slick

compiler

package compiler

Slick AST to database query compiler

Source
package.scala
Linear Supertypes
AnyRef, Any
Content Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. compiler
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. class AssignTypes extends Phase

    Compute type information for all nodes in the AST.

    Compute type information for all nodes in the AST. The actual typing rules are embedded in the nodes themselves.

  2. class AssignUniqueSymbols extends Phase

    Ensure that all symbol definitions in a tree are unique.

    Ensure that all symbol definitions in a tree are unique. The same symbol can initially occur in multiple sub-trees when some part of a query is reused multiple times. This phase assigns new, uniqe symbols, so that later phases do not have to take scopes into account for identifying the source of a symbol. The rewriting is performed for both, term symbols and type symbols.

  3. abstract class CodeGen extends Phase

    A standard skeleton for a code generator phase.

  4. class CompilerState extends AnyRef

    The current state of a compiler run, consisting of the current AST and additional immutable state of individual phases.

    The current state of a compiler run, consisting of the current AST and additional immutable state of individual phases. Mutability is confined to the SymbolNamer. The state is tied to a specific compiler instance so that phases can call back into the compiler.

  5. class ConvertToComprehensions extends Phase

    Conversion of basic ASTs to a shape suitable for relational DBs.

    Conversion of basic ASTs to a shape suitable for relational DBs. This phase replaces all nodes of types Bind, Filter, SortBy, Take and Drop by Comprehension nodes and merges nested Comprehension nodes.

  6. class CreateResultSetMapping extends Phase

    Create a ResultSetMapping root node, ensure that the top-level server-side node returns a collection, and hoist client-side type conversions into the ResultSetMapping.

  7. class EmulateOuterJoins extends Phase

    An optional phase which rewrites outer joins into more commonly supported operations for use on databases that lack outer join support.

    An optional phase which rewrites outer joins into more commonly supported operations for use on databases that lack outer join support.

    Full outer joins are always emulated. Right joins can be replaced by left joins (or an emulated version thereof). Left joins can be emulated with inner joins and unions.

  8. class ExpandConditionals extends Phase

    Expand multi-column conditional expressions and SilentCasts created by expandSums.

    Expand multi-column conditional expressions and SilentCasts created by expandSums. Single-column conditionals involving NULL values are optimized away where possible.

  9. class ExpandRecords extends Phase

    Expand paths of record types to reference all fields individually and recreate the record structure at the call site.

  10. class ExpandSums extends Phase

    Expand sum types and their catamorphisms to equivalent product type operations.

  11. class ExpandTables extends Phase

    Expand table-valued expressions in the result type to their star projection.

  12. class FixRowNumberOrdering extends Phase

    Inject the proper orderings into the RowNumber nodes produced earlier by the resolveFixJoins phase.

  13. class FlattenProjections extends Phase

    Flatten all Pure node contents into a single StructNode.

  14. class ForceOuterBinds extends Phase

    Ensure that all collection operations are wrapped in a Bind so that we have a place for expanding references later.

    Ensure that all collection operations are wrapped in a Bind so that we have a place for expanding references later. FilteredQueries are allowed on top of collection operations without a Bind in between, unless that operation is a Join or a Pure node.

  15. class FuseComprehensions extends Phase

    Fuse sub-comprehensions into their parents.

  16. class HoistClientOps extends Phase

    Lift operations that are preferred to be performed on the client side out of sub-queries.

  17. class InferTypes extends Phase

    Infer types and compute missing structural views for all nominal table types.

  18. class InsertCompiler extends Phase

    A custom compiler for INSERT statements.

    A custom compiler for INSERT statements. We could reuse the standard phases with a minor modification instead, but this is much faster.

  19. trait Phase extends (CompilerState) ⇒ CompilerState with Logging

    A phase of the query compiler, identified by a unique name

  20. class PruneFields extends Phase

    Remove unreferenced fields from StructNodes and convert unreferenced StructNodes to single columns or ProductNodes (which is needed for aggregation functions and at the top level).

  21. class QueryCompiler extends Logging

    An immutable, stateless query compiler consisting of a series of phases

  22. class RelabelUnions extends Phase

    Assign the AnonSymbols of fields from the left side of a Union to the right side.

    Assign the AnonSymbols of fields from the left side of a Union to the right side. This ensures that both sides are protected when we prune unused references pointing to left-side Symbols.

  23. class ResolveZipJoins extends Phase

    Rewrite zip joins into a form suitable for SQL (using inner joins and RowNumber columns.

    Rewrite zip joins into a form suitable for SQL (using inner joins and RowNumber columns. We rely on having a Bind around every Join and both of its generators, which should have been generated by Phase.forceOuterBinds. The inner Binds need to select Pure(StructNode(...)) which should be the outcome of Phase.rflattenProjections.

  24. class ResolveZipJoinsState extends AnyRef

  25. class RewriteBooleans extends Phase

    For SQL back-ends which do not support real boolean types for fields and general expressions but which do have special boolean expressions and operators, this phase injects conversions between fake and real boolean values.

    For SQL back-ends which do not support real boolean types for fields and general expressions but which do have special boolean expressions and operators, this phase injects conversions between fake and real boolean values.

    The default for booleans in the AST is to use the fake type. There are specific places where a real boolean is required or produced, so we inject a call to ToRealBoolean or ToFakeBoolean as needed.

  26. class SpecializeParameters extends Phase

    Specialize the AST for edge cases of query parameters.

    Specialize the AST for edge cases of query parameters. This is required for compiling take(0) for some databases which do not allow LIMIT 0.

Value Members

  1. object CodeGen

  2. object InsertCompiler

  3. object Phase

    The Phase companion objects contains ready-to-use Phase objects for the standard phases of the query compiler

  4. object QueryCompiler

  5. object RewriteBooleans

  6. object UnionLeft

Inherited from AnyRef

Inherited from Any

Ungrouped