Closed Bug 1386 Opened 26 years ago Closed 25 years ago

Suggested two methods for API.pm

Categories

(Directory :: PerLDAP, defect, P3)

All
Other
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: leif, Assigned: leif)

Details

From: Dave Carrigan <Dave.Carrigan@cnpl.enbridge.com>

Index: Conn.pm
===================================================================
RCS file: /cvsroot/mozilla/directory/perldap/Conn.pm,v
retrieving revision 1.18.2.7
diff -u -b -u -r1.18.2.7 Conn.pm
--- Conn.pm     1998/09/29 07:20:29     1.18.2.7
+++ Conn.pm     1998/10/28 19:52:43
@@ -248,6 +248,26 @@
   return $entry;
 }

+sub compare {
+  my ($self, $dn, $attr, $value) = @_;
+  return ldap_compare_s($self->{"ld"}, $dn, $attr, $value) ==
LDAP_COMPARE_TRUE;
+}
+
+#############################################################################
+# Count the number of entries found in a search
+#
+sub countEntries {
+  my $self = shift;
+  if ($self->{"ldfe"} == 1)
+    {
+      return ldap_count_entries($self->{"ld"}, $self->{"ldres"});
+    }
+  else
+    {
+      return 0 unless $self->{"ldentry"};
+      return ldap_count_entries($self->{"ld"}, $self->{"ldentry"});
+    }
+}

 #############################################################################
 # Get an entry from the search, either the first entry, or the next entry,
Status: NEW → ASSIGNED
Priority: P2 → P3
Setting all current Open/Normal to M4.
Clearing "M" field since Directory product is not used for 5.0 specific project
bug metrics and will mess up our queries on milestones.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
I've added the compare method, but not the countEntries(). The latter will break
if/when we do asynchronous LDAP in v2.0, and for the time being, I think it's
better to leave it out. It is documented in the FAQ though.
You need to log in before you can comment on or make changes to this bug.