[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
back-sql and objectClass filters
Hi,
I'm trying to setup back-sql (OL 2.2.23, Debian Linux,
but linked against unixODBC) with a IBM DB2 database,
and I'm having trouble when searching for entries of an
arbitrary structural object classes.
As an example, when I ask as filter "objectclass=domain",
and I trace slapd (-d 5), I see it generates a SQL query
as ("2" is id for domain's line in ldap_oc_mappings,
and "data_domain" is backing data table for domain objects):
SELECT DISTINCT ldap_entries.id,data_domain.id,'domain' AS
objectClass,ldap_entries.dn AS dn FROM
ldap_entries,data_domain,ldap_entry_objclasses WHERE
data_domain.id=ldap_entries.keyval AND ldap_entries.oc_map_id=2 AND
upper(ldap_entries.dn) LIKE '%' AND 1=1 OR
(ldap_entries.id=ldap_entry_objclasses.entry_id AND
ldap_entry_objclasses.oc_name='domain')
The problem is that it builts an inner join between ldap_entries
and ldap_entry_objclasses tables that gives me an empty result
set: sinces "domain" is structural, I didn't populated
ldap_entry_objclasses with domain instances (isn't it just for
auxiliary classes ??)
I would need a query using a UNION clause such as
.........
SELECT
ent.id, dom.id, 'domain' AS objectClass, ent.dn AS dn
FROM (ldap_entries ent JOIN data_domain dom ON ent.keyval = dom.id)
WHERE ent.oc_map_id = 2
UNION
SELECT
ent.id, dom.id, 'domain' AS objectClass, ent.dn AS dn
FROM
((ldap_entries ent JOIN ldap_entry_objclasses aux ON
ent.id=aux.entry_id)
JOIN data_domain dom ON ent.keyval = dom.id
)
WHERE aux.oc_name = 'domain';
...
Since the first form (without UNION) seems to be "hard-coded"
in source (servers/slapd/back-sql/search.c) I guess the answer will
be "no", but I'm asking anyway you if is there any option in slapd.conf
that can change this query ???
Thanks in advance.
--
---------------------------------------------------------------------
Marcio Scheibler
UFSM - CPD - Divisao de Suporte
=====================================================================