Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract class defining a particular dialect of SQL that is used to render query builders to strings of SQL of that dialect for execution by Connection instances.

Hierarchy

Index

Constructors

constructor

Accessors

Private appClassApplication

Methods

Protected app

Protected container

Abstract escape

getBoundMethod

  • getBoundMethod(methodName: string): (...args: any[]) => any
  • Get the method with the given name from this class, bound to this class.

    Parameters

    • methodName: string

    Returns (...args: any[]) => any

    function

      • (...args: any[]): any
      • Parameters

        • Rest ...args: any[]

        Returns any

Protected make

  • make<T>(target: any, ...parameters: any[]): T

Abstract renderAlterTable

renderCommitSchemaTransaction

  • renderCommitSchemaTransaction(builder: TableBuilder): string
  • Given a table schema-builder, render a series of queries as a transaction that apply the given schema to database.

    todo

    handle constraints better - ConstraintBuilder

    Parameters

    Returns string

Abstract renderConstraints

  • renderConstraints(constraints: Constraint[]): string
  • Given an array of Constraint objects, render them as WHERE-clause SQL in this dialect.

    This function should escape the values before they are included in the query string.

    example
    dialect.renderConstraints([
     {
         field: 'id',
         operator: '<',
         operand: 44,
         preop: 'AND',
     },
     {
         field: 'id',
         operator: '>',
         operand: 30,
         preop: 'AND',
     },
    ])  // => 'id < 44 AND id > 30'
    

    Parameters

    Returns string

Abstract renderCount

  • renderCount(query: string): string
  • Wrap the given query string as a "SELECT ..." query that returns the number of rows matched by the original query string.

    The resultant query should return the extollo_render_count field with the number of rows that the original query would return.

    Parameters

    • query: string

    Returns string

Abstract renderCreateIndex

Abstract renderCreateTable

Abstract renderDelete

  • Render the given query builder as a "DELETE ..." query string.

    This function should escape the values before they are included in the query string.

    Parameters

    Returns string

Abstract renderDropColumn

Abstract renderDropIndex

Abstract renderDropTable

Abstract renderExistential

  • Render the given query builder as a query that can be used to test if at least 1 row exists for the given builder.

    The resultant query should return at least 1 row if that condition is met, and should return NO rows otherwise.

    This function should escape the values before they are included in the query string.

    example

    The PostgreSQL dialect achieves this by removing the user-specified fields, select-ing TRUE, and applying LIMIT 1 to the query. This returns a single row if the constraints have results, and nothing otherwise.

    Parameters

    Returns string

Abstract renderInsert

  • Render the given query as an "INSERT ..." query string, inserting rows for the given data object(s).

    This function should escape the values before they are included in the query string.

    Parameters

    Returns string

Abstract renderRangedSelect

  • renderRangedSelect(query: string, start: number, end: number): string
  • Given a rendered "SELECT ..." query string, wrap it such that the query will only return the rows ranging from the start to end indices.

    Parameters

    • query: string
    • start: number
    • end: number

    Returns string

Abstract renderRecreateIndex

Abstract renderRenameIndex

Abstract renderSelect

  • Render the given query builder as a "SELECT ..." query string.

    This function should escape the values before they are included in the query string.

    Parameters

    Returns string

Abstract renderTableColumns

  • Render the table-column definitions for the table defined by the given schema-builder.

    example
    dialect.renderTableColumns(builder)
    // => ['col1 varchar(100) NULL', 'col2 serial NOT NULL']
    

    Parameters

    Returns string[]

Abstract renderTransaction

  • renderTransaction(queries: string[]): string
  • Given a series of fully-formed queries, render them as a single transaction.

    example
    const queries = [
     'SELECT * FROM a',
     'UPDATE b SET col = 123',
    ]
    
    dialect.renderTransaction(queries)
    // => 'BEGIN; SELECT * FROM a; UPDATE b SET col = 123; COMMIT;'
    

    Parameters

    • queries: string[]

    Returns string

Abstract renderUpdate

  • Render the given query builder as an "UPDATE ..." query string, setting the column values from the given data object.

    This function should escape the values before they are included in the query string.

    Parameters

    Returns string

Abstract renderUpdateSet

  • renderUpdateSet(data: {}): string
  • Render the "SET ... [field = value ...]" portion of the update query.

    This function should escape the values before they are included in the query string.

    example
    dialect.renderUpdateSet({field1: 'value', field2: 45})
    // => "SET field1 = 'value', field2 = 45"
    

    Parameters

    Returns string

Extollo Logo

extollo (v. latin) - to lift up, to elevate

Extollo is a free & libre application framework in TypeScript.