Skip Menu |

This queue is for tickets about the DBD-LDAP CPAN distribution.

Report information
The Basics
Id: 12270
Status: resolved
Priority: 0/
Queue: DBD-LDAP

People
Owner: turnerjw784 [...] yahoo.com
Requestors: jmorano [...] moretrix.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.06
Fixed in: (no value)



Subject: Make DBD::LDAP work with Class::DBI and a Netscape LDAP server (DBD/LDAP.pm patch)
Okay, I uncommented some code that was on line (starting at) 613. The module was setting the type on -1, but when data came back from the Netscape LDAP which was an array of multiple values, my Class::DBI was empty (keys were created, values were undef). It was because the DBD::LDAP was returning -1 as type, which is not type VARCHAR! type 12 is a VARCHAR. If you want more information about this patch, please do not hestitate to mail me. This code has been tested on a OpenLDAP server and a Netscape LDAP server, together with Class::DBI.
--- my_version/DBD/LDAP.pm 2005-04-13 14:01:00.277875120 +0200 +++ installed_version/DBD/LDAP.pm 2005-04-13 13:55:43.424044224 +0200 @@ -580,7 +580,6 @@ { $retval = $resv[0]; my $dB = $sth->{Database}; - if ($dB->FETCH('AutoCommit') == 1 && $sth->FETCH('Statement') !~ /^\s*select/i) { $dB->STORE('AutoCommit',0); #ADDED 20010911 AS PER SPRITE TO MAKE AUTOCOMMIT WORK. @@ -600,7 +599,6 @@ #EVERYTHING WORKED, SO SAVE LDAP RESULT (# ROWS) AND FETCH FIELD INFO. $sth->{'driver_rows'} = $resv[0]; # number of rows - $sth->{'ldap_rows'} = $resv[0]; # number of rows #### NOTE #### IF THIS FAILS, IT PROBABLY NEEDS TO BE "ldap_rows"? @@ -613,14 +611,14 @@ @{$ldapref->{NAME}} = @l; for my $i (0..$#l) { - ${$ldapref->{TYPE}}[$i] = $typehash{${$ldapref->{types}}{$l[$i]}}; - ${$ldapref->{PRECISION}}[$i] = ${$ldapref->{lengths}}{$l[$i]}; - ${$ldapref->{SCALE}}[$i] = ${$ldapref->{scales}}{$l[$i]}; + #${$ldapref->{TYPE}}[$i] = $typehash{${$ldapref->{types}}{$l[$i]}}; + #${$ldapref->{PRECISION}}[$i] = ${$ldapref->{lengths}}{$l[$i]}; + #${$ldapref->{SCALE}}[$i] = ${$ldapref->{scales}}{$l[$i]}; #${$ldapref->{NULLABLE}}[$i] = 1; #${$ldapref->{TYPE}}[$i] = 12; #VARCHAR - #${$ldapref->{TYPE}}[$i] = -1; #VARCHAR - #${$ldapref->{PRECISION}}[$i] = 255; - #${$ldapref->{SCALE}}[$i] = 0; + ${$ldapref->{TYPE}}[$i] = -1; #VARCHAR + ${$ldapref->{PRECISION}}[$i] = 255; + ${$ldapref->{SCALE}}[$i] = 0; ${$ldapref->{NULLABLE}}[$i] = 1; } } @@ -629,7 +627,7 @@ $sth->{'driver_data'} = \@resv; $sth->STORE('ldap_data', \@resv); - $sth->STORE('ldap_rows', ($resv[0])); # number of rows + $sth->STORE('ldap_rows', ($#resv+1)); # number of rows $sth->{'TYPE'} = \@{$ldapref->{TYPE}}; $sth->{'NAME'} = \@{$ldapref->{NAME}}; $sth->{'PRECISION'} = \@{$ldapref->{PRECISION}};
[guest - Wed Apr 13 08:10:37 2005]: Show quoted text
> Okay, I uncommented some code that was on line (starting at) 613. The > module was setting the type on -1, but when data came back from the > Netscape LDAP which was an array of multiple values, my Class::DBI > was empty (keys were created, values were undef). It was because > the DBD::LDAP was returning -1 as type, which is not type VARCHAR! > type 12 is a VARCHAR. > > If you want more information about this patch, please do not hestitate > to mail me. This code has been tested on a OpenLDAP server and a > Netscape LDAP server, together with Class::DBI.
Is this a dup of 12269? Jim
From: Johnny Morano <jmorano [...] moretrix.com>
It's not really a duplicate, one patch is for your JLdap.pm and the other is for DBD/LDAP.pm. Sorry for my clumsy patching and posting, it's my first time. Do they make any sense? Thanks, Johnny
Patches applied except for: 1) AT 631, $resv[0] should have the number of rows, is this not correct (not changed). 2) The change at JLdap line 116 will not work. It is returned this way at line 108 because in that case $status points to an array so return the array referenced by $status (@$status). In 116, $status is a scalar containing a single integer >= 0, so if an array is requested, we return an array containing a single element (the status value) (not changed). All other changes made. New version 0.07 released to CPAN 7/15/05 Jim Turner