protected CachingDataReader(DataReaderConfig config)
{
_config = config;
_indexesByName = config.IndexesByName;
// It is possible to be skipping columns, so figure out the highest
// column index and we'll assume there are that many columns. It's easier
// that way than mapping column 5 to 3 when reading just because we skipped a couple.
int maxColNum = 0;
foreach (int index in _indexesByName.Values)
{
if (index > maxColNum)
{
maxColNum = index;
}
}
_numCols = maxColNum + 1;
// This will have nulls for skipped columns.
_namesByIndex = new string[_numCols];
foreach (KeyValuePair<string, int> indexByName in _indexesByName)
{
_namesByIndex[indexByName.Value] = indexByName.Key;
}
_valsByIndex = new object[_numCols];
}