Hello,
I'm trying to set the FetchSize
of a DbDataAdapter's OracleCommand object depending on the query's row size. Therefore I use following code (need to use some reflection here):
using (var reader = Adapter.SelectCommand.ExecuteReader(CommandBehavior.SchemaOnly))
{
var rowSizeProperty = reader.GetType().GetProperty("RowSize");
if (rowSizeProperty != null)
{
var wert = rowSizeProperty.GetValue(reader, null);
var fetchSizeProperty = reader.GetType().GetProperty("FetchSize");
if (fetchSizeProperty != null && Int64.TryParse(wert.ToString(), out long fetchSize))
fetchSizeProperty.SetValue(Adapter.SelectCommand, Math.Max(fetchSize, 10_000) * 1000);
}
}
ExecuteReader(CommandBehavior.SchemaOnly)
because I want to avoid the cost of actually executing the query. Unfortunately the OracleDataReader's RowSize
property remains empty in that case. Shouldn't schema information suffice the reader for determining the row size? Or put in other words: can one determine RowSize without fetching the data?