View Source
Interface ISqlSyntaxProvider
Defines an SqlSyntaxProvider.
Assembly: Umbraco.Infrastructure.dll
Syntax
public interface ISqlSyntaxProvider
Properties
View Source
AddColumn
Declaration
string AddColumn { get; }
Property Value
View Source
AliasRegex
Gets a regex matching aliased fields.
Declaration
Regex AliasRegex { get; }
Property Value
View Source
AlterColumn
Declaration
string AlterColumn { get; }
Property Value
View Source
AlterSchema
Declaration
string AlterSchema { get; }
Property Value
View Source
ConvertDateToOrderableString
Declaration
string ConvertDateToOrderableString { get; }
Property Value
View Source
ConvertDecimalToOrderableString
Declaration
string ConvertDecimalToOrderableString { get; }
Property Value
View Source
ConvertIntegerToOrderableString
Declaration
string ConvertIntegerToOrderableString { get; }
Property Value
View Source
ConvertUniqueIdentifierToString
Declaration
string ConvertUniqueIdentifierToString { get; }
Property Value
View Source
CreateConstraint
Declaration
string CreateConstraint { get; }
Property Value
View Source
CreateIndex
Declaration
string CreateIndex { get; }
Property Value
View Source
CreateSchema
Declaration
string CreateSchema { get; }
Property Value
View Source
CreateTable
Declaration
string CreateTable { get; }
Property Value
View Source
DbProvider
Declaration
string DbProvider { get; }
Property Value
View Source
DefaultIsolationLevel
Returns the default isolation level for the database
Declaration
IsolationLevel DefaultIsolationLevel { get; }
Property Value
| Type |
Description |
| IsolationLevel |
|
View Source
DeleteConstraint
Declaration
string DeleteConstraint { get; }
Property Value
View Source
DeleteData
Declaration
string DeleteData { get; }
Property Value
View Source
DeleteDefaultConstraint
Declaration
string DeleteDefaultConstraint { get; }
Property Value
View Source
DropColumn
Declaration
string DropColumn { get; }
Property Value
View Source
DropIndex
Declaration
string DropIndex { get; }
Property Value
View Source
DropSchema
Declaration
string DropSchema { get; }
Property Value
View Source
DropTable
Declaration
string DropTable { get; }
Property Value
View Source
InsertData
Declaration
string InsertData { get; }
Property Value
View Source
Length
Declaration
Property Value
View Source
ProviderName
Declaration
string ProviderName { get; }
Property Value
View Source
RenameColumn
Declaration
string RenameColumn { get; }
Property Value
View Source
Declaration
string RenameTable { get; }
Property Value
View Source
ScalarMappers
Declaration
IDictionary<Type, IScalarMapper>? ScalarMappers { get; }
Property Value
View Source
Substring
Declaration
string Substring { get; }
Property Value
View Source
TruncateTable
Declaration
string TruncateTable { get; }
Property Value
View Source
UpdateData
Declaration
string UpdateData { get; }
Property Value
Methods
View Source
AlterSequences(IUmbracoDatabase)
Alters the database sequences to match the current schema requirements.
Declaration
void AlterSequences(IUmbracoDatabase database)
Parameters
| Type |
Name |
Description |
| IUmbracoDatabase |
database |
The database connection to use for altering sequences.
|
View Source
AlterSequences(IUmbracoDatabase, string)
Alters the database sequences associated with the specified table for providers that support sequences.
Declaration
void AlterSequences(IUmbracoDatabase database, string tableName)
Parameters
| Type |
Name |
Description |
| IUmbracoDatabase |
database |
The database connection to use for altering the sequences.
|
| string |
tableName |
The name of the table whose sequences will be altered.
|
View Source
AppendForUpdateHint(Sql<ISqlContext>)
Appends the relevant ForUpdate hint.
Declaration
Sql<ISqlContext> AppendForUpdateHint(Sql<ISqlContext> sql)
Parameters
Returns
View Source
ColumnWithAlias(string, string, string)
Declaration
string ColumnWithAlias(string tableNameOrAlias, string columnName, string columnAlias = "")
Parameters
| Type |
Name |
Description |
| string |
tableNameOrAlias |
|
| string |
columnName |
|
| string |
columnAlias |
|
Returns
View Source
ConvertIntegerToBoolean(int)
Declaration
string ConvertIntegerToBoolean(int value)
Parameters
| Type |
Name |
Description |
| int |
value |
|
Returns
View Source
DoesPrimaryKeyExist(IDatabase, string, string)
Declaration
bool DoesPrimaryKeyExist(IDatabase db, string tableName, string primaryKeyName)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
| string |
tableName |
|
| string |
primaryKeyName |
|
Returns
View Source
DoesTableExist(IDatabase, string)
Declaration
bool DoesTableExist(IDatabase db, string tableName)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
| string |
tableName |
|
Returns
View Source
EscapeString(string)
Declaration
string EscapeString(string val)
Parameters
| Type |
Name |
Description |
| string |
val |
|
Returns
View Source
Declaration
string Format(IEnumerable<ColumnDefinition> columns)
Parameters
Returns
View Source
Declaration
List<string> Format(IEnumerable<ForeignKeyDefinition> foreignKeys)
Parameters
Returns
| Type |
Description |
| List<string> |
|
View Source
Declaration
List<string> Format(IEnumerable<IndexDefinition> indexes)
Parameters
Returns
| Type |
Description |
| List<string> |
|
View Source
Declaration
string Format(ColumnDefinition column)
Parameters
Returns
View Source
Declaration
string Format(ColumnDefinition column, string tableName, out IEnumerable<string> sqls)
Parameters
| Type |
Name |
Description |
| ColumnDefinition |
column |
|
| string |
tableName |
|
| IEnumerable<string> |
sqls |
|
Returns
View Source
Declaration
string Format(ForeignKeyDefinition foreignKey)
Parameters
Returns
View Source
Declaration
string Format(IndexDefinition index)
Parameters
Returns
View Source
Declaration
string Format(TableDefinition table)
Parameters
Returns
View Source
Declaration
string FormatColumnRename(string? tableName, string? oldName, string? newName)
Parameters
| Type |
Name |
Description |
| string |
tableName |
|
| string |
oldName |
|
| string |
newName |
|
Returns
View Source
Declaration
string FormatDateTime(DateTime date, bool includeTime = true)
Parameters
| Type |
Name |
Description |
| DateTime |
date |
|
| bool |
includeTime |
|
Returns
View Source
Declaration
string FormatPrimaryKey(TableDefinition table)
Parameters
Returns
View Source
Declaration
string FormatTableRename(string? oldName, string? newName)
Parameters
| Type |
Name |
Description |
| string |
oldName |
|
| string |
newName |
|
Returns
View Source
GetColumn(DatabaseType, string, string, string?, string?, bool)
Declaration
string GetColumn(DatabaseType dbType, string tableName, string columnName, string? columnAlias, string? referenceName = null, bool forInsert = false)
Parameters
| Type |
Name |
Description |
| DatabaseType |
dbType |
|
| string |
tableName |
|
| string |
columnName |
|
| string |
columnAlias |
|
| string |
referenceName |
|
| bool |
forInsert |
|
Returns
View Source
GetColumnsInSchema(IDatabase)
Declaration
IEnumerable<ColumnInfo> GetColumnsInSchema(IDatabase db)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
Returns
View Source
GetConcat(params string[])
Declaration
string GetConcat(params string[] args)
Parameters
| Type |
Name |
Description |
| string[] |
args |
|
Returns
View Source
GetConstraintsPerColumn(IDatabase)
Returns all constraints defined in the database (Primary keys, foreign keys, unique constraints...) (does not
include indexes)
Declaration
IEnumerable<Tuple<string, string, string>> GetConstraintsPerColumn(IDatabase db)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
Returns
| Type |
Description |
| IEnumerable<Tuple<string, string, string>> |
A Tuple containing: TableName, ColumnName, ConstraintName
|
View Source
GetConstraintsPerTable(IDatabase)
Returns all constraints defined in the database (Primary keys, foreign keys, unique constraints...) (does not
include indexes)
Declaration
IEnumerable<Tuple<string, string>> GetConstraintsPerTable(IDatabase db)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
Returns
| Type |
Description |
| IEnumerable<Tuple<string, string>> |
A Tuple containing: TableName, ConstraintName
|
View Source
GetDefinedIndexes(IDatabase)
Returns all defined Indexes in the database excluding primary keys
Declaration
IEnumerable<Tuple<string, string, string, bool>> GetDefinedIndexes(IDatabase db)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
Returns
| Type |
Description |
| IEnumerable<Tuple<string, string, string, bool>> |
A Tuple containing: TableName, IndexName, ColumnName, IsUnique
|
View Source
GetFieldNameForUpdate<TDto>(Expression<Func<TDto, object?>>, string?)
Declaration
string GetFieldNameForUpdate<TDto>(Expression<Func<TDto, object?>> fieldSelector, string? tableAlias = null)
Parameters
| Type |
Name |
Description |
| Expression<Func<TDto, object>> |
fieldSelector |
|
| string |
tableAlias |
|
Returns
Type Parameters
View Source
GetIndexType(IndexTypes)
Declaration
string GetIndexType(IndexTypes indexTypes)
Parameters
Returns
View Source
GetNullCastSuffix<T>()
Gets the SQL type cast extension (null type annotation) associated with a null value for the specified type parameter.
Declaration
string GetNullCastSuffix<T>()
Returns
| Type |
Description |
| string |
A string containing the SQL type cast extension (null type annotation) that represents a null value for type
T, or an empty string if no extension is defined.
|
Type Parameters
| Name |
Description |
| T |
The type for which to retrieve the SQL null type annotation.
|
View Source
GetQuotedColumnName(string?)
Declaration
string GetQuotedColumnName(string? columnName)
Parameters
| Type |
Name |
Description |
| string |
columnName |
|
Returns
View Source
GetQuotedName(string?)
Declaration
string GetQuotedName(string? name)
Parameters
| Type |
Name |
Description |
| string |
name |
|
Returns
View Source
GetQuotedTableName(string?)
Declaration
string GetQuotedTableName(string? tableName)
Parameters
| Type |
Name |
Description |
| string |
tableName |
|
Returns
View Source
GetQuotedValue(string)
Declaration
string GetQuotedValue(string value)
Parameters
| Type |
Name |
Description |
| string |
value |
|
Returns
View Source
GetSpecialDbType(SpecialDbType)
Declaration
string GetSpecialDbType(SpecialDbType dbType)
Parameters
Returns
View Source
GetStringColumnEqualComparison(string, int, TextColumnType)
Declaration
string GetStringColumnEqualComparison(string column, int paramIndex, TextColumnType columnType)
Parameters
| Type |
Name |
Description |
| string |
column |
|
| int |
paramIndex |
|
| TextColumnType |
columnType |
|
Returns
View Source
GetStringColumnWildcardComparison(string, int, TextColumnType)
Declaration
string GetStringColumnWildcardComparison(string column, int paramIndex, TextColumnType columnType)
Parameters
| Type |
Name |
Description |
| string |
column |
|
| int |
paramIndex |
|
| TextColumnType |
columnType |
|
Returns
View Source
GetTablesInSchema(IDatabase)
Declaration
IEnumerable<string> GetTablesInSchema(IDatabase db)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
|
Returns
| Type |
Description |
| IEnumerable<string> |
|
View Source
GetUpdatedDatabaseType(DatabaseType, string?)
Declaration
DatabaseType GetUpdatedDatabaseType(DatabaseType current, string? connectionString)
Parameters
| Type |
Name |
Description |
| DatabaseType |
current |
|
| string |
connectionString |
|
Returns
| Type |
Description |
| DatabaseType |
|
View Source
GetWildcardConcat(string)
This ensures that GetWildcardPlaceholder() character is surronded by '' when used inside a LIKE statement. E.g. in WhereLike() extension and the defaultConcat is used.
Declaration
string GetWildcardConcat(string concatDefault = "")
Parameters
| Type |
Name |
Description |
| string |
concatDefault |
When provided this overides the GetWildcardPlaceholder() default.
|
Returns
View Source
GetWildcardPlaceholder()
Declaration
string GetWildcardPlaceholder()
Returns
View Source
HandleCreateTable(IDatabase, TableDefinition, bool)
Declaration
void HandleCreateTable(IDatabase database, TableDefinition tableDefinition, bool skipKeysAndIndexes = false)
Parameters
| Type |
Name |
Description |
| IDatabase |
database |
|
| TableDefinition |
tableDefinition |
|
| bool |
skipKeysAndIndexes |
|
View Source
InsertForUpdateHint(Sql<ISqlContext>)
Appends the relevant ForUpdate hint.
Declaration
Sql<ISqlContext> InsertForUpdateHint(Sql<ISqlContext> sql)
Parameters
Returns
View Source
LeftJoinWithNestedJoin<TDto>(Sql<ISqlContext>, Func<Sql<ISqlContext>, Sql<ISqlContext>>, string?)
Handles left join with nested join
Declaration
Sql<ISqlContext>.SqlJoinClause<ISqlContext> LeftJoinWithNestedJoin<TDto>(Sql<ISqlContext> sql, Func<Sql<ISqlContext>, Sql<ISqlContext>> nestedJoin, string? alias = null)
Parameters
Returns
Type Parameters
View Source
OrderByGuid(string, string)
Declaration
string OrderByGuid(string tableName, string columnName)
Parameters
| Type |
Name |
Description |
| string |
tableName |
|
| string |
columnName |
|
Returns
View Source
SelectTop(Sql<ISqlContext>, int)
Declaration
Sql<ISqlContext> SelectTop(Sql<ISqlContext> sql, int top)
Parameters
Returns
View Source
SupportsClustered()
Declaration
Returns
View Source
SupportsIdentityInsert()
Declaration
bool SupportsIdentityInsert()
Returns
View Source
SupportsSequences()
Determines whether the current database provider supports sequence objects for generating numeric values like PostgreSQL.
Declaration
Returns
| Type |
Description |
| bool |
true if the provider supports sequences; otherwise, false.
|
View Source
TruncateConstraintName<T>(string)
Some databases have a maximum length for constraint names, this method truncates the name if necessary.
Declaration
string TruncateConstraintName<T>(string constraintName)
Parameters
| Type |
Name |
Description |
| string |
constraintName |
unlimited name.
|
Returns
| Type |
Description |
| string |
truncated name.
|
Type Parameters
| Name |
Description |
| T |
type of the entity.
|
View Source
TryGetDefaultConstraint(IDatabase, string?, string, out string)
Tries to gets the name of the default constraint on a column.
Declaration
bool TryGetDefaultConstraint(IDatabase db, string? tableName, string columnName, out string constraintName)
Parameters
| Type |
Name |
Description |
| IDatabase |
db |
The database.
|
| string |
tableName |
The table name.
|
| string |
columnName |
The column name.
|
| string |
constraintName |
The constraint name.
|
Returns
| Type |
Description |
| bool |
A value indicating whether a default constraint was found.
|