Ejemplo n.º 1
0
        void InlineDbCommandCondition.AddToCommand(IDbCommand command, StringBuilder commandText, DatabaseInfo databaseInfo, string parameterName)
        {
            var parameter      = columnValue.GetParameter(name: parameterName);
            var operatorString = "<=";

            if (op == Operator.GreaterThan)
            {
                operatorString = ">";
            }
            if (op == Operator.GreaterThanOrEqualTo)
            {
                operatorString = ">=";
            }
            if (op == Operator.LessThan)
            {
                operatorString = "<";
            }

            commandText.Append(columnValue.ColumnName);
            commandText.Append(" ");
            commandText.Append(operatorString);
            commandText.Append(" ");
            commandText.Append(parameter.GetNameForCommandText(databaseInfo));

            command.Parameters.Add(parameter.GetAdoDotNetParameter(databaseInfo));
        }
        void InlineDbCommandCondition.AddToCommand(IDbCommand command, DatabaseInfo databaseInfo, string parameterName)
        {
            var    parameter = columnValue.GetParameter(name: parameterName);
            string operatorString;

            switch (op)
            {
            case Operator.NotEqualTo:
                operatorString = "!=";
                break;

            case Operator.LessThan:
                operatorString = "<";
                break;

            case Operator.GreaterThan:
                operatorString = ">";
                break;

            case Operator.LessThanOrEqualTo:
                operatorString = "<=";
                break;

            case Operator.GreaterThanOrEqualTo:
                operatorString = ">=";
                break;

            default:
                throw new ApplicationException("unknown operator");
            }

            command.CommandText += columnValue.ColumnName + " " + operatorString + " " + parameter.GetNameForCommandText(databaseInfo);
            command.Parameters.Add(parameter.GetAdoDotNetParameter(databaseInfo));
        }
Ejemplo n.º 3
0
        void InlineDbCommandCondition.AddToCommand(IDbCommand command, DatabaseInfo databaseInfo, string parameterName)
        {
            var parameter = columnValue.GetParameter(name: parameterName);

            if (parameter.ValueIsNull)
            {
                command.CommandText += columnValue.ColumnName + " IS NULL";
            }
            else
            {
                command.CommandText += columnValue.ColumnName + " = " + parameter.GetNameForCommandText(databaseInfo);
                command.Parameters.Add(parameter.GetAdoDotNetParameter(databaseInfo));
            }
        }