Deveel.Data.Sql.Statements.CursorForLoopStatement.BeforeLoop C# (CSharp) Method

BeforeLoop() protected method

protected BeforeLoop ( ExecutionContext context ) : void
context ExecutionContext
return void
        protected override void BeforeLoop(ExecutionContext context)
        {
            var cursor = context.Request.Context.FindCursor(CursorName);
            if (cursor == null)
                throw new StatementException(String.Format("Cursor '{0}' was not defined in this scope.", CursorName));
            if (cursor.Status != CursorStatus.Open)
                throw new StatementException(String.Format("The cursor '{0}' is in an invalid status ({1}).", CursorName,
                    cursor.Status.ToString().ToUpperInvariant()));

            context.Request.Context.DeclareVariable(IndexName, PrimitiveTypes.BigInt());
            context.Request.Context.SetVariable(IndexName, SqlExpression.Constant(Field.BigInt(0)));

            base.BeforeLoop(context);
        }