mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
removed redundant qualifiers.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace Marr.Data.QGen
|
||||
using Marr.Data.QGen.Dialects;
|
||||
|
||||
namespace Marr.Data.QGen
|
||||
{
|
||||
/// <summary>
|
||||
/// This class creates a SQL delete query.
|
||||
@@ -7,9 +9,9 @@
|
||||
{
|
||||
protected Table TargetTable { get; set; }
|
||||
protected string WhereClause { get; set; }
|
||||
protected Dialects.Dialect Dialect { get; set; }
|
||||
protected Dialect Dialect { get; set; }
|
||||
|
||||
public DeleteQuery(Dialects.Dialect dialect, Table targetTable, string whereClause)
|
||||
public DeleteQuery(Dialect dialect, Table targetTable, string whereClause)
|
||||
{
|
||||
Dialect = dialect;
|
||||
TargetTable = targetTable;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Marr.Data.QGen
|
||||
case ExpressionType.Not:
|
||||
case ExpressionType.Quote:
|
||||
case ExpressionType.TypeAs:
|
||||
return this.VisitUnary((UnaryExpression)expression);
|
||||
return VisitUnary((UnaryExpression)expression);
|
||||
case ExpressionType.Add:
|
||||
case ExpressionType.AddChecked:
|
||||
case ExpressionType.And:
|
||||
@@ -60,15 +60,15 @@ namespace Marr.Data.QGen
|
||||
case ExpressionType.RightShift:
|
||||
case ExpressionType.Subtract:
|
||||
case ExpressionType.SubtractChecked:
|
||||
return this.VisitBinary((BinaryExpression)expression);
|
||||
return VisitBinary((BinaryExpression)expression);
|
||||
case ExpressionType.Call:
|
||||
return this.VisitMethodCall((MethodCallExpression)expression);
|
||||
return VisitMethodCall((MethodCallExpression)expression);
|
||||
case ExpressionType.Constant:
|
||||
return this.VisitConstant((ConstantExpression)expression);
|
||||
return VisitConstant((ConstantExpression)expression);
|
||||
case ExpressionType.MemberAccess:
|
||||
return this.VisitMemberAccess((MemberExpression)expression);
|
||||
return VisitMemberAccess((MemberExpression)expression);
|
||||
case ExpressionType.Parameter:
|
||||
return this.VisitParameter((ParameterExpression)expression);
|
||||
return VisitParameter((ParameterExpression)expression);
|
||||
|
||||
}
|
||||
throw new ArgumentOutOfRangeException("expression", expression.NodeType.ToString());
|
||||
@@ -111,8 +111,8 @@ namespace Marr.Data.QGen
|
||||
/// <returns></returns>
|
||||
protected virtual Expression VisitBinary(BinaryExpression expression)
|
||||
{
|
||||
this.Visit(expression.Left);
|
||||
this.Visit(expression.Right);
|
||||
Visit(expression.Left);
|
||||
Visit(expression.Right);
|
||||
return expression;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Marr.Data.QGen
|
||||
/// <returns></returns>
|
||||
protected virtual Expression VisitUnary(UnaryExpression expression)
|
||||
{
|
||||
this.Visit(expression.Operand);
|
||||
Visit(expression.Operand);
|
||||
return expression;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Marr.Data.QGen
|
||||
/// <returns></returns>
|
||||
protected virtual Expression VisitLamda(LambdaExpression lambdaExpression)
|
||||
{
|
||||
this.Visit(lambdaExpression.Body);
|
||||
Visit(lambdaExpression.Body);
|
||||
return lambdaExpression;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Marr.Data.Mapping;
|
||||
using System.Linq.Expressions;
|
||||
using Marr.Data.QGen.Dialects;
|
||||
|
||||
namespace Marr.Data.QGen
|
||||
{
|
||||
@@ -15,7 +16,7 @@ namespace Marr.Data.QGen
|
||||
private SqlModes _previousSqlMode;
|
||||
private bool _generateQuery = true;
|
||||
private bool _getIdentityValue;
|
||||
private Dialects.Dialect _dialect;
|
||||
private Dialect _dialect;
|
||||
private ColumnMapCollection _columnsToInsert;
|
||||
|
||||
public InsertQueryBuilder()
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Reflection;
|
||||
using Marr.Data.Mapping;
|
||||
using System.Data.Common;
|
||||
using System.Collections;
|
||||
using Marr.Data.QGen.Dialects;
|
||||
|
||||
namespace Marr.Data.QGen
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace Marr.Data.QGen
|
||||
#region - Private Members -
|
||||
|
||||
private DataMapper _db;
|
||||
private Dialects.Dialect _dialect;
|
||||
private Dialect _dialect;
|
||||
private TableCollection _tables;
|
||||
private WhereBuilder<T> _whereBuilder;
|
||||
private SortBuilder<T> _sortBuilder;
|
||||
@@ -71,7 +72,7 @@ namespace Marr.Data.QGen
|
||||
// Used only for unit testing with mock frameworks
|
||||
}
|
||||
|
||||
public QueryBuilder(DataMapper db, Dialects.Dialect dialect)
|
||||
public QueryBuilder(DataMapper db, Dialect dialect)
|
||||
{
|
||||
_db = db;
|
||||
_dialect = dialect;
|
||||
@@ -499,7 +500,7 @@ namespace Marr.Data.QGen
|
||||
/// </summary>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
protected override System.Linq.Expressions.Expression Visit(System.Linq.Expressions.Expression expression)
|
||||
protected override Expression Visit(Expression expression)
|
||||
{
|
||||
return base.Visit(expression);
|
||||
}
|
||||
@@ -509,9 +510,9 @@ namespace Marr.Data.QGen
|
||||
/// </summary>
|
||||
/// <param name="lambdaExpression"></param>
|
||||
/// <returns></returns>
|
||||
protected override System.Linq.Expressions.Expression VisitLamda(System.Linq.Expressions.LambdaExpression lambdaExpression)
|
||||
protected override Expression VisitLamda(LambdaExpression lambdaExpression)
|
||||
{
|
||||
_sortBuilder = this.Where(lambdaExpression as Expression<Func<T, bool>>);
|
||||
_sortBuilder = Where(lambdaExpression as Expression<Func<T, bool>>);
|
||||
return base.VisitLamda(lambdaExpression);
|
||||
}
|
||||
|
||||
@@ -520,16 +521,16 @@ namespace Marr.Data.QGen
|
||||
/// </summary>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
protected override System.Linq.Expressions.Expression VisitMethodCall(MethodCallExpression expression)
|
||||
protected override Expression VisitMethodCall(MethodCallExpression expression)
|
||||
{
|
||||
if (expression.Method.Name == "OrderBy" || expression.Method.Name == "ThenBy")
|
||||
{
|
||||
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as System.Linq.Expressions.LambdaExpression).Body as System.Linq.Expressions.MemberExpression;
|
||||
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as LambdaExpression).Body as MemberExpression;
|
||||
_sortBuilder.Order(memberExp.Expression.Type, memberExp.Member.Name);
|
||||
}
|
||||
if (expression.Method.Name == "OrderByDescending" || expression.Method.Name == "ThenByDescending")
|
||||
{
|
||||
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as System.Linq.Expressions.LambdaExpression).Body as System.Linq.Expressions.MemberExpression;
|
||||
var memberExp = ((expression.Arguments[1] as UnaryExpression).Operand as LambdaExpression).Body as MemberExpression;
|
||||
_sortBuilder.OrderByDescending(memberExp.Expression.Type, memberExp.Member.Name);
|
||||
}
|
||||
|
||||
@@ -540,14 +541,14 @@ namespace Marr.Data.QGen
|
||||
{
|
||||
_isJoin = true;
|
||||
MemberInfo rightMember = (rightEntity.Body as MemberExpression).Member;
|
||||
return this.Join(joinType, rightMember, filterExpression);
|
||||
return Join(joinType, rightMember, filterExpression);
|
||||
}
|
||||
|
||||
public virtual QueryBuilder<T> Join<TLeft, TRight>(JoinType joinType, Expression<Func<TLeft, TRight>> rightEntity, Expression<Func<TLeft, TRight, bool>> filterExpression)
|
||||
{
|
||||
_isJoin = true;
|
||||
MemberInfo rightMember = (rightEntity.Body as MemberExpression).Member;
|
||||
return this.Join(joinType, rightMember, filterExpression);
|
||||
return Join(joinType, rightMember, filterExpression);
|
||||
}
|
||||
|
||||
public virtual QueryBuilder<T> Join<TLeft, TRight>(JoinType joinType, MemberInfo rightMember, Expression<Func<TLeft, TRight, bool>> filterExpression)
|
||||
@@ -598,7 +599,7 @@ namespace Marr.Data.QGen
|
||||
|
||||
IEnumerator<T> IEnumerable<T>.GetEnumerator()
|
||||
{
|
||||
var list = this.ToList();
|
||||
var list = ToList();
|
||||
return list.GetEnumerator();
|
||||
}
|
||||
|
||||
@@ -608,7 +609,7 @@ namespace Marr.Data.QGen
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
var list = this.ToList();
|
||||
var list = ToList();
|
||||
return list.GetEnumerator();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Marr.Data.Mapping;
|
||||
using Marr.Data.QGen.Dialects;
|
||||
|
||||
namespace Marr.Data.QGen
|
||||
@@ -16,19 +17,19 @@ namespace Marr.Data.QGen
|
||||
private const string DB_FireBirdClient = "FirebirdSql.Data.FirebirdClient.FirebirdClientFactory";
|
||||
private const string DB_SQLiteClient = "System.Data.SQLite.SQLiteFactory";
|
||||
|
||||
public static IQuery CreateUpdateQuery(Mapping.ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
|
||||
public static IQuery CreateUpdateQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target, string whereClause)
|
||||
{
|
||||
Dialect dialect = CreateDialect(dataMapper);
|
||||
return new UpdateQuery(dialect, columns, dataMapper.Command, target, whereClause);
|
||||
}
|
||||
|
||||
public static IQuery CreateInsertQuery(Mapping.ColumnMapCollection columns, IDataMapper dataMapper, string target)
|
||||
public static IQuery CreateInsertQuery(ColumnMapCollection columns, IDataMapper dataMapper, string target)
|
||||
{
|
||||
Dialect dialect = CreateDialect(dataMapper);
|
||||
return new InsertQuery(dialect, columns, dataMapper.Command, target);
|
||||
}
|
||||
|
||||
public static IQuery CreateDeleteQuery(Dialects.Dialect dialect, Table targetTable, string whereClause)
|
||||
public static IQuery CreateDeleteQuery(Dialect dialect, Table targetTable, string whereClause)
|
||||
{
|
||||
return new DeleteQuery(dialect, targetTable, whereClause);
|
||||
}
|
||||
@@ -81,7 +82,7 @@ namespace Marr.Data.QGen
|
||||
}
|
||||
}
|
||||
|
||||
public static Dialects.Dialect CreateDialect(IDataMapper dataMapper)
|
||||
public static Dialect CreateDialect(IDataMapper dataMapper)
|
||||
{
|
||||
string providerString = dataMapper.ProviderFactory.ToString();
|
||||
switch (providerString)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Linq.Expressions;
|
||||
@@ -243,7 +244,7 @@ namespace Marr.Data.QGen
|
||||
|
||||
public virtual IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
var list = this.ToList();
|
||||
var list = ToList();
|
||||
return list.GetEnumerator();
|
||||
}
|
||||
|
||||
@@ -251,7 +252,7 @@ namespace Marr.Data.QGen
|
||||
|
||||
#region IEnumerable Members
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Marr.Data.QGen
|
||||
/// </summary>
|
||||
public Table FindTable(Type declaringType)
|
||||
{
|
||||
return this.EnumerateViewsAndTables().Where(t => t.EntityType == declaringType).FirstOrDefault();
|
||||
return EnumerateViewsAndTables().Where(t => t.EntityType == declaringType).FirstOrDefault();
|
||||
}
|
||||
|
||||
public Table this[int index]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Marr.Data.Mapping;
|
||||
using System.Linq.Expressions;
|
||||
using Marr.Data.QGen.Dialects;
|
||||
|
||||
namespace Marr.Data.QGen
|
||||
{
|
||||
@@ -16,7 +17,7 @@ namespace Marr.Data.QGen
|
||||
private bool _generateQuery = true;
|
||||
private TableCollection _tables;
|
||||
private Expression<Func<T, bool>> _filterExpression;
|
||||
private Dialects.Dialect _dialect;
|
||||
private Dialect _dialect;
|
||||
private ColumnMapCollection _columnsToUpdate;
|
||||
|
||||
public UpdateQueryBuilder()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Marr.Data.Mapping;
|
||||
|
||||
@@ -11,7 +12,7 @@ namespace Marr.Data.QGen
|
||||
{
|
||||
private string _viewName;
|
||||
private Table[] _tables;
|
||||
private Mapping.ColumnMapCollection _columns;
|
||||
private ColumnMapCollection _columns;
|
||||
|
||||
public View(string viewName, Table[] tables)
|
||||
: base(tables[0].EntityType, JoinType.None)
|
||||
@@ -58,7 +59,7 @@ namespace Marr.Data.QGen
|
||||
/// <summary>
|
||||
/// Gets all the columns from all the tables included in the view.
|
||||
/// </summary>
|
||||
public override Mapping.ColumnMapCollection Columns
|
||||
public override ColumnMapCollection Columns
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -81,9 +82,9 @@ namespace Marr.Data.QGen
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Marr.Data.QGen
|
||||
|
||||
protected override Expression VisitMethodCall(MethodCallExpression expression)
|
||||
{
|
||||
string method = (expression as System.Linq.Expressions.MethodCallExpression).Method.Name;
|
||||
string method = (expression as MethodCallExpression).Method.Name;
|
||||
switch (method)
|
||||
{
|
||||
case "Contains":
|
||||
@@ -270,7 +270,7 @@ namespace Marr.Data.QGen
|
||||
internal void Append(WhereBuilder<T> where, WhereAppendType appendType)
|
||||
{
|
||||
_constantWhereClause = string.Format("{0} {1} {2}",
|
||||
this.ToString(),
|
||||
ToString(),
|
||||
appendType.ToString(),
|
||||
where.ToString().Replace("WHERE ", string.Empty));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user