Path: redb/redb.Export/Flat/Dialects/IFlatDialect.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Export/Flat/Dialects/IFlatDialect.cs ---- using System.Data; namespace redb.Export.Flat.Dialects; /// /// What differs between the three providers when flat tables are created and filled: identifier /// quoting, column types, the value form the provider's bulk insert accepts, and how a consistent /// read of the source is obtained. /// internal interface IFlatDialect { /// Quotes an identifier, doubling the closing quote character inside it. string Quote(string identifier); /// Column type for . string ColumnType(FlatStorageType type); /// /// True when foreign keys can only be declared inside CREATE TABLE (SQLite). Otherwise /// they are added after the data is loaded, so that load order does not matter. /// bool InlineForeignKeys { get; } /// Name of a column as the provider's BulkInsertAsync expects it in the . string BulkColumnName(string column); /// Converts a non-null CLR value of to the form the provider's bulk insert writes correctly. object ToDbValue(object value, FlatStorageType type); /// Isolation level under which a source of this provider is read as one snapshot. IsolationLevel SnapshotIsolation { get; } /// /// Statement that creates the key sequence, starting at 1; null when the provider has no sequences. /// string? CreateSequence(string sequence); /// Statement that makes the sequence hand out next; null without sequences. string? RestartSequence(string sequence, long next); /// /// DEFAULT clause of a key column that takes its value from the sequence when a writer leaves /// it out; null when the provider generates such keys by itself. /// string? KeyDefault(string sequence); /// /// A statement whose only effect is that the provider's command-line client prints /// : the last line of a script, so that a run that got that far says so. /// string Report(string message); /// /// False when the provider refuses a cascading foreign key from a table to itself (SQL Server: "may /// cause cycles or multiple cascade paths"). Such a key is then declared without the cascade. /// bool AllowsSelfCascade { get; } } /// Resolves the dialect of a provider by its IDataProvider.Name. internal static class FlatDialects { public static IFlatDialect For(string providerName) => providerName switch { "postgres" => new PostgresFlatDialect(), "mssql" => new MssqlFlatDialect(), "sqlite" => new SqliteFlatDialect(), _ => throw new NotSupportedException($"Flat export is not available for provider '{providerName}'.") }; }