Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / openldap / dist / servers / slapd / back-sql / init.c
blob3045d9bea89e34565a8ac57233a3148af15d6153
1 /* $OpenLDAP: pkg/ldap/servers/slapd/back-sql/init.c,v 1.73.2.4 2008/02/11 23:26:48 kurt Exp $ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1999-2008 The OpenLDAP Foundation.
5 * Portions Copyright 1999 Dmitry Kovalev.
6 * Portions Copyright 2002 Pierangelo Masarati.
7 * All rights reserved.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
11 * Public License.
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
17 /* ACKNOWLEDGEMENTS:
18 * This work was initially developed by Dmitry Kovalev for inclusion
19 * by OpenLDAP Software. Additional significant contributors include
20 * Pierangelo Masarati.
23 #include "portable.h"
25 #include <stdio.h>
26 #include <sys/types.h>
27 #include "ac/string.h"
29 #include "slap.h"
30 #include "config.h"
31 #include "proto-sql.h"
33 int
34 sql_back_initialize(
35 BackendInfo *bi )
37 static char *controls[] = {
38 LDAP_CONTROL_ASSERT,
39 LDAP_CONTROL_MANAGEDSAIT,
40 LDAP_CONTROL_NOOP,
41 #ifdef SLAP_CONTROL_X_TREE_DELETE
42 SLAP_CONTROL_X_TREE_DELETE,
43 #endif /* SLAP_CONTROL_X_TREE_DELETE */
44 LDAP_CONTROL_PAGEDRESULTS,
45 NULL
48 bi->bi_controls = controls;
50 bi->bi_flags |=
51 #if 0
52 SLAP_BFLAG_INCREMENT |
53 #endif
54 SLAP_BFLAG_REFERRALS;
56 Debug( LDAP_DEBUG_TRACE,"==>sql_back_initialize()\n", 0, 0, 0 );
58 bi->bi_db_init = backsql_db_init;
59 bi->bi_db_config = backsql_db_config;
60 bi->bi_db_open = backsql_db_open;
61 bi->bi_db_close = backsql_db_close;
62 bi->bi_db_destroy = backsql_db_destroy;
64 bi->bi_op_abandon = 0;
65 bi->bi_op_compare = backsql_compare;
66 bi->bi_op_bind = backsql_bind;
67 bi->bi_op_unbind = 0;
68 bi->bi_op_search = backsql_search;
69 bi->bi_op_modify = backsql_modify;
70 bi->bi_op_modrdn = backsql_modrdn;
71 bi->bi_op_add = backsql_add;
72 bi->bi_op_delete = backsql_delete;
74 bi->bi_chk_referrals = 0;
75 bi->bi_operational = backsql_operational;
76 bi->bi_entry_get_rw = backsql_entry_get;
77 bi->bi_entry_release_rw = backsql_entry_release;
79 bi->bi_connection_init = 0;
81 Debug( LDAP_DEBUG_TRACE,"<==sql_back_initialize()\n", 0, 0, 0 );
82 return 0;
85 int
86 backsql_destroy(
87 BackendInfo *bi )
89 Debug( LDAP_DEBUG_TRACE, "==>backsql_destroy()\n", 0, 0, 0 );
90 Debug( LDAP_DEBUG_TRACE, "<==backsql_destroy()\n", 0, 0, 0 );
91 return 0;
94 int
95 backsql_db_init(
96 BackendDB *bd,
97 ConfigReply *cr )
99 backsql_info *bi;
100 int rc = 0;
102 Debug( LDAP_DEBUG_TRACE, "==>backsql_db_init()\n", 0, 0, 0 );
104 bi = (backsql_info *)ch_calloc( 1, sizeof( backsql_info ) );
105 ldap_pvt_thread_mutex_init( &bi->sql_dbconn_mutex );
106 ldap_pvt_thread_mutex_init( &bi->sql_schema_mutex );
108 if ( backsql_init_db_env( bi ) != SQL_SUCCESS ) {
109 rc = -1;
112 bd->be_private = bi;
114 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_init()\n", 0, 0, 0 );
116 return rc;
120 backsql_db_destroy(
121 BackendDB *bd,
122 ConfigReply *cr )
124 backsql_info *bi = (backsql_info*)bd->be_private;
126 Debug( LDAP_DEBUG_TRACE, "==>backsql_db_destroy()\n", 0, 0, 0 );
128 backsql_free_db_env( bi );
129 ldap_pvt_thread_mutex_destroy( &bi->sql_dbconn_mutex );
130 backsql_destroy_schema_map( bi );
131 ldap_pvt_thread_mutex_destroy( &bi->sql_schema_mutex );
133 if ( bi->sql_dbname ) {
134 ch_free( bi->sql_dbname );
136 if ( bi->sql_dbuser ) {
137 ch_free( bi->sql_dbuser );
139 if ( bi->sql_dbpasswd ) {
140 ch_free( bi->sql_dbpasswd );
142 if ( bi->sql_dbhost ) {
143 ch_free( bi->sql_dbhost );
145 if ( bi->sql_upper_func.bv_val ) {
146 ch_free( bi->sql_upper_func.bv_val );
147 ch_free( bi->sql_upper_func_open.bv_val );
148 ch_free( bi->sql_upper_func_close.bv_val );
150 if ( bi->sql_concat_func ) {
151 ber_bvarray_free( bi->sql_concat_func );
153 if ( !BER_BVISNULL( &bi->sql_strcast_func ) ) {
154 ch_free( bi->sql_strcast_func.bv_val );
156 if ( !BER_BVISNULL( &bi->sql_children_cond ) ) {
157 ch_free( bi->sql_children_cond.bv_val );
159 if ( !BER_BVISNULL( &bi->sql_dn_match_cond ) ) {
160 ch_free( bi->sql_dn_match_cond.bv_val );
162 if ( !BER_BVISNULL( &bi->sql_subtree_cond ) ) {
163 ch_free( bi->sql_subtree_cond.bv_val );
165 if ( !BER_BVISNULL( &bi->sql_dn_oc_aliasing ) ) {
166 ch_free( bi->sql_dn_oc_aliasing.bv_val );
168 if ( bi->sql_oc_query ) {
169 ch_free( bi->sql_oc_query );
171 if ( bi->sql_at_query ) {
172 ch_free( bi->sql_at_query );
174 if ( bi->sql_id_query ) {
175 ch_free( bi->sql_id_query );
177 if ( bi->sql_has_children_query ) {
178 ch_free( bi->sql_has_children_query );
180 if ( bi->sql_insentry_stmt ) {
181 ch_free( bi->sql_insentry_stmt );
183 if ( bi->sql_delentry_stmt ) {
184 ch_free( bi->sql_delentry_stmt );
186 if ( bi->sql_renentry_stmt ) {
187 ch_free( bi->sql_renentry_stmt );
189 if ( bi->sql_delobjclasses_stmt ) {
190 ch_free( bi->sql_delobjclasses_stmt );
192 if ( !BER_BVISNULL( &bi->sql_aliasing ) ) {
193 ch_free( bi->sql_aliasing.bv_val );
195 if ( !BER_BVISNULL( &bi->sql_aliasing_quote ) ) {
196 ch_free( bi->sql_aliasing_quote.bv_val );
199 if ( bi->sql_anlist ) {
200 int i;
202 for ( i = 0; !BER_BVISNULL( &bi->sql_anlist[ i ].an_name ); i++ )
204 ch_free( bi->sql_anlist[ i ].an_name.bv_val );
206 ch_free( bi->sql_anlist );
209 if ( bi->sql_baseObject ) {
210 entry_free( bi->sql_baseObject );
213 ch_free( bi );
215 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_destroy()\n", 0, 0, 0 );
216 return 0;
220 backsql_db_open(
221 BackendDB *bd,
222 ConfigReply *cr )
224 backsql_info *bi = (backsql_info*)bd->be_private;
225 struct berbuf bb = BB_NULL;
227 Connection conn = { 0 };
228 OperationBuffer opbuf;
229 Operation* op;
230 SQLHDBC dbh = SQL_NULL_HDBC;
231 void *thrctx = ldap_pvt_thread_pool_context();
233 Debug( LDAP_DEBUG_TRACE, "==>backsql_db_open(): "
234 "testing RDBMS connection\n", 0, 0, 0 );
235 if ( bi->sql_dbname == NULL ) {
236 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
237 "datasource name not specified "
238 "(use \"dbname\" directive in slapd.conf)\n", 0, 0, 0 );
239 return 1;
242 if ( bi->sql_concat_func == NULL ) {
243 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
244 "concat func not specified (use \"concat_pattern\" "
245 "directive in slapd.conf)\n", 0, 0, 0 );
247 if ( backsql_split_pattern( backsql_def_concat_func,
248 &bi->sql_concat_func, 2 ) ) {
249 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
250 "unable to parse pattern \"%s\"",
251 backsql_def_concat_func, 0, 0 );
252 return 1;
257 * see back-sql.h for default values
259 if ( BER_BVISNULL( &bi->sql_aliasing ) ) {
260 ber_str2bv( BACKSQL_ALIASING,
261 STRLENOF( BACKSQL_ALIASING ),
262 1, &bi->sql_aliasing );
265 if ( BER_BVISNULL( &bi->sql_aliasing_quote ) ) {
266 ber_str2bv( BACKSQL_ALIASING_QUOTE,
267 STRLENOF( BACKSQL_ALIASING_QUOTE ),
268 1, &bi->sql_aliasing_quote );
272 * Prepare cast string as required
274 if ( bi->sql_upper_func.bv_val ) {
275 char buf[1024];
277 if ( BACKSQL_UPPER_NEEDS_CAST( bi ) ) {
278 snprintf( buf, sizeof( buf ),
279 "%s(cast (" /* ? as varchar(%d))) */ ,
280 bi->sql_upper_func.bv_val );
281 ber_str2bv( buf, 0, 1, &bi->sql_upper_func_open );
283 snprintf( buf, sizeof( buf ),
284 /* (cast(? */ " as varchar(%d)))",
285 BACKSQL_MAX_DN_LEN );
286 ber_str2bv( buf, 0, 1, &bi->sql_upper_func_close );
288 } else {
289 snprintf( buf, sizeof( buf ), "%s(" /* ?) */ ,
290 bi->sql_upper_func.bv_val );
291 ber_str2bv( buf, 0, 1, &bi->sql_upper_func_open );
293 ber_str2bv( /* (? */ ")", 0, 1, &bi->sql_upper_func_close );
297 /* normalize filter values only if necessary */
298 bi->sql_caseIgnoreMatch = mr_find( "caseIgnoreMatch" );
299 assert( bi->sql_caseIgnoreMatch != NULL );
301 bi->sql_telephoneNumberMatch = mr_find( "telephoneNumberMatch" );
302 assert( bi->sql_telephoneNumberMatch != NULL );
304 if ( bi->sql_dbuser == NULL ) {
305 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
306 "user name not specified "
307 "(use \"dbuser\" directive in slapd.conf)\n", 0, 0, 0 );
308 return 1;
311 if ( BER_BVISNULL( &bi->sql_subtree_cond ) ) {
313 * Prepare concat function for subtree search condition
315 struct berval concat;
316 struct berval values[] = {
317 BER_BVC( "'%'" ),
318 BER_BVC( "?" ),
319 BER_BVNULL
321 struct berbuf bb = BB_NULL;
323 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
324 "subtree search SQL condition not specified "
325 "(use \"subtree_cond\" directive in slapd.conf); "
326 "preparing default\n",
327 0, 0, 0);
329 if ( backsql_prepare_pattern( bi->sql_concat_func, values,
330 &concat ) ) {
331 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
332 "unable to prepare CONCAT pattern for subtree search",
333 0, 0, 0 );
334 return 1;
337 if ( bi->sql_upper_func.bv_val ) {
340 * UPPER(ldap_entries.dn) LIKE UPPER(CONCAT('%',?))
343 backsql_strfcat_x( &bb, NULL, "blbbb",
344 &bi->sql_upper_func,
345 (ber_len_t)STRLENOF( "(ldap_entries.dn) LIKE " ),
346 "(ldap_entries.dn) LIKE ",
347 &bi->sql_upper_func_open,
348 &concat,
349 &bi->sql_upper_func_close );
351 } else {
354 * ldap_entries.dn LIKE CONCAT('%',?)
357 backsql_strfcat_x( &bb, NULL, "lb",
358 (ber_len_t)STRLENOF( "ldap_entries.dn LIKE " ),
359 "ldap_entries.dn LIKE ",
360 &concat );
363 ch_free( concat.bv_val );
365 bi->sql_subtree_cond = bb.bb_val;
367 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
368 "setting \"%s\" as default \"subtree_cond\"\n",
369 bi->sql_subtree_cond.bv_val, 0, 0 );
372 if ( bi->sql_children_cond.bv_val == NULL ) {
374 * Prepare concat function for children search condition
376 struct berval concat;
377 struct berval values[] = {
378 BER_BVC( "'%,'" ),
379 BER_BVC( "?" ),
380 BER_BVNULL
382 struct berbuf bb = BB_NULL;
384 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
385 "children search SQL condition not specified "
386 "(use \"children_cond\" directive in slapd.conf); "
387 "preparing default\n",
388 0, 0, 0);
390 if ( backsql_prepare_pattern( bi->sql_concat_func, values,
391 &concat ) ) {
392 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
393 "unable to prepare CONCAT pattern for children search", 0, 0, 0 );
394 return 1;
397 if ( bi->sql_upper_func.bv_val ) {
400 * UPPER(ldap_entries.dn) LIKE UPPER(CONCAT('%,',?))
403 backsql_strfcat_x( &bb, NULL, "blbbb",
404 &bi->sql_upper_func,
405 (ber_len_t)STRLENOF( "(ldap_entries.dn) LIKE " ),
406 "(ldap_entries.dn) LIKE ",
407 &bi->sql_upper_func_open,
408 &concat,
409 &bi->sql_upper_func_close );
411 } else {
414 * ldap_entries.dn LIKE CONCAT('%,',?)
417 backsql_strfcat_x( &bb, NULL, "lb",
418 (ber_len_t)STRLENOF( "ldap_entries.dn LIKE " ),
419 "ldap_entries.dn LIKE ",
420 &concat );
423 ch_free( concat.bv_val );
425 bi->sql_children_cond = bb.bb_val;
427 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
428 "setting \"%s\" as default \"children_cond\"\n",
429 bi->sql_children_cond.bv_val, 0, 0 );
432 if ( bi->sql_dn_match_cond.bv_val == NULL ) {
434 * Prepare concat function for dn match search condition
436 struct berbuf bb = BB_NULL;
438 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
439 "DN match search SQL condition not specified "
440 "(use \"dn_match_cond\" directive in slapd.conf); "
441 "preparing default\n",
442 0, 0, 0);
444 if ( bi->sql_upper_func.bv_val ) {
447 * UPPER(ldap_entries.dn)=?
450 backsql_strfcat_x( &bb, NULL, "blbcb",
451 &bi->sql_upper_func,
452 (ber_len_t)STRLENOF( "(ldap_entries.dn)=" ),
453 "(ldap_entries.dn)=",
454 &bi->sql_upper_func_open,
455 '?',
456 &bi->sql_upper_func_close );
458 } else {
461 * ldap_entries.dn=?
464 backsql_strfcat_x( &bb, NULL, "l",
465 (ber_len_t)STRLENOF( "ldap_entries.dn=?" ),
466 "ldap_entries.dn=?" );
469 bi->sql_dn_match_cond = bb.bb_val;
471 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
472 "setting \"%s\" as default \"dn_match_cond\"\n",
473 bi->sql_dn_match_cond.bv_val, 0, 0 );
476 if ( bi->sql_oc_query == NULL ) {
477 if ( BACKSQL_CREATE_NEEDS_SELECT( bi ) ) {
478 bi->sql_oc_query =
479 ch_strdup( backsql_def_needs_select_oc_query );
481 } else {
482 bi->sql_oc_query = ch_strdup( backsql_def_oc_query );
485 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
486 "objectclass mapping SQL statement not specified "
487 "(use \"oc_query\" directive in slapd.conf)\n",
488 0, 0, 0 );
489 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
490 "setting \"%s\" by default\n", bi->sql_oc_query, 0, 0 );
493 if ( bi->sql_at_query == NULL ) {
494 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
495 "attribute mapping SQL statement not specified "
496 "(use \"at_query\" directive in slapd.conf)\n",
497 0, 0, 0 );
498 Debug(LDAP_DEBUG_TRACE, "backsql_db_open(): "
499 "setting \"%s\" by default\n",
500 backsql_def_at_query, 0, 0 );
501 bi->sql_at_query = ch_strdup( backsql_def_at_query );
504 if ( bi->sql_insentry_stmt == NULL ) {
505 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
506 "entry insertion SQL statement not specified "
507 "(use \"insentry_stmt\" directive in slapd.conf)\n",
508 0, 0, 0 );
509 Debug(LDAP_DEBUG_TRACE, "backsql_db_open(): "
510 "setting \"%s\" by default\n",
511 backsql_def_insentry_stmt, 0, 0 );
512 bi->sql_insentry_stmt = ch_strdup( backsql_def_insentry_stmt );
515 if ( bi->sql_delentry_stmt == NULL ) {
516 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
517 "entry deletion SQL statement not specified "
518 "(use \"delentry_stmt\" directive in slapd.conf)\n",
519 0, 0, 0 );
520 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
521 "setting \"%s\" by default\n",
522 backsql_def_delentry_stmt, 0, 0 );
523 bi->sql_delentry_stmt = ch_strdup( backsql_def_delentry_stmt );
526 if ( bi->sql_renentry_stmt == NULL ) {
527 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
528 "entry deletion SQL statement not specified "
529 "(use \"renentry_stmt\" directive in slapd.conf)\n",
530 0, 0, 0 );
531 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
532 "setting \"%s\" by default\n",
533 backsql_def_renentry_stmt, 0, 0 );
534 bi->sql_renentry_stmt = ch_strdup( backsql_def_renentry_stmt );
537 if ( bi->sql_delobjclasses_stmt == NULL ) {
538 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
539 "objclasses deletion SQL statement not specified "
540 "(use \"delobjclasses_stmt\" directive in slapd.conf)\n",
541 0, 0, 0 );
542 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
543 "setting \"%s\" by default\n",
544 backsql_def_delobjclasses_stmt, 0, 0 );
545 bi->sql_delobjclasses_stmt = ch_strdup( backsql_def_delobjclasses_stmt );
548 /* This should just be to force schema loading */
549 connection_fake_init( &conn, &opbuf, thrctx );
550 op = &opbuf.ob_op;
551 op->o_bd = bd;
552 if ( backsql_get_db_conn( op, &dbh ) != LDAP_SUCCESS ) {
553 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
554 "connection failed, exiting\n", 0, 0, 0 );
555 return 1;
557 if ( backsql_load_schema_map( bi, dbh ) != LDAP_SUCCESS ) {
558 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
559 "schema mapping failed, exiting\n", 0, 0, 0 );
560 return 1;
562 if ( backsql_free_db_conn( op, dbh ) != SQL_SUCCESS ) {
563 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
564 "connection free failed\n", 0, 0, 0 );
566 if ( !BACKSQL_SCHEMA_LOADED( bi ) ) {
567 Debug( LDAP_DEBUG_TRACE, "backsql_db_open(): "
568 "test failed, schema map not loaded - exiting\n",
569 0, 0, 0 );
570 return 1;
574 * Prepare ID selection query
576 if ( bi->sql_id_query == NULL ) {
577 /* no custom id_query provided */
578 if ( bi->sql_upper_func.bv_val == NULL ) {
579 backsql_strcat_x( &bb, NULL, backsql_id_query, "dn=?", NULL );
581 } else {
582 if ( BACKSQL_HAS_LDAPINFO_DN_RU( bi ) ) {
583 backsql_strcat_x( &bb, NULL, backsql_id_query,
584 "dn_ru=?", NULL );
585 } else {
586 if ( BACKSQL_USE_REVERSE_DN( bi ) ) {
587 backsql_strfcat_x( &bb, NULL, "sbl",
588 backsql_id_query,
589 &bi->sql_upper_func,
590 (ber_len_t)STRLENOF( "(dn)=?" ), "(dn)=?" );
591 } else {
592 backsql_strfcat_x( &bb, NULL, "sblbcb",
593 backsql_id_query,
594 &bi->sql_upper_func,
595 (ber_len_t)STRLENOF( "(dn)=" ), "(dn)=",
596 &bi->sql_upper_func_open,
597 '?',
598 &bi->sql_upper_func_close );
602 bi->sql_id_query = bb.bb_val.bv_val;
606 * Prepare children count query
608 BER_BVZERO( &bb.bb_val );
609 bb.bb_len = 0;
610 backsql_strfcat_x( &bb, NULL, "sbsb",
611 "SELECT COUNT(distinct subordinates.id) "
612 "FROM ldap_entries,ldap_entries ",
613 &bi->sql_aliasing, "subordinates "
614 "WHERE subordinates.parent=ldap_entries.id AND ",
615 &bi->sql_dn_match_cond );
616 bi->sql_has_children_query = bb.bb_val.bv_val;
619 * Prepare DN and objectClass aliasing bit of query
621 BER_BVZERO( &bb.bb_val );
622 bb.bb_len = 0;
623 backsql_strfcat_x( &bb, NULL, "sbbsbsbbsb",
624 " ", &bi->sql_aliasing, &bi->sql_aliasing_quote,
625 "objectClass", &bi->sql_aliasing_quote,
626 ",ldap_entries.dn ", &bi->sql_aliasing,
627 &bi->sql_aliasing_quote, "dn", &bi->sql_aliasing_quote );
628 bi->sql_dn_oc_aliasing = bb.bb_val;
630 /* should never happen! */
631 assert( bd->be_nsuffix != NULL );
633 if ( BER_BVISNULL( &bd->be_nsuffix[ 1 ] ) ) {
634 /* enable if only one suffix is defined */
635 bi->sql_flags |= BSQLF_USE_SUBTREE_SHORTCUT;
638 bi->sql_flags |= BSQLF_CHECK_SCHEMA;
640 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_open(): "
641 "test succeeded, schema map loaded\n", 0, 0, 0 );
642 return 0;
646 backsql_db_close(
647 BackendDB *bd,
648 ConfigReply *cr )
650 backsql_info *bi = (backsql_info*)bd->be_private;
652 Debug( LDAP_DEBUG_TRACE, "==>backsql_db_close()\n", 0, 0, 0 );
654 backsql_conn_destroy( bi );
656 Debug( LDAP_DEBUG_TRACE, "<==backsql_db_close()\n", 0, 0, 0 );
658 return 0;
661 #if SLAPD_SQL == SLAPD_MOD_DYNAMIC
663 /* conditionally define the init_module() function */
664 SLAP_BACKEND_INIT_MODULE( sql )
666 #endif /* SLAPD_SQL == SLAPD_MOD_DYNAMIC */