Skip to main content
Version: Next

MsSqlPlatform

Platform implementation for Microsoft SQL Server.

Hierarchy

Index

Constructors

Methods

Constructors

constructor

  • Returns MsSqlPlatform

Methods

allowsComparingTuples

  • allowsComparingTuples(): boolean
  • Whether the platform supports tuple comparison in WHERE clauses.


    Returns boolean

inheritedcloneEmbeddable

  • cloneEmbeddable<T>(data): T
  • Deep-clones embeddable data and tags it for JSON serialization.


    Parameters

    • data: T

    Returns T

inheritedcompareUuids

  • compareUuids(): string
  • Determines how UUID values are compared in the change set tracking. Return 'string' for inline string comparison (fast), or 'any' for deep comparison via type methods.


    Returns string

convertDateToJSValue

  • convertDateToJSValue(value): string
  • Parameters

    • value: string | Date

    Returns string

inheritedconvertIntervalToDatabaseValue

  • convertIntervalToDatabaseValue(value): unknown
  • Parameters

    • value: unknown

    Returns unknown

inheritedconvertIntervalToJSValue

  • convertIntervalToJSValue(value): unknown
  • Parameters

    • value: string

    Returns unknown

inheritedconvertJsonToDatabaseValue

  • convertJsonToDatabaseValue(value, context): unknown
  • Converts a JS value to its JSON database representation (typically JSON.stringify).


    Parameters

    Returns unknown

inheritedconvertJsonToJSValue

  • convertJsonToJSValue(value, context): unknown
  • Converts a database JSON value to its JS representation.


    Parameters

    Returns unknown

convertsJsonAutomatically

  • convertsJsonAutomatically(): boolean
  • Whether the driver automatically parses JSON columns into JS objects.


    Returns boolean

inheritedconvertUuidToDatabaseValue

  • convertUuidToDatabaseValue(value): unknown
  • Parameters

    • value: unknown

    Returns unknown

inheritedconvertUuidToJSValue

  • convertUuidToJSValue(value): unknown
  • Parameters

    • value: unknown

    Returns unknown

inheritedconvertVersionValue

  • convertVersionValue(value, prop): string | number | Date | { $in: (string | number)[] }
  • Converts a version field value for comparison in optimistic locking queries.


    Parameters

    Returns string | number | Date | { $in: (string | number)[] }

inheriteddenormalizePrimaryKey

  • denormalizePrimaryKey(data): IPrimaryKeyValue
  • Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)


    Parameters

    • data: IPrimaryKeyValue

    Returns IPrimaryKeyValue

escape

  • escape(value): string
  • Parameters

    • value: any

    Returns string

inheritedextractSimpleType

  • extractSimpleType(type): string
  • Extracts the base type name from a full SQL type declaration (e.g. "varchar(255)" -> "varchar").


    Parameters

    • type: string

    Returns string

inheritedformatQuery

  • formatQuery(sql, params): string
  • Replaces ? placeholders in SQL with quoted parameter values.


    Parameters

    • sql: string
    • params: readonly any[]

    Returns string

inheritedgenerateCustomOrder

  • generateCustomOrder(escapedColumn, values): string
  • Generates a custom order by statement given a set of in order values, eg. ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)


    Parameters

    • escapedColumn: string
    • values: unknown[]

    Returns string

inheritedgetArrayDeclarationSQL

  • getArrayDeclarationSQL(): string
  • Returns the SQL type declaration used for array storage.


    Returns string

inheritedgetBeginTransactionSQL

  • getBeginTransactionSQL(options): string[]
  • Parameters

    Returns string[]

inheritedgetBigIntTypeDeclarationSQL

  • getBigIntTypeDeclarationSQL(column): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getBlobDeclarationSQL

  • getBlobDeclarationSQL(): string
  • Returns string

getBooleanTypeDeclarationSQL

  • getBooleanTypeDeclarationSQL(): string
  • Returns the SQL type declaration for boolean columns.


    Returns string

inheritedgetCharTypeDeclarationSQL

  • getCharTypeDeclarationSQL(column): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

inheritedgetCommitTransactionSQL

  • getCommitTransactionSQL(): string
  • Returns string

inheritedgetConfig

getCurrentTimestampSQL

  • getCurrentTimestampSQL(length): string
  • Returns the SQL specific for the platform to get the current timestamp


    Parameters

    • length: number

    Returns string

getDateTimeTypeDeclarationSQL

  • getDateTimeTypeDeclarationSQL(column): string
  • Returns the SQL type declaration for datetime columns.


    Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

inheritedgetDateTypeDeclarationSQL

  • getDateTypeDeclarationSQL(length): string
  • Returns the SQL type declaration for date columns.


    Parameters

    • optionallength: number

    Returns string

inheritedgetDecimalTypeDeclarationSQL

  • getDecimalTypeDeclarationSQL(column): string
  • Parameters

    • column: { precision?: number; scale?: number }
      • optionalprecision: number
      • optionalscale: number

    Returns string

inheritedgetDefaultCharLength

  • getDefaultCharLength(): number
  • Returns the default length for char columns.


    Returns number

inheritedgetDefaultCharset

  • getDefaultCharset(): string
  • Returns the default character set for this platform.


    Returns string

getDefaultClientUrl

  • getDefaultClientUrl(): string
  • Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)


    Returns string

getDefaultDateTimeLength

  • getDefaultDateTimeLength(): number
  • Returns the default fractional seconds precision for datetime columns.


    Returns number

getDefaultMappedType

  • getDefaultMappedType(type): Type<unknown, unknown>
  • Returns the default mapped Type for a given type string when no custom mapping is configured.


    Parameters

    • type: string

    Returns Type<unknown, unknown>

inheritedgetDefaultPrimaryName

  • getDefaultPrimaryName(tableName, columns): string
  • Returns the default primary key constraint name.


    Parameters

    • tableName: string
    • columns: string[]

    Returns string

getDefaultSchemaName

  • getDefaultSchemaName(): undefined | string
  • Returns the default schema name for this platform (e.g. "public" for PostgreSQL).


    Returns undefined | string

inheritedgetDefaultVarcharLength

  • getDefaultVarcharLength(): number
  • Returns the default length for varchar columns.


    Returns number

inheritedgetDefaultVersionLength

  • getDefaultVersionLength(): number
  • Returns the default fractional seconds precision for version timestamp columns.


    Returns number

getDoubleDeclarationSQL

  • getDoubleDeclarationSQL(): string
  • Returns string

getEnumTypeDeclarationSQL

  • getEnumTypeDeclarationSQL(column): string
  • Parameters

    • column: { autoincrement?: boolean; fieldNames: string[]; items?: unknown[]; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • fieldNames: string[]
      • optionalitems: unknown[]
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

inheritedgetExceptionConverter

  • Returns the exception converter for translating native errors to driver exceptions.


    Returns ExceptionConverter

inheritedgetExtension

  • getExtension<T>(extensionName, extensionKey, moduleName, em): T
  • Retrieves a registered extension (e.g. SchemaGenerator, Migrator), throwing if not found.


    Parameters

    Returns T

getFloatDeclarationSQL

  • getFloatDeclarationSQL(): string
  • Returns string

inheritedgetFullTextIndexExpression

  • getFullTextIndexExpression(indexName, schemaName, tableName, columns): string
  • Parameters

    • indexName: string
    • schemaName: undefined | string
    • tableName: string
    • columns: SimpleColumnMeta[]

    Returns string

inheritedgetFullTextWhereClause

  • getFullTextWhereClause(prop): string
  • Parameters

    Returns string

inheritedgetIndexName

  • getIndexName(tableName, columns, type): string
  • Returns the default name of index for the given columns


    Parameters

    • tableName: string
    • columns: string[]
    • type: primary | index | unique | foreign | sequence

    Returns string

inheritedgetIntegerTypeDeclarationSQL

  • getIntegerTypeDeclarationSQL(column): string
  • Returns the SQL type declaration for integer columns.


    Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

inheritedgetIntervalTypeDeclarationSQL

  • getIntervalTypeDeclarationSQL(column): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

getJsonDeclarationSQL

  • getJsonDeclarationSQL(): string
  • Returns string

inheritedgetJsonIndexDefinition

  • getJsonIndexDefinition(index): string[]
  • Parameters

    Returns string[]

inheritedgetMappedType

  • getMappedType(type): Type<unknown, unknown>
  • Returns the mapped Type instance for a given SQL/runtime type string.


    Parameters

    • type: string

    Returns Type<unknown, unknown>

inheritedgetMediumIntTypeDeclarationSQL

  • getMediumIntTypeDeclarationSQL(column): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

inheritedgetNamingStrategy

getRegExpOperator

  • getRegExpOperator(): string
  • Returns the SQL operator used for regular expression matching.


    Returns string

inheritedgetRegExpValue

  • getRegExpValue(val): { $flags?: string; $re: string }
  • Converts a JavaScript RegExp into a platform-specific regex representation.


    Parameters

    • val: RegExp

    Returns { $flags?: string; $re: string }

    • optional$flags?: string
    • $re: string

inheritedgetReleaseSavepointSQL

  • getReleaseSavepointSQL(savepointName): string
  • Parameters

    • savepointName: string

    Returns string

inheritedgetRepositoryClass

  • Returns the default EntityRepository class used by this platform.


    Returns Constructor<EntityRepository<T>>

getRollbackToSavepointSQL

  • getRollbackToSavepointSQL(savepointName): string
  • Parameters

    • savepointName: string

    Returns string

inheritedgetRollbackTransactionSQL

  • getRollbackTransactionSQL(): string
  • Returns string

getSavepointSQL

  • getSavepointSQL(savepointName): string
  • Parameters

    • savepointName: string

    Returns string

getSchemaGenerator

  • getSchemaGenerator(driver, em): MsSqlSchemaGenerator

inheritedgetSchemaHelper

  • Returns the schema helper instance for this platform, or undefined if not supported.


    Returns undefined | SchemaHelper

getSearchJsonPropertyKey

  • getSearchJsonPropertyKey(path, type, aliased, value): string | RawQueryFragment<string>
  • Parameters

    • path: string[]
    • type: string
    • aliased: boolean
    • optionalvalue: unknown

    Returns string | RawQueryFragment<string>

inheritedgetSearchJsonPropertySQL

  • getSearchJsonPropertySQL(path, type, aliased): string | RawQueryFragment<string>
  • Parameters

    • path: string
    • type: string
    • aliased: boolean

    Returns string | RawQueryFragment<string>

inheritedgetSmallIntTypeDeclarationSQL

  • getSmallIntTypeDeclarationSQL(column): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

inheritedgetTextTypeDeclarationSQL

  • getTextTypeDeclarationSQL(_column): string
  • Parameters

    • _column: { length?: number }
      • optionallength: number

    Returns string

inheritedgetTimeTypeDeclarationSQL

  • getTimeTypeDeclarationSQL(length): string
  • Returns the SQL type declaration for time columns.


    Parameters

    • optionallength: number

    Returns string

inheritedgetTimezone

  • getTimezone(): undefined | string
  • Returns the configured timezone, or undefined if not set.


    Returns undefined | string

inheritedgetTinyIntTypeDeclarationSQL

  • getTinyIntTypeDeclarationSQL(column): string
  • Parameters

    • column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
      • optionalautoincrement: boolean
      • optionallength: number
      • optionalunsigned: boolean

    Returns string

getUuidTypeDeclarationSQL

  • getUuidTypeDeclarationSQL(column): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

getVarcharTypeDeclarationSQL

  • getVarcharTypeDeclarationSQL(column): string
  • Parameters

    • column: { length?: number }
      • optionallength: number

    Returns string

indexForeignKeys

  • indexForeignKeys(): boolean
  • Whether the platform automatically creates indexes on foreign key columns.


    Returns boolean

init

  • init(orm): void

inheritedisAllowedTopLevelOperator

  • isAllowedTopLevelOperator(operator): boolean
  • Whether the given operator is allowed at the top level of a query condition.


    Parameters

    • operator: string

    Returns boolean

inheritedisBigIntProperty

  • isBigIntProperty(prop): boolean
  • Whether the given property maps to a bigint database column.


    Parameters

    Returns boolean

inheritedisNumericColumn

  • isNumericColumn(mappedType): boolean
  • Whether the given mapped type represents a numeric column.


    Parameters

    • mappedType: Type<unknown, unknown>

    Returns boolean

inheritedisNumericProperty

  • isNumericProperty(prop, ignoreCustomType): boolean
  • Whether the given property represents a numeric database column.


    Parameters

    Returns boolean

inheritedisPopulated

  • isPopulated<T>(key, populate): boolean
  • Whether the given property key is included in the populate hint.


    Parameters

    Returns boolean

lookupExtensions

  • lookupExtensions(orm): void

inheritedmapRegExpCondition

  • mapRegExpCondition(mappedKey, value): { params: unknown[]; sql: string }
  • Builds the SQL clause and parameters for a regular expression condition.


    Parameters

    • mappedKey: string
    • value: { $flags?: string; $re: string }
      • optional$flags: string
      • $re: string

    Returns { params: unknown[]; sql: string }

    • params: unknown[]
    • sql: string

inheritedmarshallArray

  • marshallArray(values): string
  • Serializes a string array into its database storage format.


    Parameters

    • values: string[]

    Returns string

normalizeColumnType

  • normalizeColumnType(type, options): string
  • This should be used only to compare types, it can strip some information like the length.


    Parameters

    • type: string
    • options: { length?: number; precision?: number; scale?: number }
      • optionallength: number
      • optionalprecision: number
      • optionalscale: number

    Returns string

normalizePrimaryKey

  • normalizePrimaryKey<T>(data): T
  • Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)


    Parameters

    • data: IPrimaryKeyValue | Primary<T>

    Returns T

inheritedparseDate

  • parseDate(value): Date
  • Parses a string or numeric value into a Date object.


    Parameters

    • value: string | number

    Returns Date

inheritedprocessDateProperty

  • processDateProperty(value): string | number | Date
  • Processes a date value before persisting, applying timezone or format conversions.


    Parameters

    • value: unknown

    Returns string | number | Date

inheritedprocessJsonCondition

  • processJsonCondition<T>(o, value, path, alias): FilterQuery<T>

quoteIdentifier

  • quoteIdentifier(id): string
  • Wraps a table or column identifier with the platform-specific quote character.


    Parameters

    • id: string | { toString: () => string }
      • toString: () => string

    Returns string

inheritedquoteValue

  • quoteValue(value): string
  • Quotes a literal value for safe embedding in SQL.


    Parameters

    • value: any

    Returns string

inheritedsetConfig

  • setConfig(config): void

inheritedshouldHaveColumn

  • shouldHaveColumn<T>(prop, populate, exclude, includeFormulas, ignoreInlineEmbeddables): boolean
  • Whether the given property should be included as a column in the SELECT query.


    Parameters

    • prop: EntityProperty<T, any>
    • populate: boolean | readonly PopulateOptions<T>[]
    • optionalexclude: string[]
    • includeFormulas: boolean = true
    • ignoreInlineEmbeddables: boolean = true

    Returns boolean

inheritedsupportsCreatingFullTextIndex

  • supportsCreatingFullTextIndex(): boolean
  • Returns boolean

inheritedsupportsCustomPrimaryKeyNames

  • supportsCustomPrimaryKeyNames(): boolean
  • Whether the platform supports custom names for primary key constraints.


    Returns boolean

inheritedsupportsDeferredUniqueConstraints

  • supportsDeferredUniqueConstraints(): boolean
  • Whether the platform supports deferred unique constraints.


    Returns boolean

inheritedsupportsDownMigrations

  • supportsDownMigrations(): boolean
  • Whether the platform supports generating down migrations.


    Returns boolean

inheritedsupportsMaterializedViews

  • supportsMaterializedViews(): boolean
  • Whether this platform supports materialized views.


    Returns boolean

supportsMultipleCascadePaths

  • supportsMultipleCascadePaths(): boolean
  • Whether the platform supports multiple cascade paths to the same table.


    Returns boolean

supportsMultipleStatements

  • supportsMultipleStatements(): boolean
  • Whether the connection supports executing multiple SQL statements in a single call.


    Returns boolean

inheritedsupportsNativeEnums

  • supportsNativeEnums(): boolean
  • for postgres native enums


    Returns boolean

inheritedsupportsOnUpdate

  • supportsOnUpdate(): boolean
  • Returns true if the platform supports ON UPDATE foreign key rules. Oracle doesn't support ON UPDATE rules.


    Returns boolean

supportsSchemas

  • supportsSchemas(): boolean
  • Returns boolean

inheritedsupportsTransactions

  • supportsTransactions(): boolean
  • Whether this driver supports database transactions.


    Returns boolean

inheritedsupportsUnionWhere

  • supportsUnionWhere(): boolean
  • Whether the platform supports the UNION WHERE optimization for multi-branch queries.


    Returns boolean

inheritedsupportsUnsigned

  • supportsUnsigned(): boolean
  • Whether the platform supports unsigned integer columns.


    Returns boolean

inheritedunmarshallArray

  • unmarshallArray(value): string[]
  • Deserializes a database-stored array string back into a string array.


    Parameters

    • value: string

    Returns string[]

inheritedusesAsKeyword

  • usesAsKeyword(): boolean
  • Returns boolean

inheritedusesBatchInserts

  • usesBatchInserts(): boolean
  • Whether or not the driver supports retuning list of created PKs back when multi-inserting


    Returns boolean

inheritedusesBatchUpdates

  • usesBatchUpdates(): boolean
  • Whether or not the driver supports updating many records at once


    Returns boolean

inheritedusesCascadeStatement

  • usesCascadeStatement(): boolean
  • Whether DELETE statements require explicit CASCADE keyword.


    Returns boolean

inheritedusesDefaultKeyword

  • usesDefaultKeyword(): boolean
  • Whether the platform supports the DEFAULT keyword in INSERT statements.


    Returns boolean

usesEnumCheckConstraints

  • usesEnumCheckConstraints(): boolean
  • for postgres text enums (default)


    Returns boolean

inheritedusesImplicitTransactions

  • usesImplicitTransactions(): boolean
  • Whether the driver wraps operations in implicit transactions by default.


    Returns boolean

usesOutputStatement

  • usesOutputStatement(): boolean
  • Whether the driver supports OUTPUT clause (e.g. MSSQL).


    Returns boolean

inheritedusesPivotTable

  • usesPivotTable(): boolean
  • Whether this driver uses pivot tables for M:N relations (SQL drivers do, MongoDB does not).


    Returns boolean

inheritedusesReturningStatement

  • usesReturningStatement(): boolean
  • Whether the driver supports RETURNING clause (e.g. PostgreSQL).


    Returns boolean

validateMetadata

  • validateMetadata(meta): void
  • Platform-specific validation of entity metadata.


    Parameters

    Returns void

Page Options