public object[] GetRowData(int position, IList <ColumnExpression> selectColumns) { object[] rowData; bool all = selectColumns.FirstOrDefault(c => c.ColumnName == "*") != null; if (all) { IRange row = this._dataRange.Rows[position]; List <ColumnInfo> columns = this._dataColumns; int columnCount = columns.Count; rowData = new object[columnCount]; for (int i = 0; i < columnCount; i++) { rowData[i] = GetCellValue(row.Cells[columns[i].Column - row.Column], columns[i].DataType, row.Worksheet.SheetView.DisplayZeros); } } else { ExcelEvalVisitor evaluator = this._evaluator; int columCount = selectColumns.Count; rowData = new object[columCount]; for (int i = 0; i < columCount; i++) { rowData[i] = evaluator.Evaluate(selectColumns[i]); } } return(rowData); }
public void Close() { this.Reset(); this._selectStatement = null; this._command = null; this._evaluator = null; }
public RangeData(IRange dataRange, List <ColumnInfo> dataColumns, ExcelEvalVisitor evaluator) { this._dataRange = dataRange; this._dataColumns = dataColumns; this._evaluator = evaluator; this.Init(); }
public ExcelResultSet(ISQLStatement sqlStatement, ExcelCommand command) { if (sqlStatement.Type != StatementType.Select) { throw new NotSupportedException(sqlStatement.ToString()); } SelectStatement selectStatement = (SelectStatement)sqlStatement; if (!command.Connection.HasTable(selectStatement.Table.Name)) { throw new ExcelException("Cannot find table " + selectStatement.Table.Name); } this.Reset(); this._selectStatement = selectStatement; this._command = command; this._evaluator = new ExcelEvalVisitor(new ExcelEvalContext(this)); }