SQLiteDialect
SQLite dialect implementation.
Hereda de: SqlDialectBase
Propiedades
public override bool CanAlterColumn { get; }
value = sQLiteDialect.CanAlterColumn
Whether an existing column's type or nullability can be changed in place. SQLite cannot: such a change means rebuilding the table.
public override string ConcatOperator { get; }
value = sQLiteDialect.ConcatOperator
SQL string concatenation operator.
public override string DecimalComparisonCastSqlType { get; }
value = sQLiteDialect.DecimalComparisonCastSqlType
SQL type name used to cast decimal operands before comparisons when the dialect stores decimals in a non-numeric affinity. Return when no comparison cast is required.
public override string IsNullFunction { get; }
value = sQLiteDialect.IsNullFunction
Function name for null-coalescing.
public override bool KeepsDecimalDigits { get; }
value = sQLiteDialect.KeepsDecimalDigits
Whether a decimal column keeps a declared precision and scale. A dialect that stores decimals as text keeps neither, so there is nothing to compare a declaration against.
public override string LenFunction { get; }
value = sQLiteDialect.LenFunction
Function name for string length.
public override int MaxParameters { get; }
value = sQLiteDialect.MaxParameters
Maximum number of parameters allowed in a single statement. SQL Server: 2100, SQLite: 999, PostgreSQL: 65535, MySQL: 65535.
public override string ParameterPrefix { get; }
value = sQLiteDialect.ParameterPrefix
Parameter prefix (e.g. @ for SQL Server, $ for PostgreSQL).
public override bool SupportsAddForeignKeyViaAlter { get; }
value = sQLiteDialect.SupportsAddForeignKeyViaAlter
True when this dialect can add a foreign key to an existing table via String). When false (SQLite), a foreign key can only be declared inline inside CREATE TABLE, so the migrator keeps new-table FKs inline and creates the referenced tables first.
public override string UnicodePrefix { get; }
value = sQLiteDialect.UnicodePrefix
Unicode string-literal prefix (e.g. N for SQL Server).
Métodos
public override void AppendAddForeignKey(StringBuilder sb, string tableName, string columnName, string refTableName, string refColumnName)
sQLiteDialect.AppendAddForeignKey(sb, tableName, columnName, refTableName, refColumnName)
Appends an ALTER TABLE ADD CONSTRAINT for a new foreign key.
public override void AppendAlterColumn(StringBuilder sb, string tableName, string columnName, Type clrType, bool isNullable, int maxLength, int precision, int scale, DbColumnInfo live)
sQLiteDialect.AppendAlterColumn(sb, tableName, columnName, clrType, isNullable, maxLength, precision, scale, live)
Appends ALTER TABLE ALTER COLUMN that gives a column the declared type and nullability.
- sb
- Where the statement goes.
- tableName
- The table.
- columnName
- The column.
- clrType
- The property type the column holds.
- isNullable
- Whether the column should allow NULLs.
- maxLength
- The declared length, 0 for the default.
- precision
- The declared precision, 0 for the default.
- scale
- The declared scale.
- live
- The column as the database holds it, or null for a column this script has just added; a dialect uses it to keep what the declaration does not decide, and to convert the stored values.
public override void AppendCreateTable(StringBuilder sb, string tableName, string columnDefs)
sQLiteDialect.AppendCreateTable(sb, tableName, columnDefs)
Appends CREATE TABLE [IF NOT EXISTS] statement.
public override void AppendDateAdd(StringBuilder sb, string part, string amountSql, string sourceSql)
sQLiteDialect.AppendDateAdd(sb, part, amountSql, sourceSql)
Appends a DATEADD-style expression.
public override void AppendDateDiff(StringBuilder sb, string part, string startSql, string endSql)
sQLiteDialect.AppendDateDiff(sb, part, startSql, endSql)
Appends a DATEDIFF-style expression computing minus , expressed in units.
- sb
- Target builder.
- part
- Unit of the result: year, month, week, day, hour, minute, second or millisecond.
- startSql
- SQL of the start date.
- endSql
- SQL of the end date.
public override void AppendDatePartClose(StringBuilder sb)
sQLiteDialect.AppendDatePartClose(sb)
Closes a date-part extraction expression opened by String).
public override void AppendDatePartOpen(StringBuilder sb, string part)
sQLiteDialect.AppendDatePartOpen(sb, part)
Opens a date-part extraction expression (closed by StringBuilder)).
public override void AppendDecimalModulo(StringBuilder sb, string dividendSql, string divisorSql)
sQLiteDialect.AppendDecimalModulo(sb, dividendSql, divisorSql)
Appends the remainder of dividing one decimal value by another, fraction included and with the sign of the dividend, as the C# % operator gives it.
- sb
- Target builder.
- dividendSql
- SQL of the dividend.
- divisorSql
- SQL of the divisor.
public override void AppendDropColumn(StringBuilder sb, string tableName, string columnName)
sQLiteDialect.AppendDropColumn(sb, tableName, columnName)
Appends ALTER TABLE DROP COLUMN.
public override void AppendDropForeignKey(StringBuilder sb, string tableName, string constraintName)
sQLiteDialect.AppendDropForeignKey(sb, tableName, constraintName)
Appends an ALTER TABLE DROP CONSTRAINT for an existing foreign key.
public override void AppendDropTable(StringBuilder sb, string tableName)
sQLiteDialect.AppendDropTable(sb, tableName)
Appends DROP TABLE [IF EXISTS] statement.
public override void AppendGreatest(StringBuilder sb, string leftSql, string rightSql)
sQLiteDialect.AppendGreatest(sb, leftSql, rightSql)
Appends the larger of two values, the way Decimal) picks it: a scalar function of two arguments, not the MAX aggregate.
- sb
- Target builder.
- leftSql
- SQL of the first value.
- rightSql
- SQL of the second value.
public override void AppendLeast(StringBuilder sb, string leftSql, string rightSql)
sQLiteDialect.AppendLeast(sb, leftSql, rightSql)
Appends the smaller of two values, the way Decimal) picks it: a scalar function of two arguments, not the MIN aggregate.
- sb
- Target builder.
- leftSql
- SQL of the first value.
- rightSql
- SQL of the second value.
public override void AppendPagination(StringBuilder sb, long? skip, long? take, bool hasOrderBy)
sQLiteDialect.AppendPagination(sb, skip, take, hasOrderBy)
Appends literal pagination (LIMIT/OFFSET or OFFSET/FETCH) with values.
public override void AppendPaginationParams(StringBuilder sb, string skipParamExpr, string takeParamExpr)
sQLiteDialect.AppendPaginationParams(sb, skipParamExpr, takeParamExpr)
Appends parameterised pagination with already-prefixed parameter expressions (e.g. @skip, @take).
public override void AppendTrimClose(StringBuilder sb)
sQLiteDialect.AppendTrimClose(sb)
Closes a TRIM expression opened by StringBuilder).
public override void AppendTrimOpen(StringBuilder sb)
sQLiteDialect.AppendTrimOpen(sb)
Opens a TRIM expression (closed by StringBuilder)).
protected override void AppendTruncate(StringBuilder sb, string valueSql, string digitsSql)
sQLiteDialect.AppendTruncate(sb, valueSql, digitsSql)
Appends an expression that drops the digits of a value beyond , rounding toward zero.
- sb
- Target builder.
- valueSql
- SQL of the value.
- digitsSql
- SQL of the number of fractional digits to keep, or for a whole number.
public override void AppendUpsert(StringBuilder sb, string tableName, string[] allColumns, string[] keyColumns)
sQLiteDialect.AppendUpsert(sb, tableName, allColumns, keyColumns)
Appends a UPSERT statement (MERGE on SQL Server, INSERT … ON CONFLICT on PostgreSQL/SQLite).
internal string BuildListUserTablesSql()
result = sQLiteDialect.BuildListUserTablesSql()
Builds the SELECT that lists user tables from sqlite_master. Routed through Query so the catalogue probe stays aligned with the rest of the dialect's SQL emission.
public override string FormatSkip(string skip)
result = sQLiteDialect.FormatSkip(skip)
Renders a SKIP/OFFSET clause from a parameter expression.
public override string FormatTake(string take)
result = sQLiteDialect.FormatTake(take)
Renders a TAKE/FETCH clause from a parameter expression.
public override string GetIdentityColumnSuffix()
result = sQLiteDialect.GetIdentityColumnSuffix()
Suffix for an identity (auto-increment primary key) column definition.
public override string GetIdentitySelect(string idCol)
result = sQLiteDialect.GetIdentitySelect(idCol)
SQL expression that returns the identity value of the last insert.
public override string GetIntegerToDecimalCastSqlType(int precision)
result = sQLiteDialect.GetIntegerToDecimalCastSqlType(precision)
SQL type a whole number is cast to when a query converts it to Decimal.
- precision
- Number of digits the source integer type can hold.
Devuelve: The SQL type name.
public override string GetSqlTypeName(Type clrType)
result = sQLiteDialect.GetSqlTypeName(clrType)
Returns the SQL type name for a CLR type.
public override string NewId()
result = sQLiteDialect.NewId()
Generates a new unique identifier.
public override string NormalizeDbType(string dbTypeName)
result = sQLiteDialect.NormalizeDbType(dbTypeName)
Normalises a raw database type name to the canonical form used by this dialect.
public override string QuoteIdentifier(string identifier)
result = sQLiteDialect.QuoteIdentifier(identifier)
Quotes an identifier (table name, column name).
public override Task<IReadOnlyList<DbForeignKeyInfo>> ReadDbForeignKeysAsync(DbConnection connection, string tableSchema, CancellationToken cancellationToken)
result = sQLiteDialect.ReadDbForeignKeysAsync(connection, tableSchema, cancellationToken)
Reads foreign-key metadata from a live database. Used by the schema migrator to detect missing/extra FK constraints on tables that already exist.
- connection
- An open database connection.
- tableSchema
- Schema name (e.g. "dbo" or "public"); dialect default when .
- cancellationToken
- Cancellation token.
Devuelve: One row per FK column — compound FKs surface as multiple rows.
public override Task<IReadOnlyList<DbIndexInfo>> ReadDbIndexesAsync(DbConnection connection, string tableSchema, CancellationToken cancellationToken)
result = sQLiteDialect.ReadDbIndexesAsync(connection, tableSchema, cancellationToken)
Reads index metadata from a live database. Used by the schema migrator to detect missing entity-declared [Index] / [Unique] attributes on tables that already exist. Composite indexes are returned as multiple rows sharing IndexName with ascending ColumnOrdinal.
- connection
- An open database connection.
- tableSchema
- Schema name (e.g. "dbo" or "public"); dialect default when .
- cancellationToken
- Cancellation token.
Devuelve: One row per indexed column — composite indexes surface as multiple rows.
public override Task<IReadOnlyList<DbColumnInfo>> ReadDbSchemaAsync(DbConnection connection, string tableSchema, CancellationToken cancellationToken)
result = sQLiteDialect.ReadDbSchemaAsync(connection, tableSchema, cancellationToken)
Reads column metadata from a live database.
public static void Register(DbProviderFactory factory)
SQLiteDialect.Register(factory)
Registers the SQLite dialect and provider factory with DatabaseProviderRegistry.
- factory
- The DbProviderFactory for SQLite.
public override string SysNow()
result = sQLiteDialect.SysNow()
System local date/time with offset.
public override string SysUtcNow()
result = sQLiteDialect.SysUtcNow()
System UTC date/time with offset.
Campos
public static readonly SQLiteDialect Instance
value = SQLiteDialect.Instance
Singleton instance.