protected QueryResultPart GetResultPart(int resultId, int startRow, int countRows) { AssertNotDisposed(); var table = GetResult(resultId); if (table == null) { throw new InvalidOperationException(); } int rowEnd = startRow + countRows; if (startRow < 0 || startRow >= table.RowCount || rowEnd > table.RowCount) { throw new InvalidOperationException("Result part out of range."); } try { int colCount = table.ColumnCount; var block = new QueryResultPart(colCount); for (int r = startRow; r < rowEnd; ++r) { var row = new ISqlObject[colCount]; var sizes = new int[colCount]; for (int c = 0; c < colCount; ++c) { var value = table.GetValue(r, c); ISqlObject clientOb = null; if (value.Value is IObjectRef) { var reference = (IObjectRef)value.Value; clientOb = new RemoteObjectRef(reference.ObjectId, reference.Size); } else { clientOb = value.Value; } row[c] = clientOb; sizes[c] = value.Size; } block.AddRow(new QueryResultRow(row, sizes)); } return(block); } catch (Exception) { // TODO: Log a warning ... throw; } }
protected QueryResultPart GetResultPart(int resultId, int startRow, int countRows) { AssertNotDisposed(); var table = GetResult(resultId); if (table == null) throw new InvalidOperationException(); int rowEnd = startRow + countRows; if (startRow < 0 || startRow >= table.RowCount || rowEnd > table.RowCount) { throw new InvalidOperationException("Result part out of range."); } try { int colCount = table.ColumnCount; var block = new QueryResultPart(colCount); for (int r = startRow; r < rowEnd; ++r) { var row = new ISqlObject[colCount]; var sizes = new int[colCount]; for (int c = 0; c < colCount; ++c) { var value = table.GetValue(r, c); ISqlObject clientOb = null; if (value.Value is IObjectRef) { var reference = (IObjectRef)value.Value; clientOb = new RemoteObjectRef(reference.ObjectId, reference.Size); } else { clientOb = value.Value; } row[c] = clientOb; sizes[c] = value.Size; } block.AddRow(new QueryResultRow(row, sizes)); } return block; } catch (Exception) { // TODO: Log a warning ... throw; } }