private ProcedureExpressionStatement CreateParameterTestStatement(ProcedureStatement parent, Parameter parameter, FilterFunctions op)
        {
            ProcedureExpressionStatement result = null;
            TableRefColumn refColumn = new TableRefColumn(parameter.Column);
            switch (op)
            {
                case FilterFunctions.Equals:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.Equals, refColumn, parameter);
                    break;

                case FilterFunctions.NotEquals:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.NotEquals, refColumn, parameter);
                    break;

                case FilterFunctions.IsLessThan:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.IsLesserThan, refColumn, parameter);
                    break;

                case FilterFunctions.IsLessThanOrEqualTo:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.IsLesserThanOrEqualTo, refColumn, parameter);
                    break;

                case FilterFunctions.IsGreaterThan:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.IsGreaterThan, refColumn, parameter);
                    break;

                case FilterFunctions.IsGreaterThanOrEqualTo:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.IsGreaterThanOrEqualTo, refColumn, parameter);
                    break;

                case FilterFunctions.FullTextContains:
                case FilterFunctions.NotFullTextContains:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.Contains, refColumn, parameter);
                    break;

                case FilterFunctions.FreeText:
                case FilterFunctions.NotFreeText:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.FreeText, refColumn, parameter);
                    break;

                case FilterFunctions.StartsWith:
                    result = new ProcedureExpressionStatement(
                                      parent,
                                      ProcedureOperationType.Like,
                                      new ProcedureExpressionStatement(parent, refColumn),
                                      CreateConcatStatement(parent, parameter, "%"));
                    break;

                case FilterFunctions.EndsWith:
                    result = new ProcedureExpressionStatement(
                                      parent,
                                      ProcedureOperationType.Like,
                                      new ProcedureExpressionStatement(parent, refColumn),
                                      CreateConcatStatement(parent, "%", parameter));
                    break;

                case FilterFunctions.Contains:
                case FilterFunctions.NotContains:
                    result = new ProcedureExpressionStatement(
                                      parent,
                                      ProcedureOperationType.Like,
                                      new ProcedureExpressionStatement(parent, refColumn),
                                      CreateConcatStatement(parent, "%", parameter, "%"));
                    break;

            }

            // Negate statement if needed
            switch (op)
            {
                case FilterFunctions.NotContains:
                case FilterFunctions.NotFullTextContains:
                case FilterFunctions.NotFreeText:
                    result = new ProcedureExpressionStatement(parent, ProcedureOperationType.Not, result, null);
                    break;
            }

            return result;
        }
 private static bool MustEncrypt(TableRefColumn refColumn)
 {
     return refColumn != null && MustEncrypt(refColumn.Column);
 }