From: Allen, R. <ra...@ci...> - 2000-07-03 19:39:33
|
> From: Mark Wilcox [mailto:mew...@un...] > > sorry I don't. I couldn't find anything on the IETF site as > well. I wonder if it's buried in a MS document somewhere, hidden by an NDA :). As Graham mentioned, checking for the Paged cookie to be unset does the job. > But I did remember another argument for not including the > paged-control in the search method, it's a proprietary control > for Active Directory (this is perfectly legal LDAP, however ;). It will be > replaced by the Virtual List View control in future versions of AD, > because VLV provides everything Page control does, but it's > being agreed upon by Netscape, Microsoft and Novell, thus should be more > standardized across the board (I know Netscape already supports it, I think Novell > does). Ok, then replace Paged with VLV in my suggestion ;-) All I'm really asking is for the search method to return all entries that match the search criteria. To be safe, I need to use VLV in all of my searches, because one day the number of entries returned may exceed the server limit, or the server limit may one day be set lower, and the application may break because it does not get all the entries it thinks it should. This may not be an issue in some environments, but it is in mine. Coming from a database background where this limitation wasn't enforced, paging creates an additional hurdle. I'm not saying server limits are inherently a bad thing, I just wish it was easier to get around. Robbie Allen > Mark > > On Mon, 3 Jul 2000, Graham Barr wrote: > > > Does anyone know when a Paged search is complete ? > > > > ----- Forwarded message from "Allen, Robbie" > <ra...@ci...> ----- > > > > From: "Allen, Robbie" <ra...@ci...> > > To: "'Graham Barr'" <gb...@po...> > > Subject: RE: Page or VLV control > > Date: Sun, 2 Jul 2000 12:49:13 -0700 > > X-Mailer: Internet Mail Service (5.5.2650.21) > > > > Yep, that's better. So here is the finished product that > works for me: > > > > #----------------------------------------------------# > > use Net::LDAP; > > use Net::LDAP::Control; > > use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED > LDAP_CONTROL_SORTREQUEST > > ); > > > > ... > > > > $page = Net::LDAP::Control->new( LDAP_CONTROL_PAGED, > size => 1000); > > $sort = Net::LDAP::Control->new( > LDAP_CONTROL_SORTREQUEST, order => > > 'cn'); > > @args = ( base => > "cn=subnets,cn=sites,cn=configuration,$BASE_DN", > > scope => "subtree", > > filter => "(objectClass=subnet)", > > control => [ $sort, $page ] ); > > while (($mesg = $LDAP->search( @args ))) { > > print_subnet($_) foreach $mesg->entries; > > last if $mesg->count < $page->size; > > ($resp) = $mesg->control( LDAP_CONTROL_PAGED ); > > $page->cookie($resp->cookie); > > } > > #----------------------------------------------------# > > > > The only question that still remains for me is the best way > to determine > > a Paged search is complete. Above I just check to see if > the mesg count > > is less than the page size, but seems like there should be a more > > intuitive approach. The search inside the while clause isn't a good > > check, because after the search completes, it starts over > again from 1 > > (and continues), so the only way to break out of the loop > is with the > > 'last' call. > > > > Thanks for working on this!!! This is the critical piece I > was missing > > to start automating a lot of our Active Directory processes. > > > > Robbie Allen > > > > > > > -----Original Message----- > > > From: Graham Barr [mailto:gb...@po...] > > > Sent: Sunday, July 02, 2000 12:01 AM > > > To: Allen, Robbie > > > Subject: Re: Page or VLV control > > > > > > > > > Ah, OK. Try this new patch > > > > > > Graham. > > > > > > On Sat, Jul 01, 2000 at 08:32:35PM -0700, Allen, Robbie wrote: > > > > Works! At least for Paged and Sort, haven't tried VLV yet. > > > For some > > > > reason, when I used both Paged and Sort together, I also > > > had to 'use' > > > > SortResult.pm or else it complained that it couldn't find init: > > > > > > > > Can't locate object method "init" via package > > > > "Net::LDAP::Control::SortResult" a > > > > t > /usr/SD/perl5.004_05/lib/site_perl/Net/LDAP/Control.pm line 78. > > > > > > > > Wasn't necessary though if I just used the Sort control > by itself. > > > > > > > ----- End forwarded message ----- > > > > > > > |