rs->sr_err = LDAP_OTHER;
goto done;
}
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE,
- " backsql_modify_delete_all_values() "
- "arg(%d)=%s\n",
- pno + 1 + po, e_id->eid_keyval.bv_val, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
+
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_delete_all_values() "
- "arg(%d)=%lu\n",
- pno + 1 + po, e_id->eid_keyval, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ "arg(%d)=" BACKSQL_IDFMT "\n",
+ pno + 1 + po,
+ BACKSQL_IDARG(e_id->eid_keyval), 0 );
/*
* check for syntax needed here
rs->sr_err = LDAP_OTHER;
goto done;
}
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE,
- " backsql_modify_internal(): "
- "arg(%d)=\"%s\"\n",
- pno + 1 + po, e_id->eid_keyval.bv_val, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
+
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg(%d)=\"%lu\"\n",
- pno + 1 + po, e_id->eid_keyval, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ "arg(%d)=" BACKSQL_IDFMT "\n",
+ pno + 1 + po,
+ BACKSQL_IDARG(e_id->eid_keyval), 0 );
/*
* check for syntax needed here
rs->sr_err = LDAP_OTHER;
goto done;
}
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE,
- " backsql_modify_internal(): "
- "arg(%d)=\"%s\"\n",
- pno + 1 + po, e_id->eid_keyval.bv_val, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
+
Debug( LDAP_DEBUG_TRACE,
" backsql_modify_internal(): "
- "arg(%d)=\"%lu\"\n",
- pno + 1 + po, e_id->eid_keyval, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ "arg(%d)=" BACKSQL_IDFMT "\n",
+ pno + 1 + po,
+ BACKSQL_IDARG(e_id->eid_keyval), 0 );
/*
* check for syntax needed here
goto done;
}
- Debug( LDAP_DEBUG_TRACE, " backsql_add(): executing \"%s\" for dn \"%s\"\n",
- bi->sql_insentry_stmt, op->ora_e->e_name.bv_val, 0 );
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE, " for oc_map_id=%ld, "
- "p_id=%s, keyval=%ld\n",
- oc->bom_id, bsi.bsi_base_id.eid_id.bv_val, new_keyval );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, " for oc_map_id=%ld, "
- "p_id=%ld, keyval=%ld\n",
- oc->bom_id, bsi.bsi_base_id.eid_id, new_keyval );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ if ( LogTest( LDAP_DEBUG_TRACE ) ) {
+ char buf[ SLAP_TEXT_BUFLEN ];
+
+ snprintf( buf, sizeof(buf),
+ "executing \"%s\" for dn=\"%s\" oc_map_id=%ld p_id=" BACKSQL_IDFMT " keyval=%ld",
+ bi->sql_insentry_stmt, op->ora_e->e_name.bv_val,
+ oc->bom_id, BACKSQL_IDARG(bsi.bsi_base_id.eid_id),
+ new_keyval );
+ Debug( LDAP_DEBUG_TRACE, " backsql_add(): %s\n", buf, 0, 0 );
+ }
+
rc = SQLExecute( sth );
if ( rc != SQL_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, " backsql_add(\"%s\"): "
|| (ct) == SQL_VARBINARY \
|| (ct) == SQL_LONGVARBINARY)
+#ifdef BACKSQL_ARBITRARY_KEY
+#define BACKSQL_IDFMT "%s"
+#define BACKSQL_IDARG(arg) ((arg).bv_val)
+#else /* ! BACKSQL_ARBITRARY_KEY */
+#define BACKSQL_IDFMT "%lu"
+#define BACKSQL_IDARG(arg) (arg)
+#endif /* ! BACKSQL_ARBITRARY_KEY */
+
#endif /* __BACKSQL_H__ */
assert( at != NULL );
assert( bsi != NULL );
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE, "==>backsql_get_attr_vals(): "
- "oc=\"%s\" attr=\"%s\" keyval=%s\n",
- BACKSQL_OC_NAME( bsi->bsi_oc ), at->bam_ad->ad_cname.bv_val,
- bsi->bsi_c_eid->eid_keyval.bv_val );
-#else /* ! BACKSQL_ARBITRARY_KEY */
Debug( LDAP_DEBUG_TRACE, "==>backsql_get_attr_vals(): "
- "oc=\"%s\" attr=\"%s\" keyval=%ld\n",
+ "oc=\"%s\" attr=\"%s\" keyval=" BACKSQL_IDFMT "\n",
BACKSQL_OC_NAME( bsi->bsi_oc ), at->bam_ad->ad_cname.bv_val,
- bsi->bsi_c_eid->eid_keyval );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ BACKSQL_IDARG(bsi->bsi_c_eid->eid_keyval) );
#ifdef BACKSQL_PRETTY_VALIDATE
validate = at->bam_true_ad->ad_type->sat_syntax->ssyn_validate;
}
#ifdef BACKSQL_TRACE
-#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE, "backsql_get_attr_vals(): "
- "query=\"%s\" keyval=%s\n", at->bam_query,
- bsi->bsi_c_eid->eid_keyval.bv_val, 0 );
-#else /* !BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, "backsql_get_attr_vals(): "
- "query=\"%s\" keyval=%d\n", at->bam_query,
- bsi->bsi_c_eid->eid_keyval, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ "query=\"%s\" keyval=" BACKSQL_IDFMT "\n", at->bam_query,
+ BACKSQL_IDARG(bsi->bsi_c_eid->eid_keyval), 0 );
#endif /* BACKSQL_TRACE */
rc = SQLExecute( sth );
goto done;
}
-#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE, " backsql_modify(): "
- "modifying entry \"%s\" (id=%s)\n",
+ "modifying entry \"%s\" (id=" BACKSQL_IDFMT ")\n",
bsi.bsi_base_id.eid_dn.bv_val,
- bsi.bsi_base_id.eid_id.bv_val, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, " backsql_modify(): "
- "modifying entry \"%s\" (id=%ld)\n",
- bsi.bsi_base_id.eid_dn.bv_val, bsi.bsi_base_id.eid_id, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ BACKSQL_IDARG(bsi.bsi_base_id.eid_id), 0 );
if ( get_assert( op ) &&
( test_filter( op, &m, get_assertion( op ) )
goto done;
}
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): entry id=%s\n",
- e_id.eid_id.bv_val, 0, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): entry id=%ld\n",
- e_id.eid_id, 0, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ Debug( LDAP_DEBUG_TRACE,
+ " backsql_modrdn(): entry id=" BACKSQL_IDFMT "\n",
+ BACKSQL_IDARG(e_id.eid_id), 0, 0 );
if ( get_assert( op ) &&
( test_filter( op, &r, get_assertion( op ) )
slap_anlist_all_attributes,
BACKSQL_ISF_GET_ENTRY );
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
- "old parent entry id is %s\n",
- bsi.bsi_base_id.eid_id.bv_val, 0, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
- "old parent entry id is %ld\n",
- bsi.bsi_base_id.eid_id, 0, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ Debug( LDAP_DEBUG_TRACE,
+ " backsql_modrdn(): old parent entry id is " BACKSQL_IDFMT "\n",
+ BACKSQL_IDARG(bsi.bsi_base_id.eid_id), 0, 0 );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "backsql_modrdn(): "
n_id = bsi.bsi_base_id;
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
- "new parent entry id=%s\n",
- n_id.eid_id.bv_val, 0, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, " backsql_modrdn(): "
- "new parent entry id=%ld\n",
- n_id.eid_id, 0, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ Debug( LDAP_DEBUG_TRACE,
+ " backsql_modrdn(): new parent entry id=" BACKSQL_IDFMT "\n",
+ BACKSQL_IDARG(n_id.eid_id), 0, 0 );
if ( !access_allowed( op, &n, slap_schema.si_ad_children,
NULL, ACL_WADD, NULL ) ) {
case LDAP_SCOPE_ONELEVEL:
assert( !BER_BVISNULL( &bsi->bsi_base_id.eid_ndn ) );
-#ifdef BACKSQL_ARBITRARY_KEY
- Debug( LDAP_DEBUG_TRACE, "(one)id: \"%s\"\n",
- bsi->bsi_base_id.eid_id.bv_val, 0, 0 );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, "(one)id: '%lu'\n",
- bsi->bsi_base_id.eid_id, 0, 0 );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ Debug( LDAP_DEBUG_TRACE, "(one)id=" BACKSQL_IDFMT "\n",
+ BACKSQL_IDARG(bsi->bsi_base_id.eid_id), 0, 0 );
rc = backsql_BindParamID( sth, 2, SQL_PARAM_INPUT,
&bsi->bsi_base_id.eid_id );
if ( rc != SQL_SUCCESS ) {
*bsi->bsi_id_listtail = c_id;
bsi->bsi_id_listtail = &c_id->eid_next;
-#ifdef BACKSQL_ARBITRARY_KEY
Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): "
- "added entry id=%s, keyval=%s dn=\"%s\"\n",
- c_id->eid_id.bv_val, c_id->eid_keyval.bv_val,
+ "added entry id=" BACKSQL_IDFMT " keyval=" BACKSQL_IDFMT " dn=\"%s\"\n",
+ BACKSQL_IDARG(c_id->eid_id),
+ BACKSQL_IDARG(c_id->eid_keyval),
row.cols[ 3 ] );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): "
- "added entry id=%ld, keyval=%ld dn=\"%s\"\n",
- c_id->eid_id, c_id->eid_keyval, row.cols[ 3 ] );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
/* count candidates, for unchecked limit */
bsi->bsi_n_candidates--;
goto send_results;
}
-#ifdef BACKSQL_ARBITRARY_KEY
Debug(LDAP_DEBUG_TRACE, "backsql_search(): loading data "
- "for entry id=%s, oc_id=%ld, keyval=%s\n",
- eid->eid_id.bv_val, eid->eid_oc_id,
- eid->eid_keyval.bv_val );
-#else /* ! BACKSQL_ARBITRARY_KEY */
- Debug(LDAP_DEBUG_TRACE, "backsql_search(): loading data "
- "for entry id=%ld, oc_id=%ld, keyval=%ld\n",
- eid->eid_id, eid->eid_oc_id, eid->eid_keyval );
-#endif /* ! BACKSQL_ARBITRARY_KEY */
+ "for entry id=" BACKSQL_IDFMT " oc_id=%ld, keyval=" BACKSQL_IDFMT "\n",
+ BACKSQL_IDARG(eid->eid_id),
+ eid->eid_oc_id,
+ BACKSQL_IDARG(eid->eid_keyval) );
/* check scope */
switch ( op->ors_scope ) {