示例#1
0
        protected override void BuildStatement(SqlCodeObjectBuilder builder)
        {
            var parameters = new List <CursorParameter>();

            if (Parameters != null)
            {
                foreach (var parameterNode in Parameters)
                {
                    var dataType = builder.BuildDataType(parameterNode.ParameterType);
                    parameters.Add(new CursorParameter(parameterNode.ParameterName, dataType));
                }
            }

            var flags = new CursorFlags();

            if (Insensitive)
            {
                flags |= CursorFlags.Insensitive;
            }
            if (Scroll)
            {
                flags |= CursorFlags.Scroll;
            }

            var queryExpression = (SqlQueryExpression)ExpressionBuilder.Build(QueryExpression);

            builder.AddObject(new DeclareCursorStatement(CursorName, parameters.ToArray(), flags, queryExpression));
        }
        protected override void BuildStatement(SqlCodeObjectBuilder builder)
        {
            var parameters = new List<CursorParameter>();
            if (Parameters != null) {
                foreach (var parameterNode in Parameters) {
                    var dataType = builder.BuildDataType(parameterNode.ParameterType);
                    parameters.Add(new CursorParameter(parameterNode.ParameterName, dataType));
                }
            }

            var flags = new CursorFlags();
            if (Insensitive)
                flags |= CursorFlags.Insensitive;
            if (Scroll)
                flags |= CursorFlags.Scroll;

            var queryExpression = (SqlQueryExpression) ExpressionBuilder.Build(QueryExpression);

            builder.AddObject(new DeclareCursorStatement(CursorName, parameters.ToArray(), flags, queryExpression));
        }