MySQL: Check for case-sensitivity
This commit is contained in:
@@ -48,6 +48,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
string FormatTableRename(string oldName, string newName);
|
||||
bool SupportsClustered();
|
||||
bool SupportsIdentityInsert();
|
||||
bool? SupportsCaseInsensitiveQueries(Database db);
|
||||
IEnumerable<string> GetTablesInSchema(Database db);
|
||||
IEnumerable<ColumnInfo> GetColumnsInSchema(Database db);
|
||||
IEnumerable<Tuple<string, string>> GetConstraintsPerTable(Database db);
|
||||
|
||||
@@ -309,5 +309,27 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
public override string DropIndex { get { return "DROP INDEX {0} ON {1}"; } }
|
||||
|
||||
public override string RenameColumn { get { return "ALTER TABLE {0} CHANGE {1} {2}"; } }
|
||||
|
||||
public override bool? SupportsCaseInsensitiveQueries(Database db)
|
||||
{
|
||||
bool? supportsCaseInsensitiveQueries;
|
||||
|
||||
try
|
||||
{
|
||||
db.OpenSharedConnection();
|
||||
var lowerCaseFileSystem = db.Fetch<int>("SELECT @@Global.lower_case_file_system");
|
||||
var lowerCaseTableNames = db.Fetch<int>("SELECT @@Global.lower_case_table_names");
|
||||
|
||||
supportsCaseInsensitiveQueries = lowerCaseFileSystem.First() == 1 && lowerCaseTableNames.First() == 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
|
||||
// Could return null, which means testing failed,
|
||||
// add message to check with their hosting provider
|
||||
return supportsCaseInsensitiveQueries;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
return "NVARCHAR";
|
||||
}
|
||||
|
||||
public virtual bool? SupportsCaseInsensitiveQueries(Database db)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual IEnumerable<string> GetTablesInSchema(Database db)
|
||||
{
|
||||
return new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user