MySQL: Check for case-sensitivity

This commit is contained in:
Sebastiaan Janssen
2013-02-25 13:14:26 -01:00
parent 7498b2f994
commit f3621aa743
5 changed files with 45 additions and 3 deletions

View File

@@ -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;
}
}
}