internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { if (state.UseFieldAlias) { return(factory.CreateDataFieldSql(_aggregateName)); } else { return(_fieldInfo.CreateSqlString(factory, isFullName, state)); } }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } var tableName = factory.CreateDataTableMappingSql(TableMapping, state); var selectField = _selectField.CreateSqlString(factory, true, state); var field = _field.CreateSqlString(factory, isFullName, state); string query = null; if (_expression != null) { query = _expression.CreateSqlString(factory, true, state); } sql = factory.CreateSubQuerySql(field, _predicate, selectField, tableName, query); state.SetDataSql(this, isFullName, sql); return(sql); }
public string CreateAliasDataFieldSql(CommandFactory factory, bool isFullName, CreateSqlState state) { string fieldSql = _fieldInfo.CreateSqlString(factory, isFullName, state); string sql = factory.CreateAliasFieldSql(fieldSql, FieldName); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } string tableName = factory.CreateDataTableMappingSql(TableMapping, state); string selectField = _selectField.CreateSqlString(factory, true, state); string field = _field.CreateSqlString(factory, isFullName, state); string query = null; if (_expression != null) { query = _expression.CreateSqlString(factory, true, state); } QueryCollectionPredicate op = _isTrue ? QueryCollectionPredicate.In : QueryCollectionPredicate.NotIn; sql = factory.CreateSubQuerySql(field, op, selectField, tableName, query); state.SetDataSql(this, isFullName, sql); return(sql); }
/// <summary> /// Creates the sql string. /// </summary> /// <returns>The sql string.</returns> /// <param name="factory">Factory.</param> /// <param name="isFullName">If set to <c>true</c> is full name.</param> /// <param name="state">State.</param> internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var leftFieldSql = leftField.CreateSqlString(factory, true, state); var rightFieldSql = rightField.CreateSqlString(factory, true, state); var sql = factory.CreateJoinOnMatchSql(leftFieldSql, predicate, rightFieldSql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } string field = _baseFieldInfo.CreateSqlString(factory, isFullName, state); switch (_part) { case DatePart.Year: sql = factory.CreateYearSql(field); break; case DatePart.Month: sql = factory.CreateMonthSql(field); break; case DatePart.Day: sql = factory.CreateDaySql(field); break; case DatePart.Hour: sql = factory.CreateHourSql(field); break; case DatePart.Minute: sql = factory.CreateMinuteSql(field); break; case DatePart.Second: sql = factory.CreateSecondSql(field); break; case DatePart.Week: sql = factory.CreateWeekSql(field); break; case DatePart.DayOfWeek: sql = factory.CreateWeekDaySql(field); break; case DatePart.DayOfYear: sql = factory.CreateYearDaySql(field); break; } state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } sql = _baseFieldInfo.CreateSqlString(factory, isFullName, state); sql = factory.CreateNotSql(sql); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } object obj = _baseFieldInfo.CreateSqlString(factory, isFullName, state); sql = factory.CreateNullQuerySql(obj, _isNull); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } var field = _baseFieldInfo.CreateSqlString(factory, isFullName, state); sql = factory.CreateDateTimeFormatSql(field, _format); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } var field = _baseFieldInfo.CreateSqlString(factory, isFullName, state); switch (_type) { case AggregateType.COUNT: sql = factory.CreateCountSql(field, _distinct); break; case AggregateType.SUM: sql = factory.CreateSumSql(field, _distinct); break; case AggregateType.AVG: sql = factory.CreateAvgSql(field, _distinct); break; case AggregateType.MAX: sql = factory.CreateMaxSql(field); break; case AggregateType.MIN: sql = factory.CreateMinSql(field); break; } state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var fieldSql = _fieldInfo.CreateSqlString(factory, isFullName, state); return(factory.CreateOrderBySql(fieldSql, _orderType)); }