Beispiel #1
0
        /// <summary>
        /// Create a new condition phrase.
        /// </summary>
        /// <param name="expr">SQL Expression.</param>
        /// <param name="conditionOperator">Condition operator.</param>
        /// <param name="value">Value.</param>
        /// <param name="paramName">Parameter name.</param>
        public APSqlConditionPhrase(APSqlOperateExpr expr, APSqlConditionOperator conditionOperator, object value, string paramName)
        {
            if (Object.Equals(expr, null))
            {
                throw new ArgumentNullException("columnDef");
            }
            if (conditionOperator == APSqlConditionOperator.Exists || conditionOperator == APSqlConditionOperator.NotExists)
            {
                throw new ArgumentException(APResource.APDB_OperatorExists, "conditionOperator");
            }

            _expr      = expr;
            _paramName = paramName;
            if (String.IsNullOrEmpty(paramName))
            {
                _paramName = expr.ParamName;
            }

            if (value is String)
            {
                value = APSqlExpr.TryFitStringToRawExpr((string)value);
            }

            _value             = value;
            _conditionOperator = conditionOperator;
        }
Beispiel #2
0
        /// <summary>
        /// Create a new 'SET' phrase.
        /// </summary>
        /// <param name="assignmentExpr">SQL assignment Expression.</param>
        /// <param name="value">Value.</param>
        /// <param name="paramName">Parameter name.</param>
        public APSqlSetPhrase(APSqlColumnExpr assignmentExpr, object value, string paramName)
        {
            if (Object.Equals(assignmentExpr, null))
            {
                throw new ArgumentNullException("assignmentExpr");
            }

            if (value is String)
            {
                value = APSqlExpr.TryFitStringToRawExpr((string)value);
            }

            _assignmentExpr = assignmentExpr;
            _paramName      = String.IsNullOrEmpty(paramName) ? assignmentExpr.ParamName : paramName;
            _value          = value;
        }