From: Jim H. <ha...@us...> - 2001-01-24 14:16:30
|
use $Query = &(cn=*medi*)(|(city=Phoenix)(city=Santa Clara)) & and | are prefix operators, not infix. On Wed, 24 Jan 2001, Graham Barr wrote: > ----- Forwarded message from Medi Montaseri <me...@sc...> ----- > > Date: Tue, 23 Jan 2001 10:21:02 -0800 > To: gb...@po... > From: Medi Montaseri <me...@sc...> > Subject: Net::LDAP::Filter > X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-22 i686) > > Hi Graham, > > I am having some difficulties setting up a dynamically genereated Filter > in my CGI. > Could you help? > > I want to be able to construct a filter that is a mix of AND and OR > logic. eg > Here is the logic > > If name is provided, then $Query = &(cn=$name) > also, if city is provided, then > Query = city-1 or city-2 and name= $name > > More specifically > > $Query = '|(city=Phoenix)(city=Santa Clara)' > $ldap->search( base => 'o=Prepass, c=US', filter => "($Query)" ) > > works fine. > but > > $Query = &(cn=*medi*)|(city=Phoenix)(city=Santa Clara) > $ldap->search( base => 'o=Prepass, c=US', filter => "($Query)" ) > > yield "Bad Filter" > > I have tried putting () around each group with no avail. Can you show > me a mix of AND and OR logic in a filter please. > > -- > ======================================================================= > Medi Montaseri, me...@sc..., 408-450-7114 > Lockheed Martin IMS (Prepass), IT/Operations, Software Eng. > ======================================================================= > > > > ----- End forwarded message ----- > > |