Options
All
  • Public
  • Public/Protected
  • All
Menu

Organizes communication with MySQL DBMS.

Hierarchy

  • MysqlDriver

Implements

Index

Constructors

constructor

Properties

connection

connection: Connection

Connection used by driver.

Optional database

database: undefined | string

Master database used to perform all write queries.

isReplicated

isReplicated: boolean = false

Indicates if replication is enabled.

mysql

mysql: any

Mysql underlying library.

options

Connection options.

pool

pool: any

Connection pool. Used in non-replication mode.

poolCluster

poolCluster: any

Pool cluster used in replication mode.

spatialTypes

spatialTypes: ColumnType[] = ["geometry","point","linestring","polygon","multipoint","multilinestring","multipolygon","geometrycollection"]

Gets list of spatial column data types.

supportedDataTypes

supportedDataTypes: ColumnType[] = ["int","tinyint","smallint","mediumint","bigint","float","double","dec","decimal","numeric","date","datetime","timestamp","time","year","char","varchar","nvarchar","blob","text","tinyblob","tinytext","mediumblob","mediumtext","longblob","longtext","enum","json","binary","varbinary","geometry","point","linestring","polygon","multipoint","multilinestring","multipolygon","geometrycollection"]

treeSupport

treeSupport: boolean = true

Indicates if tree tables are supported by this driver.

unsignedAndZerofillTypes

unsignedAndZerofillTypes: ColumnType[] = ["int","smallint","tinyint","mediumint","bigint","decimal","float","double"]

Gets list of column data types that supports UNSIGNED and ZEROFILL attributes.

withLengthColumnTypes

withLengthColumnTypes: ColumnType[] = ["char","varchar","nvarchar","binary","varbinary"]

Gets list of column data types that support length by a driver.

withPrecisionColumnTypes

withPrecisionColumnTypes: ColumnType[] = ["decimal","float","double","time","datetime","timestamp"]

Gets list of column data types that support precision by a driver.

withScaleColumnTypes

withScaleColumnTypes: ColumnType[] = ["decimal","float","double",]

Gets list of column data types that supports scale by a driver.

withWidthColumnTypes

withWidthColumnTypes: ColumnType[] = ["tinyint","smallint","mediumint","int","bigint"]

Gets list of column data types that support length by a driver.

Methods

afterConnect

  • afterConnect(): Promise<void>

buildTableName

  • buildTableName(tableName: string, schema?: undefined | string, database?: undefined | string): string
  • Build full table name with database name, schema name and table name. E.g. "myDB"."mySchema"."myTable"

    Parameters

    • tableName: string
    • Optional schema: undefined | string
    • Optional database: undefined | string

    Returns string

Protected compareDefaultValues

  • compareDefaultValues(columnMetadataValue: string, databaseValue: string): boolean
  • Checks if "DEFAULT" values in the column metadata and in the database are equal.

    Parameters

    • columnMetadataValue: string
    • databaseValue: string

    Returns boolean

connect

  • connect(): Promise<void>

Protected createConnectionOptions

createFullType

createGeneratedMap

  • createGeneratedMap(metadata: EntityMetadata, insertResult: any): any

createParameter

  • createParameter(parameterName: string, index: number): string

Protected createPool

  • createPool(connectionOptions: any): Promise<any>
  • Creates a new connection pool for a given database credentials.

    Parameters

    • connectionOptions: any

    Returns Promise<any>

createQueryRunner

createSchemaBuilder

disconnect

  • disconnect(): Promise<void>

escape

  • escape(columnName: string): string

escapeQueryWithParameters

findChangedColumns

getColumnLength

isReturningSqlSupported

  • isReturningSqlSupported(): boolean

isUUIDGenerationSupported

  • isUUIDGenerationSupported(): boolean

Protected loadDependencies

  • loadDependencies(): void

normalizeDefault

normalizeIsUnique

normalizeType

  • normalizeType(column: object): string
  • Creates a database type from a given column metadata.

    Parameters

    • column: object
      • Optional length?: number | string
      • Optional precision?: number | null
      • Optional scale?: undefined | number
      • type: ColumnType

    Returns string

obtainMasterConnection

  • obtainMasterConnection(): Promise<any>

obtainSlaveConnection

  • obtainSlaveConnection(): Promise<any>

Private prepareDbConnection

  • prepareDbConnection(connection: any): any
  • Attaches all required base handlers to a database connection, such as the unhandled error handler.

    Parameters

    • connection: any

    Returns any

prepareHydratedValue

  • prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any

preparePersistentValue

  • preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any

Object literals

dataTypeDefaults

dataTypeDefaults: object

Default values of length, precision and scale depends on column data type. Used in the cases when length/precision/scale is not specified by user.

bigint

bigint: object

width

width: number = 20

binary

binary: object

length

length: number = 1

char

char: object

length

length: number = 1

decimal

decimal: object

precision

precision: number = 10

scale

scale: number = 0

double

double: object

precision

precision: number = 22

float

float: object

precision

precision: number = 12

int

int: object

width

width: number = 11

mediumint

mediumint: object

width

width: number = 9

smallint

smallint: object

width

width: number = 6

tinyint

tinyint: object

width

width: number = 4

varbinary

varbinary: object

length

length: number = 255

varchar

varchar: object

length

length: number = 255

mappedDataTypes

mappedDataTypes: object

ORM has special columns and we need to know what database column types should be for those columns. Column types are driver dependant.

cacheDuration

cacheDuration: "int" = "int"

cacheId

cacheId: "int" = "int"

cacheIdentifier

cacheIdentifier: "varchar" = "varchar"

cacheQuery

cacheQuery: "text" = "text"

cacheResult

cacheResult: "text" = "text"

cacheTime

cacheTime: "bigint" = "bigint"

createDate

createDate: "datetime" = "datetime"

createDateDefault

createDateDefault: string = "CURRENT_TIMESTAMP(6)"

createDatePrecision

createDatePrecision: number = 6

migrationId

migrationId: "int" = "int"

migrationName

migrationName: "varchar" = "varchar"

migrationTimestamp

migrationTimestamp: "bigint" = "bigint"

treeLevel

treeLevel: "int" = "int"

updateDate

updateDate: "datetime" = "datetime"

updateDateDefault

updateDateDefault: string = "CURRENT_TIMESTAMP(6)"

updateDatePrecision

updateDatePrecision: number = 6

version

version: "int" = "int"

Generated using TypeDoc