2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1999-2004 The OpenLDAP Foundation.
5 * Portions Copyright 1999 Dmitry Kovalev.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was initially developed by Dmitry Kovalev for inclusion
18 * by OpenLDAP Software.
26 #include <sys/types.h>
29 #include "proto-sql.h"
32 * sets the supported operational attributes (if required)
43 backsql_info *bi = (backsql_info*)op->o_bd->be_private;
44 SQLHDBC dbh = SQL_NULL_HDBC;
48 Debug( LDAP_DEBUG_TRACE, "==>backsql_operational(): entry '%s'\n",
49 rs->sr_entry->e_nname.bv_val, 0, 0 );
52 if ( ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) )
53 && attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL ) {
55 rc = backsql_get_db_conn( op, &dbh );
56 if ( rc != LDAP_SUCCESS ) {
57 Debug( LDAP_DEBUG_TRACE, "backsql_operational(): "
58 "could not get connection handle - exiting\n",
63 rc = backsql_has_children( bi, dbh, &rs->sr_entry->e_nname );
66 case LDAP_COMPARE_TRUE:
67 case LDAP_COMPARE_FALSE:
68 *aa = slap_operational_hasSubordinate( rc == LDAP_COMPARE_TRUE );
76 Debug( LDAP_DEBUG_TRACE, "backsql_operational(): "
77 "has_children failed( %d)\n", rc, 0, 0 );
83 Debug( LDAP_DEBUG_TRACE, "<==backsql_operational()\n", 0, 0, 0);
88 #endif /* SLAPD_SQL */