Esempio n. 1
0
        private void AddFullTextSearchClause(MatchCondition matchCondition, AdoQueryPayload queryPayload)
        {
            switch (matchCondition.Operator)
            {
                case LqlOperator.Like:
                    queryPayload.Append("CONTAINS(");
                    
                    break;
                case LqlOperator.NotLike:
                    queryPayload.Append("NOT CONTAINS(");
                    break;
                default:
                    throw new SqlGenerationException("LQL Operator not supported for Full Text Search: " + matchCondition.Operator);
            }

            queryPayload.Append(GetColumnName(matchCondition.Object));
            queryPayload.Append(", ");
            queryPayload.AddParameter(matchCondition, true);
            queryPayload.AppendLine(")");
        }
Esempio n. 2
0
        private void AddClause(MatchCondition matchCondition, AdoQueryPayload queryPayload)
        {
            queryPayload.Append(GetColumnName(matchCondition.Object));
            
            switch (matchCondition.Operator)
            {
                case LqlOperator.Equals:
                    queryPayload.Append(" = ");
                    queryPayload.AddParameter(matchCondition, false);
                    break;
                case LqlOperator.NotEquals:
                    queryPayload.Append(" <> ");
                    queryPayload.AddParameter(matchCondition, false);
                    break;
                case LqlOperator.Like:
                    queryPayload.Append(" LIKE '%' + ");
                    queryPayload.AddParameter(matchCondition, false);
                    queryPayload.Append(" + '%'");
                    break;
                case LqlOperator.NotLike:
                    queryPayload.Append(" NOT LIKE '%' + ");
                    queryPayload.AddParameter(matchCondition, false);
                    queryPayload.Append(" + '%'");
                    break;
                case LqlOperator.In:
                    queryPayload.Append(" IN (");
                    queryPayload.AddParameter(matchCondition, false);
                    queryPayload.Append(")");
                    break;
                case LqlOperator.NotIn:
                    queryPayload.Append(" NOT IN (");
                    queryPayload.AddParameter(matchCondition, false);
                    queryPayload.Append(")");
                    break;
                default:
                    throw new SqlGenerationException("LQL Operator not supported for SQL query generation: " + matchCondition.Operator);
            }

            queryPayload.AddNewLine();
        }