public static IEnumerable <string> Interval
        (
            [NotNull] IIrbisConnection connection,
            [NotNull] string database,
            [NotNull] string format,
            int firstMfn,
            int lastMfn,
            int batchSize
        )
        {
            Sure.NotNull(connection, "connection");
            Sure.NotNullNorEmpty(database, "database");
            Sure.NotNullNorEmpty(format, "format");
            Sure.Positive(firstMfn, "firstMfn");
            Sure.Positive(lastMfn, "lastMfn");
            if (batchSize < 1)
            {
                Log.Error
                (
                    "BatchRecordFormatter::Interval: "
                    + "batchSize="
                    + batchSize
                );

                throw new ArgumentOutOfRangeException("batchSize");
            }

            int maxMfn = connection.GetMaxMfn(database) - 1;

            if (maxMfn == 0)
            {
                return(StringUtility.EmptyArray);
            }

            lastMfn = Math.Min(lastMfn, maxMfn);
            if (firstMfn > lastMfn)
            {
                return(StringUtility.EmptyArray);
            }

            BatchRecordFormatter result = new BatchRecordFormatter
                                          (
                connection,
                database,
                format,
                batchSize,
                Enumerable.Range(firstMfn, lastMfn - firstMfn + 1)
                                          );

            return(result);
        }
        public static IEnumerable <string> Search
        (
            [NotNull] IIrbisConnection connection,
            [NotNull] string database,
            [NotNull] string format,
            [NotNull] string searchExpression,
            int batchSize
        )
        {
            Sure.NotNull(connection, "connection");
            Sure.NotNullNorEmpty(database, "database");
            Sure.NotNullNorEmpty(format, "format");
            Sure.NotNullNorEmpty(searchExpression, "searchExpression");
            if (batchSize < 1)
            {
                Log.Error
                (
                    "BatchRecordFormatter::Search: "
                    + "batchSize="
                    + batchSize
                );

                throw new ArgumentOutOfRangeException("batchSize");
            }

            int[] found = connection.Search(searchExpression);
            if (found.Length == 0)
            {
                return(new string[0]);
            }

            BatchRecordFormatter result = new BatchRecordFormatter
                                          (
                connection,
                database,
                format,
                batchSize,
                found
                                          );

            return(result);
        }
        public static IEnumerable <string> WholeDatabase
        (
            [NotNull] IIrbisConnection connection,
            [NotNull] string database,
            [NotNull] string format,
            int batchSize
        )
        {
            Sure.NotNull(connection, "connection");
            Sure.NotNullNorEmpty(database, "database");
            Sure.NotNullNorEmpty(format, "format");
            if (batchSize < 1)
            {
                Log.Error
                (
                    "BatchRecordFormatter::WholeDatabase: "
                    + "batchSize="
                    + batchSize
                );

                throw new ArgumentOutOfRangeException("batchSize");
            }

            int maxMfn = connection.GetMaxMfn(database) - 1;

            if (maxMfn == 0)
            {
                return(new string[0]);
            }

            BatchRecordFormatter result = new BatchRecordFormatter
                                          (
                connection,
                database,
                format,
                batchSize,
                Enumerable.Range(1, maxMfn)
                                          );

            return(result);
        }