Fixes SqlCe and MySQL sorting on custom properties for list view, this also makes the query work much better and there is no longer a requirement for a sub-query in the order by statement.

This commit is contained in:
Shannon
2016-04-20 12:50:52 +02:00
parent b8d8c9e59a
commit f149ca9c76
7 changed files with 99 additions and 39 deletions

View File

@@ -70,8 +70,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax
bool SupportsClustered();
bool SupportsIdentityInsert();
bool? SupportsCaseInsensitiveQueries(Database db);
string IsNull { get; }
string ConvertIntegerToOrderableString { get; }
string ConvertDateToOrderableString { get; }
string ConvertDecimalToOrderableString { get; }

View File

@@ -361,10 +361,9 @@ ORDER BY TABLE_NAME, INDEX_NAME",
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 string IsNull { get { return "IFNULL({0},{1})"; } }
public override string ConvertIntegerToOrderableString { get { return "LPAD({0}, 8, '0')"; } }
public override string ConvertIntegerToOrderableString { get { return "LPAD(FORMAT({0}, 0), 8, '0')"; } }
public override string ConvertDateToOrderableString { get { return "DATE_FORMAT({0}, '%Y%m%d')"; } }
public override string ConvertDecimalToOrderableString { get { return "LPAD({0}, 25, '0')"; } }
public override string ConvertDecimalToOrderableString { get { return "LPAD(FORMAT({0}, 9), 20, '0')"; } }
public override bool? SupportsCaseInsensitiveQueries(Database db)
{

View File

@@ -209,7 +209,6 @@ ORDER BY TABLE_NAME, INDEX_NAME");
public override string DropIndex { get { return "DROP INDEX {1}.{0}"; } }
}
}

View File

@@ -538,9 +538,8 @@ namespace Umbraco.Core.Persistence.SqlSyntax
public virtual string DeleteConstraint { get { return "ALTER TABLE {0} DROP CONSTRAINT {1}"; } }
public virtual string CreateForeignKeyConstraint { get { return "ALTER TABLE {0} ADD CONSTRAINT {1} FOREIGN KEY ({2}) REFERENCES {3} ({4}){5}{6}"; } }
public virtual string IsNull { get { return "ISNULL({0},{1})"; } }
public virtual string ConvertIntegerToOrderableString { get { return "RIGHT('00000000' + CAST({0} AS varchar(8)),8)"; } }
public virtual string ConvertDateToOrderableString { get { return "CONVERT(varchar, {0}, 102)"; } }
public virtual string ConvertDecimalToOrderableString { get { return "RIGHT('0000000000000000000000000' + CAST({0} AS varchar(25)),25)"; } }
public virtual string ConvertIntegerToOrderableString { get { return "REPLACE(STR({0}, 8), SPACE(1), '0')"; } }
public virtual string ConvertDateToOrderableString { get { return "CONVERT(nvarchar, {0}, 102)"; } }
public virtual string ConvertDecimalToOrderableString { get { return "REPLACE(STR({0}, 20, 9), SPACE(1), '0')"; } }
}
}