Ejemplo n.º 1
0
        private int ReportErrors([NotNull] ICollection <RowErrorInfo> errorRows)
        {
            Assert.ArgumentNotNull(errorRows);

            var oids        = new List <int>(errorRows.Count);
            var errorsByOid = new Dictionary <int, ErrorInfo>(errorRows.Count);

            foreach (RowErrorInfo errorRow in errorRows)
            {
                oids.Add(errorRow.RowUrl.Oid);
                errorsByOid.Add(errorRow.RowUrl.Oid, errorRow.ErrorInfo);
            }

            if (oids.Count == 0)
            {
                return(NoError);
            }

            var errorCount = 0;

            const bool recycling = false;

            foreach (IRow row in GdbQueryUtils.GetRowsByObjectIds(_table, oids, recycling))
            {
                errorCount += ReportError(errorsByOid[row.OID], row);
            }

            return(errorCount);
        }
Ejemplo n.º 2
0
        private static IEnumerable <IRow> TryGetRows(
            [NotNull] ITable table,
            [NotNull] ICollection <int> objectIDs)
        {
            if (objectIDs.Count == 0)
            {
                return(null);
            }

            const bool recycle = false;

            try
            {
                return(GdbQueryUtils.GetRowsByObjectIds(table, objectIDs, recycle));
            }
            catch (Exception e)
            {
                _msg.WarnFormat(
                    "Error getting involved rows for table {0}: {1} (see log for details)",
                    DatasetUtils.GetName(table),
                    e.Message);
                using (_msg.IncrementIndentation())
                {
                    _msg.DebugFormat("Object IDs of involved rows: {0}",
                                     StringUtils.Concatenate(objectIDs, ","));
                    LogTableDebugInfo(table);
                }

                _msg.WarnFormat("Trying again using alternative query method");

                // try again using different fetch method (where clause)
                try
                {
                    return(GdbQueryUtils.GetRowsInList(table, table.OIDFieldName,
                                                       objectIDs, recycle));
                }
                catch (Exception e2)
                {
                    _msg.WarnFormat("Error getting involved rows for table {0}: {1}",
                                    DatasetUtils.GetName(table),
                                    e2.Message);
                    using (_msg.IncrementIndentation())
                    {
                        _msg.WarnFormat("Object IDs of involved rows: {0}",
                                        StringUtils.Concatenate(objectIDs, ","));
                    }

                    return(null);
                }
            }
        }