예제 #1
0
        private void _FetchRemaining
        (
            ServerResponse mainResponse,
            int expected
        )
        {
            if (ReferenceEquals(Found, null))
            {
                return;
            }

            if (!_subCommand && expected > IrbisConstants.MaxPostings)
            {
                int firstRecord = FirstRecord + Found.Count;

                while (firstRecord < expected)
                {
                    SearchCommand subCommand = Clone();
                    subCommand.FirstRecord     = firstRecord;
                    subCommand.NumberOfRecords =
                        Math.Min
                        (
                            expected - firstRecord + 1,
                            IrbisConstants.MaxPostings
                        );
                    subCommand._subCommand = true;

                    ClientQuery    clientQuery = subCommand.CreateQuery();
                    ServerResponse subResponse = subCommand
                                                 .Execute(clientQuery);
                    subCommand.CheckResponse(subResponse);

                    List <FoundItem> found = subCommand.Found
                                             .ThrowIfNull("Found");
                    int count = found.Count;
                    Found.ThrowIfNull().AddRange(found);

                    Debug.Assert
                    (
                        count != 0,
                        "Found.Count == 0 in SubCommand"
                    );

                    firstRecord += count;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Clone the command.
        /// </summary>
        public SearchCommand Clone()
        {
            SearchCommand result = new SearchCommand
                                   (
                Connection
                                   )
            {
                Database            = Database,
                FirstRecord         = FirstRecord,
                FormatSpecification = FormatSpecification,
                MaxMfn                  = MaxMfn,
                MinMfn                  = MinMfn,
                NumberOfRecords         = NumberOfRecords,
                SearchExpression        = SearchExpression,
                SequentialSpecification = SequentialSpecification,
                UtfFormat               = UtfFormat
            };

            return(result);
        }