示例#1
0
        public override void AppendColumnNameForEntityFieldFilterConstraint(FilterConstraintAppendContext context,
                                                                            EntityFieldFilterConstraint constraint, SqlStatement statement, StringBuilder builder, EntityField field)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (constraint == null)
            {
                throw new ArgumentNullException("constraint");
            }
            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            // Add the name paramter for the extended field
            string nameField = AddNameParameter(field, statement);

            if (nameField == null)
            {
                throw new InvalidOperationException("'nameField' is null.");
            }
            if (nameField.Length == 0)
            {
                throw new InvalidOperationException("'nameField' is zero-length.");
            }

            // This could cause a problem, it assumes the first key field is the primary key and that there is only one
            builder.Append(statement.Dialect.FormatNativeName(context.Creator.EntityType.GetKeyFields()[0].NativeName));
            builder.Append(" IN (");
            builder.Append(statement.Dialect.SelectKeyword);
            builder.Append(" ");
            builder.Append(statement.Dialect.FormatNativeName(context.Creator.EntityType.GetKeyFields()[0].NativeName));
            builder.Append(" ");
            builder.Append(statement.Dialect.FromKeyword);
            builder.Append(" ");
            builder.Append(statement.Dialect.FormatNativeName(context.Creator.EntityType.NativeNameExtended));
            builder.Append(" ");
            builder.Append(statement.Dialect.WhereKeyword);
            builder.Append(" ");
            builder.Append(statement.Dialect.FormatNativeName(ExtendedPropertySettings.GetExtendedNativeNameForNameColumn()));
            builder.Append(" ");
            builder.Append(statement.Dialect.GetOperatorKeyword(SqlOperator.EqualTo, field.DBType));
            builder.Append(" ");
            builder.Append(statement.Dialect.FormatVariableNameForQueryText(nameField));
            builder.Append(" ");
            builder.Append(statement.Dialect.AndKeyword);
            builder.Append(" ");

            // do the bitwise...
            constraint.AppendBitwiseOperators(builder, statement);
            builder.Append(statement.Dialect.FormatNativeName(GetColumnNameForDbType(field.DBType)));
        }
示例#2
0
        public override void Append(FilterConstraintAppendContext context)
        {
            var builder = context.Sql;

            // build...
            builder.Append(context.Creator.Dialect.FormatColumnNameForSelect(this.Field, this.UseFullyQualifiedNames));
            builder.Append(" in (");
            var first = true;

            foreach (var value in this.Values)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    builder.Append(",");
                }

                builder.Append(context.Creator.Dialect.FormatVariableNameForQueryText(((SqlFilter)context.Creator).ExtraParameters.Add(Field.DBType, value)));
            }
            builder.Append(")");
        }
示例#3
0
 /// <summary>
 /// Appends the column name for a field constraint.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="statement"></param>
 /// <param name="builder"></param>
 /// <param name="field"></param>
 public virtual void AppendColumnNameForEntityFieldFilterConstraint(FilterConstraintAppendContext context,
                                                                    EntityFieldFilterConstraint constraint, SqlStatement statement, StringBuilder builder, EntityField field)
 {
     // defer...
     this.AddExtendedPropertyToSelectStatement(context.Creator, statement, builder, field);
 }
示例#4
0
 public override void Append(FilterConstraintAppendContext context)
 {
     context.Sql.Append("(");
     context.Sql.Append(this.Sql);
     context.Sql.Append(")");
 }