X-Git-Url: http://git.rot13.org/?p=virtual-ldap;a=blobdiff_plain;f=lib%2FLDAP%2FKoha.pm;h=7c2791c56b434f2ef7880bf32c27e89f4afb8fb3;hp=0eacc09011927aa7938ae6d07b6722f76e3b08a8;hb=944ac5011bf7f15d11f6768e2aafa4545b2d974f;hpb=b10c69583acd6795d18b51e7e08fb4a766cd6c17;ds=sidebyside diff --git a/lib/LDAP/Koha.pm b/lib/LDAP/Koha.pm index 0eacc09..7c2791c 100644 --- a/lib/LDAP/Koha.pm +++ b/lib/LDAP/Koha.pm @@ -25,7 +25,7 @@ our $database = 'koha'; our $user = 'unconfigured-user'; our $passwd = 'unconfigured-password'; -our $max_results = 3000; # FIXME must be enough for all users +our $max_results = $ENV{MAX_RESULTS} || 3000; # FIXME must be enough for all users our $objectclass_default = 'hrEduPerson'; our $objectclass; @@ -199,8 +199,14 @@ sub search { } - warn "# SQL:\n$sql_select\n", $sql_where ? $sql_where : '-- no where', "\n# DATA: ",dump( @values ); - my $sth = $dbh->prepare( $sql_select . $sql_where . " LIMIT $max_results" ); # XXX remove limit? + my $sql + = $sql_select + . $sql_where + . ( $objectclass =~ m{person}i ? " LIMIT $max_results" : '' ) # add limit just for persons + ; + + warn "# SQL:\n$sql\n# DATA: ",dump( @values ); + my $sth = $dbh->prepare( $sql ); $sth->execute( @values ); warn "# ", $sth->rows, " results for ",dump( $reqData->{'filter'} );