Пример #1
0
        private StringBuilder ToStringHelper(
            StringBuilder builder, string blockAlias, IEnumerable <Constant> constants, MemberPath outputMember, bool skipIsNotNull,
            bool userString)
        {
            var anyAdded = false;

            AsCql(
                // trueLiteral action
                () => builder.Append("true"),
                // varIsNotNull action
                () =>
            {
                if (userString)
                {
                    outputMember.ToCompactString(builder, blockAlias);
                    builder.Append(" is not NULL");
                }
                else
                {
                    outputMember.AsEsql(builder, blockAlias);
                    builder.Append(" IS NOT NULL");
                }
                anyAdded = true;
            },
                // varNotEqualsTo action
                (constant) =>
            {
                if (anyAdded)
                {
                    builder.Append(" AND ");
                }
                anyAdded = true;

                if (userString)
                {
                    outputMember.ToCompactString(builder, blockAlias);
                    builder.Append(" <>");
                    constant.ToCompactString(builder);
                }
                else
                {
                    outputMember.AsEsql(builder, blockAlias);
                    builder.Append(" <>");
                    constant.AsEsql(builder, outputMember, blockAlias);
                }
            },
                constants, outputMember, skipIsNotNull);
            return(builder);
        }
Пример #2
0
        private StringBuilder ToStringHelper(
            StringBuilder builder,
            string blockAlias,
            IEnumerable <Constant> constants,
            MemberPath outputMember,
            bool skipIsNotNull,
            bool userString)
        {
            bool anyAdded = false;

            this.AsCql((Action)(() => builder.Append("true")), (Action)(() =>
            {
                if (userString)
                {
                    outputMember.ToCompactString(builder, blockAlias);
                    builder.Append(" is not NULL");
                }
                else
                {
                    outputMember.AsEsql(builder, blockAlias);
                    builder.Append(" IS NOT NULL");
                }
                anyAdded = true;
            }), (Action <Constant>)(constant =>
            {
                if (anyAdded)
                {
                    builder.Append(" AND ");
                }
                anyAdded = true;
                if (userString)
                {
                    outputMember.ToCompactString(builder, blockAlias);
                    builder.Append(" <>");
                    constant.ToCompactString(builder);
                }
                else
                {
                    outputMember.AsEsql(builder, blockAlias);
                    builder.Append(" <>");
                    constant.AsEsql(builder, outputMember, blockAlias);
                }
            }), constants, outputMember, skipIsNotNull);
            return(builder);
        }
 internal override void ToCompactString(StringBuilder builder)
 {
     m_memberPath.ToCompactString(builder);
 }