MssqlDialect class

What the target SQL Server can do, and therefore which SQL a statement is compiled to.

Not an enum of version names. Two things decide whether a clause is available, and only one is the product version: SQL Server gates OFFSET … FETCH, DATEFROMPARTS and the rest of the 2012 language on the database's compatibility level as well, so a 2022 server hosting a database left at level 100 rejects them exactly as a 2008 server would. A descriptor carrying both numbers can answer that; a name cannot.

sql2008 and sql2012 remain as the two shapes a caller compiles for without a server in reach.

Annotations
  • @immutable

Constructors

MssqlDialect.forVersion({required int majorVersion, int? compatibilityLevel})
A descriptor for a server whose numbers are both known.
factory

Properties

compatibilityLevel int
The database's compatibility_level: 100 is 2008, 110 is 2012, 160 is 2022.
final
description String
Both numbers in a sentence, for an error a user can act on.
no setter
hashCode int
The hash code for this object.
no setteroverride
majorVersion int
The product version's major number: 10 is 2008, 11 is 2012, 16 is 2022.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportsDateBucket bool
DATE_BUCKET, added in SQL Server 2022.
no setter
supportsDatePartFunctions bool
DATEFROMPARTS, EOMONTH, TRY_CONVERT and the rest of the functions SQL Server 2012 added.
no setter
supportsOffsetFetch bool
OFFSET … FETCH NEXT, which is also what makes a page one statement rather than three.
no setter
supportsStringAgg bool
STRING_AGG, added in SQL Server 2017.
no setter
supportsWindowFrames bool
ROWS/RANGE window frames and the ordered window aggregates that need them. 2008 has ROW_NUMBER, RANK and OVER (PARTITION BY …) but no frame clause.
no setter
supportsWindowOffsetFunctions bool
LAG, LEAD, FIRST_VALUE and LAST_VALUE: the window functions that read another row of the same partition, added in SQL Server 2012.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
require(bool available, {required String feature, required String requires}) → void
Throws MssqlCapabilityException unless available holds.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

forProductVersion(String productVersion, {int? compatibilityLevel}) MssqlDialect
The descriptor for a raw SERVERPROPERTY('ProductVersion') string.
forServer(MssqlServerInfo info, {int? compatibilityLevel}) MssqlDialect
The descriptor for info, read from its product version.

Constants

sql2008 → const MssqlDialect
SQL Server 2008 and 2008 R2: paging through a ROW_NUMBER() subquery.
sql2012 → const MssqlDialect
SQL Server 2012: paging through OFFSET … FETCH NEXT.