Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SqliteQueryRunner

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

Properties

Methods

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.

loadedViews

loadedViews: View[] = []

All synchronized views 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?: boolean): 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?: boolean): Promise<void>

createExclusionConstraint

  • createExclusionConstraint(tableOrName: Table | string, exclusionConstraint: TableExclusion): Promise<void>

createExclusionConstraints

  • createExclusionConstraints(tableOrName: Table | string, exclusionConstraints: TableExclusion[]): 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?: boolean): Promise<void>

createTable

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

Protected createTableSql

  • createTableSql(table: Table, createForeignKeys?: boolean): Query

createUniqueConstraint

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

createUniqueConstraints

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

createView

  • createView(view: View): Promise<void>

Protected createViewSql

Protected deleteViewDefinitionSql

  • deleteViewDefinitionSql(viewOrPath: View | string): Query

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?: boolean): Promise<void>

dropExclusionConstraint

  • dropExclusionConstraint(tableOrName: Table | string, exclusionOrName: TableExclusion | string): Promise<void>

dropExclusionConstraints

  • dropExclusionConstraints(tableOrName: Table | string, exclusionConstraints: TableExclusion[]): 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

dropIndices

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

dropPrimaryKey

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

dropSchema

  • dropSchema(schemaPath: string, ifExist?: boolean): Promise<void>

dropTable

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

Protected dropTableSql

  • dropTableSql(tableOrName: Table | string, ifExist?: boolean): Query

dropUniqueConstraint

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

dropUniqueConstraints

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

dropView

  • dropView(target: View | string): Promise<void>

Protected dropViewSql

  • dropViewSql(viewOrPath: View | string): Query

enableSqlMemory

  • enableSqlMemory(): void

executeMemoryDownSql

  • executeMemoryDownSql(): Promise<void>

executeMemoryUpSql

  • executeMemoryUpSql(): Promise<void>

Protected executeQueries

Protected getCachedTable

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

Protected getCachedView

  • getCachedView(viewName: string): Promise<View>

getDatabases

  • getDatabases(): Promise<string[]>

getMemorySql

getSchemas

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

getTable

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

getTables

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

Protected getTypeormMetadataTableName

  • getTypeormMetadataTableName(): string

getView

  • getView(viewPath: string): Promise<View | undefined>

getViews

  • getViews(viewPaths: string[]): Promise<View[]>

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 insertViewDefinitionSql

Protected isColumnChanged

  • isColumnChanged(oldColumn: TableColumn, newColumn: TableColumn, checkDefault?: boolean, checkComment?: boolean): 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[]>

Protected loadViews

  • loadViews(viewNames: string[]): Promise<View[]>

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