/// <inheritdoc/>
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is SqlKeyNode) {
                var keyNode = (SqlKeyNode) node;
                if (String.Equals(keyNode.Text, "true", StringComparison.OrdinalIgnoreCase)) {
                    Value = SqlBoolean.True;
                } else if (String.Equals(keyNode.Text, "false", StringComparison.OrdinalIgnoreCase)) {
                    Value = SqlBoolean.False;
                } else if (String.Equals(keyNode.Text, "null", StringComparison.OrdinalIgnoreCase)) {
                    Value = SqlNull.Value;
                } else {
                    Value = new SqlString(((SqlKeyNode) node).Text.ToCharArray());
                }
            } else if (node is IntegerLiteralNode) {
                Value = new SqlNumber(((IntegerLiteralNode) node).BigValue);
            } else if (node is NumberLiteralNode) {
                Value = new SqlNumber(((NumberLiteralNode) node).BigValue);
            } else if (node is StringLiteralNode) {
                Value = new SqlString(((StringLiteralNode) node).Value.ToCharArray());
            }

            return base.OnChildNode(node);
        }
Пример #2
0
        public QueryParameter(string name, SqlType sqlType, Objects.ISqlObject value)
        {
            if (sqlType == null)
            {
                throw new ArgumentNullException("sqlType");
            }

            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (!String.Equals(name, Marker, StringComparison.Ordinal) &&
                name[0] != NamePrefix)
            {
                throw new ArgumentException(String.Format("The parameter name '{0}' is invalid: must be '{1}' or starting with '{2}'", name, Marker, NamePrefix));
            }

            Name      = name;
            SqlType   = sqlType;
            Value     = value;
            Direction = QueryParameterDirection.In;
        }
        /// <inheritdoc/>
        protected override ISqlNode OnChildNode(ISqlNode node)
        {
            if (node is SqlKeyNode)
            {
                var keyNode = (SqlKeyNode)node;
                if (String.Equals(keyNode.Text, "true", StringComparison.OrdinalIgnoreCase))
                {
                    Value = SqlBoolean.True;
                }
                else if (String.Equals(keyNode.Text, "false", StringComparison.OrdinalIgnoreCase))
                {
                    Value = SqlBoolean.False;
                }
                else if (String.Equals(keyNode.Text, "null", StringComparison.OrdinalIgnoreCase))
                {
                    Value = SqlNull.Value;
                }
                else
                {
                    Value = new SqlString(((SqlKeyNode)node).Text.ToCharArray());
                }
            }
            else if (node is IntegerLiteralNode)
            {
                Value = new SqlNumber(((IntegerLiteralNode)node).BigValue);
            }
            else if (node is NumberLiteralNode)
            {
                Value = new SqlNumber(((NumberLiteralNode)node).BigValue);
            }
            else if (node is StringLiteralNode)
            {
                Value = new SqlString(((StringLiteralNode)node).Value.ToCharArray());
            }

            return(base.OnChildNode(node));
        }
Пример #4
0
 public QueryParameter(SqlType sqlType, Objects.ISqlObject value)
     : this(Marker, sqlType, value)
 {
 }
Пример #5
0
        protected Field GetColumnValue(int column, Objects.ISqlObject obj)
        {
            var type = TableInfo[column].ColumnType;

            return(new Field(type, obj));
        }
Пример #6
0
        protected DataObject GetColumnValue(int column, Objects.ISqlObject obj)
        {
            var type = TableInfo[column].ColumnType;

            return(new DataObject(type, obj));
        }