/// <summary> /// Closes the current resultset, dumping any data still on the wire /// </summary> public void Close() { if (!readDone) { // if we have rows but the user didn't read the first one then mark it as skipped if (HasRows && rowIndex == -1) { skippedRows++; } try { while (driver.IsOpen && driver.SkipDataRow()) { totalRows++; skippedRows++; } } catch (System.IO.IOException) { // it is ok to eat IO exceptions here, we just want to // close the result set } readDone = true; } else if (driver == null) { CacheClose(); } driver = null; if (Cached) { CacheReset(); } }
private void ClearCurrentResultset() { if (!canRead) { return; } while (driver.SkipDataRow()) { } if (!connection.Settings.UseUsageAdvisor) { return; } // we were asked to run the usage advisor so report if the resultset // was not entirely read. if (canRead) { connection.UsageAdvisor.ReadPartialResultSet(command.CommandText); } bool readAll = true; foreach (bool b in uaFieldsUsed) { readAll &= b; } if (!readAll) { connection.UsageAdvisor.ReadPartialRowSet(command.CommandText, uaFieldsUsed, fields); } }