public void SetLoopStatement(StatementQuery cursorStatement) { this.LoopCursor = cursorStatement; QNameManager.QName[] resultColumnNames = cursorStatement.queryExpression.GetResultColumnNames(); SqlType[] columnTypes = cursorStatement.queryExpression.GetColumnTypes(); ColumnSchema[] declarations = new ColumnSchema[resultColumnNames.Length]; for (int i = 0; i < resultColumnNames.Length; i++) { declarations[i] = new ColumnSchema(resultColumnNames[i], columnTypes[i], false, false, null); declarations[i].SetParameterMode(1); } this.SetLocalDeclarations(declarations); }
public void SetLocalDeclarations(object[] declarations) { int num = 0; int num2 = 0; int num3 = 0; for (int i = 0; i < declarations.Length; i++) { if (((declarations[i] is ColumnSchema) || (declarations[i] is StatementQuery)) || (declarations[i] is Condition)) { num++; } else if (declarations[i] is Table) { num3++; } else { num2++; } } this.Variables = new ColumnSchema[num]; this.Handlers = new StatementHandler[num2]; if (num3 > 0) { this.Tables = new Table[num3]; } num = 0; num2 = 0; num3 = 0; for (int j = 0; j < declarations.Length; j++) { if (declarations[j] is ColumnSchema) { this.Variables[num++] = (ColumnSchema)declarations[j]; } else if (declarations[j] is StatementQuery) { StatementQuery queryStatement = (StatementQuery)declarations[j]; Cursor o = new Cursor(queryStatement); this.Variables[num++] = new ColumnSchema(queryStatement.CursorName, SqlType.SqlAllTypes, false, false, new ExpressionValue(o, SqlType.SqlAllTypes)); } else if (declarations[j] is Condition) { Condition o = (Condition)declarations[j]; this.Variables[num++] = new ColumnSchema(o.Name, SqlType.SqlAllTypes, false, false, new ExpressionValue(o, SqlType.SqlAllTypes)); } else if (declarations[j] is Table) { Table table = (Table)declarations[j]; this.Tables[num3++] = table; } else { StatementHandler handler = (StatementHandler)declarations[j]; handler.SetParent(this); this.Handlers[num2++] = handler; if (handler.HandlerType == 7) { this.HasUndoHandler = true; } } } this.SetVariables(); this.SetHandlers(); this.SetTables(); }