[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: searching with back-sql (openldap-2.2.28) and mysql
On Mon, 2005-11-21 at 22:40 +0000, Seb James wrote:
> On Mon, 2005-11-21 at 21:29 +0100, Pierangelo Masarati wrote:
> > On Mon, 2005-11-21 at 19:38 +0000, Seb James wrote:
> > > Here is the query which backsql_srch_query() contructs:
> > >
> > > SELECT DISTINCT ldap_entries.id,persons.id,'inetOrgPerson' AS objectClass,
> > > ldap_entries.dn AS dn FROM ldap_entries,persons
> > > WHERE persons.id=ldap_entries.keyval
> > > AND ldap_entries.oc_map_id=?
> > > AND ldap_entries.dn LIKE ?
> > > AND ( LIKE 'MITYA%')
> >
> > this is NOT valid SQL, as far as I can tell.
> >
> > >
> > > The problem is in the last line. I don't know enough sql to tell if this
> > > could be valid sql on another rdbms, but if I change the last line to
> > >
> > > AND (cn LIKE 'MITYA%')
> > >
> > > Then the query will run.
> >
> > That's how it should be.
I've checked both latest 2.3 and 2.2 and they appear to work as
expected. I note that the empty space where "cn" should appear, is
supposed to contain the "sel_expr" column of the "ldap_attr_mappings"
table of the "cn" row. In the test databases shipped with OpenLDAP it's
supposed to contain
2.2: 'persons.name'
2.3: "concat(persons.name,' ',persons.surname)"
Could you check what's the contents of that column in yours?
> Ok, this is useful information that back-sql has changed a lot between
> openldap 2.2 and 2.3. I'll upgrade my openldap version and see how that
> works.
I suggest to upgrade anyway. Note that back-sql in OpenLDAP up to
2.3.11 is buggy because I was unable to test and keep it up to date for
a while, and the rest of slapd underwent some development that broke it;
2.3.12 should be just fine, I could test it to some extent, at least
with PostgreSQL.
p.
Ing. Pierangelo Masarati
Responsabile Open Solution
SysNet s.n.c.
Via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
------------------------------------------
Office: +39.02.23998309
Mobile: +39.333.4963172
Email: pierangelo.masarati@sys-net.it
------------------------------------------