Skip to main content
Module

x/typeorm/src/query-runner/BaseQueryRunner.ts>BaseQueryRunner

Forked from https://github.com/typeorm/typeorm
Latest
class BaseQueryRunner
Abstract
import { BaseQueryRunner } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/query-runner/BaseQueryRunner.ts";

Properties

protected
databaseConnection: any

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

protected
mode: "master" | "slave"

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

protected
sqlInMemory: SqlInMemory

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

protected
sqlMemoryMode: boolean

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

broadcaster: Broadcaster

Broadcaster used on this query runner to broadcast entity events.

connection: Connection

Connection used by this query runner.

data

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

isReleased: boolean

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

isTransactionActive: boolean

Indicates if transaction is in progress.

loadedTables: Table[]

All synchronized tables in the database.

loadedViews: View[]

All synchronized views in the database.

manager: EntityManager

Entity manager working only with current query runner.

Methods

protected
executeQueries(upQueries: Query | Query[], downQueries: Query | Query[]): Promise<void>

Executes sql used special for schema build.

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

Gets table from previously loaded tables, otherwise loads it from database.

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

Gets view from previously loaded views, otherwise loads it from database.

protected
getTypeormMetadataTableName(): string
protected
isColumnChanged(
oldColumn: TableColumn,
newColumn: TableColumn,
checkDefault?: boolean,
checkComment?: boolean,
): boolean

Checks if at least one of column properties was changed. Does not checks column type, length and autoincrement, because these properties changes separately.

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

Checks if column length is by default.

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

Checks if column precision is by default.

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

Checks if column scale is by default.

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

Checks if column display width is by default. Used only for MySQL.

protected
abstract
loadTables(tablePaths: string[]): Promise<Table[]>
protected
abstract
loadViews(tablePaths: string[]): Promise<View[]>
protected
replaceCachedTable(table: Table, changedTable: Table): void

Replaces loaded table with given changed table.

Flushes all memorized sqls.

Disables special query runner mode in which sql queries won't be executed started by calling enableSqlMemory() method.

Previously memorized sql will be flushed.

Enables special query runner mode in which sql queries won't be executed, instead they will be memorized into a special variable inside query runner. You can get memorized sql using getMemorySql() method.

executeMemoryDownSql(): Promise<void>

Executes down sql queries.

executeMemoryUpSql(): Promise<void>

Executes up sql queries.

getMemorySql(): SqlInMemory

Gets sql stored in the memory. Parameters in the sql are already replaced.

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

Loads given table's data from the database.

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

Loads all tables (with given names) from the database.

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

Loads given view's data from the database.

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

Loads given view's data from the database.

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

Executes a given SQL query.