当前位置: 首页>>代码示例>>C#>>正文


C# ExecutionContext.SetResult方法代码示例

本文整理汇总了C#中ExecutionContext.SetResult方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutionContext.SetResult方法的具体用法?C# ExecutionContext.SetResult怎么用?C# ExecutionContext.SetResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExecutionContext的用法示例。


在下文中一共展示了ExecutionContext.SetResult方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteStatement

        protected override void ExecuteStatement(ExecutionContext context)
        {
            if (!context.Request.Context.CursorExists(CursorName))
                throw new StatementException(String.Format("The cursor '{0}' was not found in the current context.", CursorName));

            var cursor = context.Request.Context.FindCursor(CursorName);

            if (cursor == null)
                throw new StatementException(String.Format("The cursor '{0}' was not found in the current context.", CursorName));
            if (cursor.Status == CursorStatus.Closed)
                throw new StatementException(String.Format("The cursor '{0}' was already closed.", CursorName));

            int offset = -1;
            if (OffsetExpression != null)
                offset = OffsetExpression.EvaluateToConstant(context.Request, null);

            var row = cursor.Fetch(Direction, offset);

            if (row != null) {
                var result = new VirtualTable(row.Table, new List<int> {row.RowId.RowNumber});
                context.SetResult(result);
            }
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:23,代码来源:FetchStatement.cs

示例2: ExecuteStatement

            protected override void ExecuteStatement(ExecutionContext context)
            {
                var insertTable = context.Request.Query.GetMutableTable(TableName);

                if (insertTable == null)
                    throw new ObjectNotFoundException(TableName);

                var insertCount = 0;

                // Insert rows from the result select table.
                var result = QueryPlan.Evaluate(context.Request);
                if (result.ColumnCount() != ColumnIndices.Length) {
                    throw new InvalidOperationException("Number of columns in result does not match columns to insert.");
                }

                foreach (var insertRow in result) {
                    var newRow = insertTable.NewRow();

                    for (int n = 0; n < ColumnIndices.Length; ++n) {
                        var cell = insertRow.GetValue(n);
                        newRow.SetValue(ColumnIndices[n], cell);
                    }

                    newRow.SetDefault(context.Request.Query);

                    insertTable.AddRow(newRow);
                    ++insertCount;

                }

                context.SetResult(insertCount);
            }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:32,代码来源:InsertSelectStatement.cs

示例3: ExecuteStatement

        protected override void ExecuteStatement(ExecutionContext context)
        {
            string varName;
            if (VariableReference is SqlVariableReferenceExpression) {
                varName = ((SqlVariableReferenceExpression) VariableReference).VariableName;
            } else if (VariableReference is SqlReferenceExpression) {
                varName = ((SqlReferenceExpression) VariableReference).ReferenceName.Name;
            } else {
                throw new StatementException("The type of variable reference is invalid.");
            }

            var variable = context.Request.Context.FindVariable(varName);

            if (variable == null) {
                var varType = ValueExpression.ReturnType(context.Request, null);
                variable = context.Request.Context.DeclareVariable(varName, varType);
            }

            variable.SetValue(ValueExpression);

            context.SetResult(variable.Evaluate(context.Request));
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:22,代码来源:AssignVariableStatement.cs

示例4: ExecuteStatement

        protected override void ExecuteStatement(ExecutionContext context)
        {
            var args = Arguments != null ? Arguments.ToArray() : new InvokeArgument[0];
            var invoke = new Invoke(ProcedureName, args);

            var procedure = context.DirectAccess.ResolveProcedure(invoke);
            if (procedure == null)
                throw new StatementException(String.Format("Could not retrieve the procedure '{0}': maybe not a procedure.", ProcedureName));

            //if (!context.User.CanExecuteProcedure(invoke,context.Request))
            //	throw new MissingPrivilegesException(context.User.Name, ProcedureName, Privileges.Execute);

            var result = procedure.Execute(Arguments, context.Request);

            if (result.HasOutputParameters) {
                var output = result.OutputParameters;
                var names = output.Keys.ToArray();
                var values = output.Values.Select(SqlExpression.Constant).Cast<SqlExpression>().ToArray();
                var resultTable = new FunctionTable(values, names, context.Request);
                context.SetResult(resultTable);
            }
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:22,代码来源:CallStatement.cs

示例5: ExecuteStatement

            protected override void ExecuteStatement(ExecutionContext context)
            {
                //var columnNames = Columns.Select(x => x.ReferenceExpression)
                //	.Cast<SqlReferenceExpression>()
                //	.Select(x => x.ReferenceName.Name).ToArray();

                //if (!context.User.CanUpdateTable(TableName))
                //	throw new MissingPrivilegesException(context.User.Name, TableName, Privileges.Update);

                //if (!context.User.CanSelectFrom(QueryPlan))
                //	throw new InvalidOperationException();

                var table = context.DirectAccess.GetMutableTable(TableName);
                if (table == null)
                    throw new ObjectNotFoundException(TableName);

                var updateSet = QueryPlan.Evaluate(context.Request);
                var updateCount = table.Update(context.Request, updateSet, Columns, Limit);

                context.SetResult(updateCount);
            }
开发者ID:deveel,项目名称:deveeldb,代码行数:21,代码来源:UpdateStatement.cs

示例6: ExecuteStatement

            protected override void ExecuteStatement(ExecutionContext context)
            {
                //if (!context.User.CanSelectFrom(QueryPlan))
                //	throw new SecurityException();

                var cursor = new NativeCursor(new NativeCursorInfo(QueryPlan), context.Request);

                var table = context.Request.Access().GetMutableTable(TableName);
                if (table == null)
                    throw new StatementException(String.Format("Referenced table of the INTO statement '{0}' was not found or is not mutable.", TableName));

                int count;

                try {
                    context.Query.Session.Enter(table, AccessType.Write);

                    count = InsertIntoTable(table, cursor);
                } finally {
                    context.Query.Session.Exit(table, AccessType.Write);
                }

                context.SetResult(count);
            }
开发者ID:deveel,项目名称:deveeldb,代码行数:23,代码来源:SelectIntoStatement.cs

示例7: ExecuteStatement

            protected override void ExecuteStatement(ExecutionContext context)
            {
                var deleteTable = context.Request.Access().GetMutableTable(TableName);

                if (deleteTable == null)
                    throw new ObjectNotFoundException(TableName);

                //if (!context.User.CanSelectFrom(QueryPlan))
                //	throw new MissingPrivilegesException(context.User.Name, TableName, Privileges.Select);
                //if (!context.User.CanDeleteFromTable(TableName))
                //	throw new MissingPrivilegesException(context.User.Name, TableName, Privileges.Delete);

                var result = QueryPlan.Evaluate(context.Request);
                var count = deleteTable.Delete(result);

                context.SetResult(count);
            }
开发者ID:deveel,项目名称:deveeldb,代码行数:17,代码来源:DeleteStatement.cs

示例8: ExecuteStatement

            protected override void ExecuteStatement(ExecutionContext context)
            {
                int insertCount = 0;

                //if (!context.User.CanInsertIntoTable(TableName))
                //	throw new MissingPrivilegesException(context.User.Name, TableName, Privileges.Insert);

                var table = context.DirectAccess.GetMutableTable(TableName);
                if (table == null)
                    throw new ObjectNotFoundException(TableName);

                foreach (var assignment in Assignments) {
                    var columnNames =
                        assignment.Select(x => x.ReferenceExpression)
                            .Cast<SqlReferenceExpression>()
                            .Select(x => x.ReferenceName.Name).ToArray();

                    var row = table.NewRow();

                    foreach (var expression in assignment) {
                        row.EvaluateAssignment(expression, context.Request);
                    }

                    row.SetDefault(context.Request);

                    table.AddRow(row);
                    insertCount++;
                }

                context.SetResult(insertCount);
            }
开发者ID:deveel,项目名称:deveeldb,代码行数:31,代码来源:InsertStatement.cs

示例9: ExecuteStatement

            protected override void ExecuteStatement(ExecutionContext context)
            {
                int insertCount = 0;

                foreach (var assignment in Assignments) {
                    context.Request.Query.InsertIntoTable(TableName, assignment);
                    insertCount++;
                }

                context.SetResult(insertCount);
            }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:11,代码来源:InsertStatement.cs

示例10: ExecuteStatement

 protected override void ExecuteStatement(ExecutionContext context)
 {
     var result = QueryPlan.Evaluate(context.Request);
     context.SetResult(result);
 }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:5,代码来源:SelectStatement.cs

示例11: ExecuteStatement

 protected override void ExecuteStatement(ExecutionContext context)
 {
     var updateCount = context.Request.Query.UpdateTable(TableName, QueryPlan, Columns, Limit);
     context.SetResult(updateCount);
 }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:5,代码来源:UpdateStatement.cs


注:本文中的ExecutionContext.SetResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。