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); }
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 StringBuilder AsEsql(StringBuilder builder, MemberPath outputMember, string blockAlias, int indentLevel) { TypeUsage outputMemberStoreTypeUsage; if (NeedToCastCqlValue(outputMember, out outputMemberStoreTypeUsage)) { builder.Append("CAST("); m_memberPath.AsEsql(builder, blockAlias); builder.Append(" AS "); CqlWriter.AppendEscapedTypeName(builder, outputMemberStoreTypeUsage.EdmType); builder.Append(')'); } else { m_memberPath.AsEsql(builder, blockAlias); } return(builder); }