Options
All
  • Public
  • Public/Protected
  • All
Menu

Class From

Represents the FROM portion of a query, with any JOINs and optionally a WHERE condition. This class is used when selecting, updating, or deleting.

Hierarchy

Index

Constructors

constructor

  • Initialize.

    Parameters

    • colStore: ColumnStore

      Used for accessing columns in tables.

    • tblStore: TableStore

      Used for accessing tables in the database.

    • relStore: RelationshipStore

      Used for accessing relationships between tables.

    • propStore: PropertyMapStore

      Used for pulling table property maps (used in conjunction with the relStore to get remote columns).

    • escaper: Escaper

      An Escaper matching the database type (e.g. MySQLEscaper or MSSQLEscaper). Used when escaping column names in compiled conditions.

    • FromEntity: TableType

      Constructor of the FROM table.

    • Optional fromAlias: string

      Alias for the FROM table, used in conditions, joins, and column selection. Optional: defaults to the name of the table.

    Returns From

Properties

Protected colStore

colStore: ColumnStore

Used for accessing columns in tables.

Protected escaper

escaper: Escaper

An Escaper matching the database type (e.g. MySQLEscaper or MSSQLEscaper). Used when escaping column names in compiled conditions.

Protected propStore

propStore: PropertyMapStore

Used for pulling table property maps (used in conjunction with the relStore to get remote columns).

Protected relStore

Used for accessing relationships between tables.

Protected tblStore

tblStore: TableStore

Used for accessing tables in the database.

Methods

getBaseTableMeta

getFromMeta

getFromString

  • getFromString(): string
  • Get the FROM portion of the query as a string.

    Returns string

    The FROM portion of the query (FROM <table> AS <alias>), escaped.

getJoinMeta

  • Helper method to get the meta data of the JOIN'd in tables.

    Returns FromTableMeta[]

    An array of meta objects describing each table. The meta objects are in insertion order (e.g. in the order the tables were joined in).

getJoinString

  • getJoinString(): string
  • Get the JOIN parts of the query string.

    Returns string

    The JOIN parts of the query, escaped.

getParameterList

getWhereString

  • getWhereString(): string
  • Get the WHERE portion of the query string.

    Returns string

    The WHERE part of the query, or a blank string if there is no where clause.

innerJoin

join

  • Join in a table.

    Type parameters

    • J

    Parameters

    Returns this

  • Join in a table.

    Type parameters

    • J

    Parameters

    • joinType: JoinType

      How to join the two tables (INNER JOIN, LEFT OUTER JOIN).

    • Entity: TableType

      The Table-decorated Entity to join in.

    • alias: string

      Alias of the joined-in table.

    • fqParentProperty: string

      The fully-qualified property name on the parent Entity to which this Entity will be mapped.

    • Optional joinCond: object

      An optional condition that describes how to join the two tables. If not supplied then the join condition will be derived.

    • Optional joinParams: ParameterType

      An optional set of parameters that will be used to replace values in joinCond.

    Returns this

leftOuterJoin

toString

  • toString(): string
  • Get the SQL that represents the query.

    Returns string

    The actual SQL query (FROM, JOINS, and WHERE).

where

Generated using TypeDoc