Beispiel #1
0
        private int FillLoadDataRow(SchemaMapping mapping)
        {
            int rowsAddedToDataSet         = 0;
            DataReaderContainer dataReader = mapping.DataReader;

            if (_hasFillErrorHandler)
            {
                while (dataReader.Read())
                { // read remaining rows of first and subsequent resultsets
                    try
                    {
                        // only try-catch if a FillErrorEventHandler is registered so that
                        // in the default case we get the full callstack from users
                        mapping.LoadDataRowWithClear();
                        rowsAddedToDataSet++;
                    }
                    catch (Exception e) when(ADP.IsCatchableExceptionType(e))
                    {
                        ADP.TraceExceptionForCapture(e);
                        OnFillErrorHandler(e, mapping.DataTable, mapping.DataValues);
                    }
                }
            }
            else
            {
                while (dataReader.Read())
                {
                    // read remaining rows of first and subsequent resultset
                    mapping.LoadDataRow();
                    rowsAddedToDataSet++;
                }
            }
            return(rowsAddedToDataSet);
        }
Beispiel #2
0
        private int FillLoadDataRow(SchemaMapping mapping)
        {
            int num = 0;
            DataReaderContainer dataReader = mapping.DataReader;

            if (!this._hasFillErrorHandler)
            {
                while (dataReader.Read())
                {
                    mapping.LoadDataRow();
                    num++;
                }
                return(num);
            }
            while (dataReader.Read())
            {
                try
                {
                    mapping.LoadDataRowWithClear();
                    num++;
                    continue;
                }
                catch (Exception exception)
                {
                    if (!ADP.IsCatchableExceptionType(exception))
                    {
                        throw;
                    }
                    ADP.TraceExceptionForCapture(exception);
                    this.OnFillErrorHandler(exception, mapping.DataTable, mapping.DataValues);
                    continue;
                }
            }
            return(num);
        }
Beispiel #3
0
        private int FillLoadDataRowChunk(SchemaMapping mapping, int startRecord, int maxRecords)
        {
            DataReaderContainer dataReader = mapping.DataReader;

            while (0 < startRecord)
            {
                if (!dataReader.Read())
                {
                    // there are no more rows on first resultset
                    return(0);
                }
                --startRecord;
            }

            int rowsAddedToDataSet = 0;

            if (0 < maxRecords)
            {
                while ((rowsAddedToDataSet < maxRecords) && dataReader.Read())
                {
                    if (_hasFillErrorHandler)
                    {
                        try {
                            mapping.LoadDataRowWithClear();
                            rowsAddedToDataSet++;
                        }
                        catch (Exception e) {
                            //
                            if (!ADP.IsCatchableExceptionType(e))
                            {
                                throw;
                            }
                            ADP.TraceExceptionForCapture(e);
                            OnFillErrorHandler(e, mapping.DataTable, mapping.DataValues);
                        }
                    }
                    else
                    {
                        mapping.LoadDataRow();
                        rowsAddedToDataSet++;
                    }
                }
                // skip remaining rows of the first resultset
            }
            else
            {
                rowsAddedToDataSet = FillLoadDataRow(mapping);
            }
            return(rowsAddedToDataSet);
        }
Beispiel #4
0
        private int FillLoadDataRowChunk(SchemaMapping mapping, int startRecord, int maxRecords)
        {
            DataReaderContainer dataReader = mapping.DataReader;

            while (0 < startRecord)
            {
                if (!dataReader.Read())
                {
                    return(0);
                }
                startRecord--;
            }
            int num = 0;

            if (0 >= maxRecords)
            {
                return(this.FillLoadDataRow(mapping));
            }
            while ((num < maxRecords) && dataReader.Read())
            {
                if (this._hasFillErrorHandler)
                {
                    try
                    {
                        mapping.LoadDataRowWithClear();
                        num++;
                    }
                    catch (Exception exception)
                    {
                        if (!ADP.IsCatchableExceptionType(exception))
                        {
                            throw;
                        }
                        ADP.TraceExceptionForCapture(exception);
                        this.OnFillErrorHandler(exception, mapping.DataTable, mapping.DataValues);
                    }
                }
                else
                {
                    mapping.LoadDataRow();
                    num++;
                }
            }
            return(num);
        }