Fixing incorrect sql syntax when the query contains two expressions.

This commit is contained in:
Morten Christensen
2013-03-07 19:56:10 -01:00
parent ee95434cea
commit 2a09f02afb
3 changed files with 4 additions and 3 deletions

View File

@@ -523,7 +523,8 @@ namespace Umbraco.Core.Persistence.Querying
protected bool IsFieldName(string quotedExp)
{
return true;
//Not entirely sure this is reliable, but its better then simply returning true
return quotedExp.LastIndexOf("'", StringComparison.InvariantCultureIgnoreCase) + 1 != quotedExp.Length;
}
}
}

View File

@@ -194,7 +194,7 @@ namespace Umbraco.Core.Services
{
using (var repository = _repositoryFactory.CreateContentRepository(_uowProvider.GetUnitOfWork()))
{
var query = Query<IContent>.Builder.Where(x => x.Level == level && x.Path.Contains("-20") == false);
var query = Query<IContent>.Builder.Where(x => x.Level == level && !x.Path.StartsWith("-20"));
var contents = repository.GetByQuery(query);
return contents;

View File

@@ -155,7 +155,7 @@ namespace Umbraco.Core.Services
{
using (var repository = _repositoryFactory.CreateMediaRepository(_uowProvider.GetUnitOfWork()))
{
var query = Query<IMedia>.Builder.Where(x => x.Level == level && x.Path.Contains("-21") == false);
var query = Query<IMedia>.Builder.Where(x => x.Level == level && !x.Path.StartsWith("-21"));
var contents = repository.GetByQuery(query);
return contents;