MsSqlPlatform
Hierarchy
- AbstractSqlPlatform
- MsSqlPlatform
Index
Constructors
Methods
- allowsComparingTuples
- cloneEmbeddable
- compareUuids
- convertDateToJSValue
- convertIntervalToDatabaseValue
- convertIntervalToJSValue
- convertJsonToDatabaseValue
- convertJsonToJSValue
- convertsJsonAutomatically
- convertUuidToDatabaseValue
- convertUuidToJSValue
- convertVersionValue
- denormalizePrimaryKey
- escape
- extractSimpleType
- formatQuery
- generateCustomOrder
- getArrayDeclarationSQL
- getBeginTransactionSQL
- getBigIntTypeDeclarationSQL
- getBlobDeclarationSQL
- getBooleanTypeDeclarationSQL
- getCharTypeDeclarationSQL
- getCommitTransactionSQL
- getConfig
- getCurrentTimestampSQL
- getDateTimeTypeDeclarationSQL
- getDateTypeDeclarationSQL
- getDecimalTypeDeclarationSQL
- getDefaultCharLength
- getDefaultCharset
- getDefaultClientUrl
- getDefaultDateTimeLength
- getDefaultMappedType
- getDefaultPrimaryName
- getDefaultSchemaName
- getDefaultVarcharLength
- getDefaultVersionLength
- getDoubleDeclarationSQL
- getEnumTypeDeclarationSQL
- getExceptionConverter
- getExtension
- getFloatDeclarationSQL
- getFullTextIndexExpression
- getFullTextWhereClause
- getIndexName
- getIntegerTypeDeclarationSQL
- getIntervalTypeDeclarationSQL
- getJsonDeclarationSQL
- getJsonIndexDefinition
- getMappedType
- getMediumIntTypeDeclarationSQL
- getNamingStrategy
- getRegExpOperator
- getRegExpValue
- getReleaseSavepointSQL
- getRepositoryClass
- getRollbackToSavepointSQL
- getRollbackTransactionSQL
- getSavepointSQL
- getSchemaGenerator
- getSchemaHelper
- getSearchJsonPropertyKey
- getSearchJsonPropertySQL
- getSmallIntTypeDeclarationSQL
- getTextTypeDeclarationSQL
- getTimeTypeDeclarationSQL
- getTimezone
- getTinyIntTypeDeclarationSQL
- getUuidTypeDeclarationSQL
- getVarcharTypeDeclarationSQL
- indexForeignKeys
- init
- isAllowedTopLevelOperator
- isBigIntProperty
- isNumericColumn
- isNumericProperty
- isPopulated
- lookupExtensions
- mapRegExpCondition
- marshallArray
- normalizeColumnType
- normalizePrimaryKey
- parseDate
- processDateProperty
- processJsonCondition
- quoteIdentifier
- quoteValue
- setConfig
- shouldHaveColumn
- supportsCreatingFullTextIndex
- supportsCustomPrimaryKeyNames
- supportsDeferredUniqueConstraints
- supportsDownMigrations
- supportsMaterializedViews
- supportsMultipleCascadePaths
- supportsMultipleStatements
- supportsNativeEnums
- supportsOnUpdate
- supportsSchemas
- supportsTransactions
- supportsUnionWhere
- supportsUnsigned
- unmarshallArray
- usesAsKeyword
- usesBatchInserts
- usesBatchUpdates
- usesCascadeStatement
- usesDefaultKeyword
- usesEnumCheckConstraints
- usesImplicitTransactions
- usesOutputStatement
- usesPivotTable
- usesReturningStatement
- validateMetadata
Constructors
constructor
Returns MsSqlPlatform
Methods
allowsComparingTuples
Whether the platform supports tuple comparison in WHERE clauses.
Returns boolean
inheritedcloneEmbeddable
Deep-clones embeddable data and tags it for JSON serialization.
Parameters
data: T
Returns T
inheritedcompareUuids
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
Parameters
value: string | Date
Returns string
inheritedconvertIntervalToDatabaseValue
Parameters
value: unknown
Returns unknown
inheritedconvertIntervalToJSValue
Parameters
value: string
Returns unknown
inheritedconvertJsonToDatabaseValue
Converts a JS value to its JSON database representation (typically JSON.stringify).
Parameters
value: unknown
optionalcontext: TransformContext
Returns unknown
inheritedconvertJsonToJSValue
Converts a database JSON value to its JS representation.
Parameters
value: unknown
optionalcontext: TransformContext
Returns unknown
convertsJsonAutomatically
Whether the driver automatically parses JSON columns into JS objects.
Returns boolean
inheritedconvertUuidToDatabaseValue
Parameters
value: unknown
Returns unknown
inheritedconvertUuidToJSValue
Parameters
value: unknown
Returns unknown
inheritedconvertVersionValue
Converts a version field value for comparison in optimistic locking queries.
Parameters
value: number | Date
prop: EntityProperty<any, any>
Returns string | number | Date | { $in: (string | number)[] }
inheriteddenormalizePrimaryKey
Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)
Parameters
data: IPrimaryKeyValue
Returns IPrimaryKeyValue
escape
Parameters
value: any
Returns string
inheritedextractSimpleType
Extracts the base type name from a full SQL type declaration (e.g. "varchar(255)" -> "varchar").
Parameters
type: string
Returns string
inheritedformatQuery
Replaces
?placeholders in SQL with quoted parameter values.Parameters
sql: string
params: readonly any[]
Returns string
inheritedgenerateCustomOrder
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
Returns the SQL type declaration used for array storage.
Returns string
inheritedgetBeginTransactionSQL
Parameters
optionaloptions: { isolationLevel?: IsolationLevel; readOnly?: boolean }
optionalisolationLevel: IsolationLevel
optionalreadOnly: boolean
Returns string[]
inheritedgetBigIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getBlobDeclarationSQL
Returns string
getBooleanTypeDeclarationSQL
Returns the SQL type declaration for boolean columns.
Returns string
inheritedgetCharTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
inheritedgetCommitTransactionSQL
Returns string
inheritedgetConfig
Returns the current ORM configuration.
Returns Configuration<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>>
getCurrentTimestampSQL
Returns the SQL specific for the platform to get the current timestamp
Parameters
length: number
Returns string
getDateTimeTypeDeclarationSQL
Returns the SQL type declaration for datetime columns.
Parameters
column: { length?: number }
optionallength: number
Returns string
inheritedgetDateTypeDeclarationSQL
Returns the SQL type declaration for date columns.
Parameters
optionallength: number
Returns string
inheritedgetDecimalTypeDeclarationSQL
Parameters
column: { precision?: number; scale?: number }
optionalprecision: number
optionalscale: number
Returns string
inheritedgetDefaultCharLength
Returns the default length for char columns.
Returns number
inheritedgetDefaultCharset
Returns the default character set for this platform.
Returns string
getDefaultClientUrl
Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)
Returns string
getDefaultDateTimeLength
Returns the default fractional seconds precision for datetime columns.
Returns number
getDefaultMappedType
Returns the default mapped Type for a given type string when no custom mapping is configured.
Parameters
type: string
Returns Type<unknown, unknown>
inheritedgetDefaultPrimaryName
Returns the default primary key constraint name.
Parameters
tableName: string
columns: string[]
Returns string
getDefaultSchemaName
Returns the default schema name for this platform (e.g. "public" for PostgreSQL).
Returns undefined | string
inheritedgetDefaultVarcharLength
Returns the default length for varchar columns.
Returns number
inheritedgetDefaultVersionLength
Returns the default fractional seconds precision for version timestamp columns.
Returns number
getDoubleDeclarationSQL
Returns string
getEnumTypeDeclarationSQL
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
Retrieves a registered extension (e.g. SchemaGenerator, Migrator), throwing if not found.
Parameters
extensionName: string
extensionKey: string
moduleName: string
em: EntityManager<IDatabaseDriver<Connection>>
Returns T
getFloatDeclarationSQL
Returns string
inheritedgetFullTextIndexExpression
Parameters
indexName: string
schemaName: undefined | string
tableName: string
columns: SimpleColumnMeta[]
Returns string
inheritedgetFullTextWhereClause
Parameters
prop: EntityProperty<any, any>
Returns string
inheritedgetIndexName
Returns the default name of index for the given columns
Parameters
tableName: string
columns: string[]
type: primary | index | unique | foreign | sequence
Returns string
inheritedgetIntegerTypeDeclarationSQL
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
Parameters
column: { length?: number }
optionallength: number
Returns string
getJsonDeclarationSQL
Returns string
inheritedgetJsonIndexDefinition
Parameters
index: IndexDef
Returns string[]
inheritedgetMappedType
Returns the mapped Type instance for a given SQL/runtime type string.
Parameters
type: string
Returns Type<unknown, unknown>
inheritedgetMediumIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
inheritedgetNamingStrategy
Returns the default naming strategy constructor for this platform.
Returns new () => NamingStrategy
Returns NamingStrategy
getRegExpOperator
Returns the SQL operator used for regular expression matching.
Returns string
inheritedgetRegExpValue
Converts a JavaScript RegExp into a platform-specific regex representation.
Parameters
val: RegExp
Returns { $flags?: string; $re: string }
optional$flags?: string
$re: string
inheritedgetReleaseSavepointSQL
Parameters
savepointName: string
Returns string
inheritedgetRepositoryClass
Returns the default EntityRepository class used by this platform.
Returns Constructor<EntityRepository<T>>
getRollbackToSavepointSQL
Parameters
savepointName: string
Returns string
inheritedgetRollbackTransactionSQL
Returns string
getSavepointSQL
Parameters
savepointName: string
Returns string
getSchemaGenerator
Parameters
driver: IDatabaseDriver<Connection>
optionalem: SqlEntityManager<AbstractSqlDriver<AbstractSqlConnection, AbstractSqlPlatform>>
Returns MsSqlSchemaGenerator
inheritedgetSchemaHelper
Returns the schema helper instance for this platform, or undefined if not supported.
Returns undefined | SchemaHelper
getSearchJsonPropertyKey
Parameters
path: string[]
type: string
aliased: boolean
optionalvalue: unknown
Returns string | RawQueryFragment<string>
inheritedgetSearchJsonPropertySQL
Parameters
path: string
type: string
aliased: boolean
Returns string | RawQueryFragment<string>
inheritedgetSmallIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
inheritedgetTextTypeDeclarationSQL
Parameters
_column: { length?: number }
optionallength: number
Returns string
inheritedgetTimeTypeDeclarationSQL
Returns the SQL type declaration for time columns.
Parameters
optionallength: number
Returns string
inheritedgetTimezone
Returns the configured timezone, or undefined if not set.
Returns undefined | string
inheritedgetTinyIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getUuidTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
getVarcharTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
indexForeignKeys
Whether the platform automatically creates indexes on foreign key columns.
Returns boolean
init
Parameters
orm: MikroORM<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>, (string | EntitySchema<any, never, EntityCtor<any>> | EntityClass<Partial<any>>)[]>
Returns void
inheritedisAllowedTopLevelOperator
Whether the given operator is allowed at the top level of a query condition.
Parameters
operator: string
Returns boolean
inheritedisBigIntProperty
Whether the given property maps to a bigint database column.
Parameters
prop: EntityProperty<any, any>
Returns boolean
inheritedisNumericColumn
Whether the given mapped type represents a numeric column.
Parameters
mappedType: Type<unknown, unknown>
Returns boolean
inheritedisNumericProperty
Whether the given property represents a numeric database column.
Parameters
prop: EntityProperty<any, any>
ignoreCustomType: boolean = false
Returns boolean
inheritedisPopulated
Whether the given property key is included in the populate hint.
Parameters
key: string
populate: boolean | readonly PopulateOptions<T>[]
Returns boolean
lookupExtensions
Allows registering extensions of the driver automatically (e.g.
SchemaGeneratorextension in SQL drivers).Parameters
orm: MikroORM<MsSqlDriver, SqlEntityManager<MsSqlDriver> & EntityManager<MsSqlDriver>, (string | EntitySchema<any, never, EntityCtor<any>> | EntityClass<Partial<any>>)[]>
Returns void
inheritedmapRegExpCondition
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
Serializes a string array into its database storage format.
Parameters
values: string[]
Returns string
normalizeColumnType
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
Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)
Parameters
data: IPrimaryKeyValue | Primary<T>
Returns T
inheritedparseDate
Parses a string or numeric value into a Date object.
Parameters
value: string | number
Returns Date
inheritedprocessDateProperty
Processes a date value before persisting, applying timezone or format conversions.
Parameters
value: unknown
Returns string | number | Date
inheritedprocessJsonCondition
Parameters
o: FilterQuery<T>
value: EntityValue<T>
path: EntityKey<T>[]
alias: boolean
Returns FilterQuery<T>
quoteIdentifier
Wraps a table or column identifier with the platform-specific quote character.
Parameters
id: string | { toString: () => string }
toString: () => string
Returns string
inheritedquoteValue
Quotes a literal value for safe embedding in SQL.
Parameters
value: any
Returns string
inheritedsetConfig
Initializes the platform with the ORM configuration.
Parameters
Returns void
inheritedshouldHaveColumn
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
Returns boolean
inheritedsupportsCustomPrimaryKeyNames
Whether the platform supports custom names for primary key constraints.
Returns boolean
inheritedsupportsDeferredUniqueConstraints
Whether the platform supports deferred unique constraints.
Returns boolean
inheritedsupportsDownMigrations
Whether the platform supports generating down migrations.
Returns boolean
inheritedsupportsMaterializedViews
Whether this platform supports materialized views.
Returns boolean
supportsMultipleCascadePaths
Whether the platform supports multiple cascade paths to the same table.
Returns boolean
supportsMultipleStatements
Whether the connection supports executing multiple SQL statements in a single call.
Returns boolean
inheritedsupportsNativeEnums
for postgres native enums
Returns boolean
inheritedsupportsOnUpdate
Returns true if the platform supports ON UPDATE foreign key rules. Oracle doesn't support ON UPDATE rules.
Returns boolean
supportsSchemas
Returns boolean
inheritedsupportsTransactions
Whether this driver supports database transactions.
Returns boolean
inheritedsupportsUnionWhere
Whether the platform supports the UNION WHERE optimization for multi-branch queries.
Returns boolean
inheritedsupportsUnsigned
Whether the platform supports unsigned integer columns.
Returns boolean
inheritedunmarshallArray
Deserializes a database-stored array string back into a string array.
Parameters
value: string
Returns string[]
inheritedusesAsKeyword
Returns boolean
inheritedusesBatchInserts
Whether or not the driver supports retuning list of created PKs back when multi-inserting
Returns boolean
inheritedusesBatchUpdates
Whether or not the driver supports updating many records at once
Returns boolean
inheritedusesCascadeStatement
Whether DELETE statements require explicit CASCADE keyword.
Returns boolean
inheritedusesDefaultKeyword
Whether the platform supports the DEFAULT keyword in INSERT statements.
Returns boolean
usesEnumCheckConstraints
for postgres text enums (default)
Returns boolean
inheritedusesImplicitTransactions
Whether the driver wraps operations in implicit transactions by default.
Returns boolean
usesOutputStatement
Whether the driver supports OUTPUT clause (e.g. MSSQL).
Returns boolean
inheritedusesPivotTable
Whether this driver uses pivot tables for M:N relations (SQL drivers do, MongoDB does not).
Returns boolean
inheritedusesReturningStatement
Whether the driver supports RETURNING clause (e.g. PostgreSQL).
Returns boolean
validateMetadata
Platform-specific validation of entity metadata.
Parameters
meta: EntityMetadata<any, EntityCtor<any>>
Returns void
Platform implementation for Microsoft SQL Server.