Options
All
  • Public
  • Public/Protected
  • All
Menu

Runs queries on a single sqlite database connection.

Does not support compose primary keys with autoincrement field. todo: need to throw exception for this case.

Hierarchy

Implements

Index

Constructors

constructor

Properties

broadcaster

broadcaster: Broadcaster

Broadcaster used on this query runner to broadcast entity events.

connection

connection: Connection

Connection used by this query runner.

data

data: object

Stores temporarily user data. Useful for sharing data with subscribers.

Type declaration

Protected databaseConnection

databaseConnection: any

Real database connection from a connection pool used to perform queries.

driver

driver: SqliteDriver

Database driver used by connection.

isReleased

isReleased: boolean = false

Indicates if connection for this query runner is released. Once its released, query runner cannot run queries anymore.

isTransactionActive

isTransactionActive: boolean = false

Indicates if transaction is in progress.

loadedTables

loadedTables: Table[] = []

All synchronized tables in the database.

manager

manager: EntityManager

Entity manager working only with current query runner.

Protected mode

mode: "master" | "slave"

Mode in which query runner executes. Used for replication. If replication is not setup its value is ignored.

Protected sqlInMemory

sqlInMemory: SqlInMemory = new SqlInMemory()

Sql-s stored if "sql in memory" mode is enabled.

Protected sqlMemoryMode

sqlMemoryMode: boolean = false

Indicates if special query runner mode in which sql queries won't be executed is enabled.

Methods

addColumn

addColumns

  • addColumns(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

Protected buildCreateColumnSql

  • buildCreateColumnSql(column: TableColumn, skipPrimary?: undefined | true | false): string

changeColumn

changeColumns

  • changeColumns(tableOrName: Table | string, changedColumns: object[]): Promise<void>

clearDatabase

  • clearDatabase(): Promise<void>

clearSqlMemory

  • clearSqlMemory(): void

clearTable

  • clearTable(tableName: string): Promise<void>

commitTransaction

  • commitTransaction(): Promise<void>

connect

  • connect(): Promise<any>

createCheckConstraint

  • createCheckConstraint(tableOrName: Table | string, checkConstraint: TableCheck): Promise<void>

createCheckConstraints

  • createCheckConstraints(tableOrName: Table | string, checkConstraints: TableCheck[]): Promise<void>

createDatabase

  • createDatabase(database: string, ifNotExist?: undefined | true | false): Promise<void>

createForeignKey

createForeignKeys

createIndex

  • createIndex(tableOrName: Table | string, index: TableIndex): Promise<void>

Protected createIndexSql

createIndices

  • createIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void>

createPrimaryKey

  • createPrimaryKey(tableOrName: Table | string, columnNames: string[]): Promise<void>

createSchema

  • createSchema(schema: string, ifNotExist?: undefined | true | false): Promise<void>

createTable

  • createTable(table: Table, ifNotExist?: boolean, createForeignKeys?: boolean, createIndices?: boolean): Promise<void>

Protected createTableSql

  • createTableSql(table: Table, createForeignKeys?: undefined | true | false): string

createUniqueConstraint

  • createUniqueConstraint(tableOrName: Table | string, uniqueConstraint: TableUnique): Promise<void>

createUniqueConstraints

  • createUniqueConstraints(tableOrName: Table | string, uniqueConstraints: TableUnique[]): Promise<void>

disableSqlMemory

  • disableSqlMemory(): void

dropCheckConstraint

  • dropCheckConstraint(tableOrName: Table | string, checkOrName: TableCheck | string): Promise<void>

dropCheckConstraints

  • dropCheckConstraints(tableOrName: Table | string, checkConstraints: TableCheck[]): Promise<void>

dropColumn

  • dropColumn(tableOrName: Table | string, columnOrName: TableColumn | string): Promise<void>

dropColumns

  • dropColumns(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

dropDatabase

  • dropDatabase(database: string, ifExist?: undefined | true | false): Promise<void>

dropForeignKey

  • dropForeignKey(tableOrName: Table | string, foreignKeyOrName: TableForeignKey | string): Promise<void>

dropForeignKeys

dropIndex

  • dropIndex(tableOrName: Table | string, indexOrName: TableIndex | string): Promise<void>

Protected dropIndexSql

  • dropIndexSql(indexOrName: TableIndex | string): string

dropIndices

  • dropIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void>

dropPrimaryKey

  • dropPrimaryKey(tableOrName: Table | string): Promise<void>

dropSchema

  • dropSchema(schemaPath: string, ifExist?: undefined | true | false): Promise<void>

dropTable

  • dropTable(tableOrName: Table | string, ifExist?: undefined | true | false, dropForeignKeys?: boolean, dropIndices?: boolean): Promise<void>

Protected dropTableSql

  • dropTableSql(tableOrName: Table | string, ifExist?: undefined | true | false): string

dropUniqueConstraint

  • dropUniqueConstraint(tableOrName: Table | string, uniqueOrName: TableUnique | string): Promise<void>

dropUniqueConstraints

  • dropUniqueConstraints(tableOrName: Table | string, uniqueConstraints: TableUnique[]): Promise<void>

enableSqlMemory

  • enableSqlMemory(): void

executeMemoryDownSql

  • executeMemoryDownSql(): Promise<void>

executeMemoryUpSql

  • executeMemoryUpSql(): Promise<void>

Protected executeQueries

  • executeQueries(upQueries: string | string[], downQueries: string | string[]): Promise<void>

Protected getCachedTable

  • getCachedTable(tableName: string): Promise<Table>

getDatabases

  • getDatabases(): Promise<string[]>

getMemorySql

getSchemas

  • getSchemas(database?: undefined | string): Promise<string[]>

getTable

  • getTable(tablePath: string): Promise<Table | undefined>

getTables

  • getTables(tableNames: string[]): Promise<Table[]>

hasColumn

  • hasColumn(tableOrName: Table | string, columnName: string): Promise<boolean>

hasDatabase

  • hasDatabase(database: string): Promise<boolean>

hasSchema

  • hasSchema(schema: string): Promise<boolean>

hasTable

  • hasTable(tableOrName: Table | string): Promise<boolean>

Protected isColumnChanged

  • isColumnChanged(oldColumn: TableColumn, newColumn: TableColumn, checkDefault?: undefined | true | false, checkComment?: undefined | true | false): boolean

Protected isDefaultColumnLength

  • isDefaultColumnLength(table: Table, column: TableColumn, length: string): boolean

Protected isDefaultColumnPrecision

  • isDefaultColumnPrecision(table: Table, column: TableColumn, precision: number): boolean

Protected isDefaultColumnScale

  • isDefaultColumnScale(table: Table, column: TableColumn, scale: number): boolean

Protected isDefaultColumnWidth

  • isDefaultColumnWidth(table: Table, column: TableColumn, width: number): boolean

Protected loadTables

  • loadTables(tableNames: string[]): Promise<Table[]>

query

  • query(query: string, parameters?: any[]): Promise<any>

Protected recreateTable

  • recreateTable(newTable: Table, oldTable: Table, migrateData?: boolean): Promise<void>

release

  • release(): Promise<void>

renameColumn

  • renameColumn(tableOrName: Table | string, oldTableColumnOrName: TableColumn | string, newTableColumnOrName: TableColumn | string): Promise<void>

renameTable

  • renameTable(oldTableOrName: Table | string, newTableName: string): Promise<void>

Protected replaceCachedTable

  • replaceCachedTable(table: Table, changedTable: Table): void

rollbackTransaction

  • rollbackTransaction(): Promise<void>

startTransaction

stream

  • stream(query: string, parameters?: any[], onEnd?: Function, onError?: Function): Promise<ReadStream>

updatePrimaryKeys

  • updatePrimaryKeys(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

Generated using TypeDoc