import { DataTypeMap } from './dataTypeMap.js'; import { SQLDialect, DatabasePlatform, LimitClauseResult, SchemaIntrospectionSQL, TriggerOptions, IndexOptions, ColumnDDLOptions, AlterColumnOptions, ResolveTypeOptions } from './sqlDialect.js'; /** * SQL Server dialect implementation. * Uses [bracket] quoting, TOP for pagination, BIT for booleans, T-SQL functions. */ export declare class SQLServerDialect extends SQLDialect { get PlatformKey(): DatabasePlatform; get ParserDialect(): string; QuoteIdentifier(name: string): string; QuoteSchema(schema: string, object: string): string; /** * SQL Server identifiers are case-insensitive by default, so a bare * alias preserves the requested casing when echoed in result-set * column metadata. Bracketed quoting would also work but is unnecessary. */ QuoteColumnAlias(aliasName: string): string; /** SQL Server is case-insensitive for identifiers; the schema name is stored as-given. */ CanonicalSchemaName(name: string): string; LimitClause(limit: number, offset?: number): LimitClauseResult; BooleanLiteral(value: boolean): string; BooleanParameterType(): string; ParameterRef(name: string): string; ParameterDefault(value: string): string; /** * SQL Server has both `ISNULL` (T-SQL native, two-arg only) and `COALESCE` * (ANSI, n-ary). For two-argument null-coalescing we emit the native * `ISNULL` form so generated SPs match the conventional T-SQL idiom and * the data-type-of-first-argument semantics callers may already rely on. */ IsNull(expr: string, fallback: string): string; /** * SQL Server supports `COALESCE` as an ANSI-standard alternative to its * native `ISNULL`. The two differ subtly in return-type inference and * argument arity (`COALESCE` is n-ary; `ISNULL` is two-arg only). Use * this helper when codegen needs the n-ary form or when caller intent * is ANSI-portable rather than T-SQL-native. */ Coalesce(expr: string, fallback: string): string; CurrentTimestampUTC(): string; private static readonly _BooleanTypeNames; private static readonly _StringTypeNames; /** `char` and `nchar` right-pad stored values with spaces up to declared length. */ private static readonly _FixedWidthStringTypeNames; private static readonly _DateTypeNames; private static readonly _IntegerTypeNames; private static readonly _FloatTypeNames; private static readonly _UuidTypeNames; private static readonly _BinaryTypeNames; private static readonly _JsonTypeNames; private static readonly _CurrencyTypeNames; private static readonly _IntervalTypeNames; private static readonly _NetworkTypeNames; get BooleanTypeNames(): readonly string[]; get StringTypeNames(): readonly string[]; get FixedWidthStringTypeNames(): readonly string[]; /** SQL Server index keys are limited to 900 bytes → 450 NVARCHAR (2-byte) chars. */ get MaxKeyStringLength(): number; /** SQL Server enforces a hard ~8060-byte in-row row size; only variable-length values go off-row. */ get MaxInRowSizeBytes(): number; /** SQL Server's hard per-table column cap. */ get MaxColumnCount(): number; /** * Minimum in-row byte footprint of a column. Off-row-capable variable-length / LOB types * (incl. `(N)VARCHAR(MAX)`) contribute only a 24-byte in-row pointer; fixed-length types * contribute their full size. Unknown types are treated as off-row pointers (conservative). */ EstimateInRowBytes(rawSqlType: string): number; get DateTypeNames(): readonly string[]; get IntegerTypeNames(): readonly string[]; get FloatTypeNames(): readonly string[]; get UuidTypeNames(): readonly string[]; get BinaryTypeNames(): readonly string[]; get JsonTypeNames(): readonly string[]; get CurrencyTypeNames(): readonly string[]; get IntervalTypeNames(): readonly string[]; get NetworkTypeNames(): readonly string[]; NewUUID(): string; CastToText(expr: string): string; /** * SQL Server-specific Flyway escape. Interleaves a `CAST(N'' AS NVARCHAR(MAX))` * between the split halves so the running T-SQL concat chain inherits * NVARCHAR(MAX) precedence. Without the cast, `N'a' + N'b'` produces * NVARCHAR(a+b) capped at NVARCHAR(4000) and silently truncates anything * past 4,000 characters. */ EscapeFlywayStringInterpolation(sql: string): string; CastToUUID(expr: string): string; ReturnInsertedClause(columns?: string[]): string; AutoIncrementPKExpression(): string; UUIDPKDefault(): string; ScopeIdentityExpression(): string; RowCountExpression(): string; BatchSeparator(): string; ExistenceCheckSQL(objectType: string, schema: string, name: string): string; CreateOrReplaceSupported(_objectType: string): boolean; FullTextSearchPredicate(column: string, searchTerm: string): string; FullTextIndexDDL(table: string, columns: string[], catalog?: string): string; RecursiveCTESyntax(): string; get AllowsOrderByInCTE(): boolean; get DefaultPagingOrderBy(): string; get TypeMap(): DataTypeMap; ParameterPlaceholder(index: number): string; ConcatOperator(): string; StringSplitFunction(value: string, delimiter: string): string; JsonExtract(column: string, path: string): string; ProcedureCallSyntax(schema: string, name: string, params: string[]): string; CreateSchemaDDL(schemaName: string): string; /** SQL Server cannot index NVARCHAR(MAX) columns — cap to NVARCHAR(450). */ CapIndexableType(rawSqlType: string): string; DateAddExpression(unit: 'MINUTE' | 'HOUR' | 'DAY', amount: number, baseExpr: string): string; CreateTableIfNotExistsDDL(schema: string, tableName: string, columnsDDL: string): string; ConditionalBlock(condition: string, thenSQL: string, elseSQL?: string): string; RaiseSignalSQL(message: string): string; AddColumnClause(col: ColumnDDLOptions): string; AlterColumnDDL(quotedTable: string, options: AlterColumnOptions): string; CommentOnColumn(schema: string, table: string, column: string, comment: string): string; FallbackType(): string; TriggerDDL(options: TriggerOptions): string; IndexDDL(options: IndexOptions): string; GrantPermission(permission: string, _objectType: string, schema: string, object: string, role: string): string; CommentOnObject(objectType: string, schema: string, name: string, comment: string): string; CreateTableIfAbsent(fullTable: string, columnsBody: string): string; CommentOnObjectIfAbsent(objectType: string, schema: string, name: string, comment: string): string; CommentOnColumnIfAbsent(schema: string, table: string, column: string, comment: string): string; SchemaIntrospectionQueries(): SchemaIntrospectionSQL; /** * SQL Server FK-graph query for cascade planning — reads the `sys.foreign_keys` catalog. * Returns one row per FK column with `childNullable` (from `sys.columns.is_nullable`) and * `colCount` (columns in the constraint, for composite exclusion). Both parent + child are * filtered to `schema`. Schema is embedded as a literal (no bind params) so it runs via * `ExecuteSQL(sql)`. */ ForeignKeyGraphSQL(schema: string): string; AtomicBatchScript(statements: string[]): string; IIF(condition: string, trueVal: string, falseVal: string): string; ResolveAbstractType(options: ResolveTypeOptions): string; IsConnectionError(e: unknown): boolean; private resolveStringType; private objectTypeToLevel1Type; } //# sourceMappingURL=sqlServerDialect.d.ts.map