]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/proto-sql.h
matched values is "global"
[openldap] / servers / slapd / back-sql / proto-sql.h
index 19b7518887a8973a3a29a0f1d5c648c547f0e42f..8019284223d1e0e0712fcc321fbfe705c86273c4 100644 (file)
@@ -1,6 +1,6 @@
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2004 The OpenLDAP Foundation.
+ * Copyright 1999-2005 The OpenLDAP Foundation.
  * Portions Copyright 1999 Dmitry Kovalev.
  * Portions Copyright 2002 Pierangelo Mararati.
  * All rights reserved.
@@ -16,7 +16,7 @@
 /* ACKNOWLEDGEMENTS:
  * This work was initially developed by Dmitry Kovalev for inclusion
  * by OpenLDAP Software.  Additional significant contributors include
- *    Pierangelo Mararati
+ * Pierangelo Masarati
  */
 
 /*
 #define PROTO_SQL_H
 
 #include "back-sql.h"
-#include "sql-types.h"
 
 /*
  * add.c
  */
+int backsql_modify_delete_all_values(
+       Operation               *op,
+       SlapReply               *rs,
+       SQLHDBC                 dbh, 
+       backsql_entryID         *e_id,
+       backsql_at_map_rec      *at );
+
 int backsql_modify_internal(
        Operation               *op,
        SlapReply               *rs,
@@ -87,13 +93,27 @@ int backsql_modify_internal(
        backsql_entryID         *e_id,
        Modifications           *modlist );
 
+/*
+ * api.c
+ */
+int backsql_api_config( backsql_info *bi, const char *name,
+               int argc, char *argv[] );
+int backsql_api_destroy( backsql_info *bi );
+int backsql_api_register( backsql_api *ba );
+int backsql_api_dn2odbc( Operation *op, SlapReply *rs, struct berval *dn );
+int backsql_api_odbc2dn( Operation *op, SlapReply *rs, struct berval *dn );
+
 /*
  * entry-id.c
  */
+#ifdef BACKSQL_ARBITRARY_KEY
+extern struct berval   backsql_baseObject_bv;
+#endif /* BACKSQL_ARBITRARY_KEY */
 
 /* stores in *id the ID in table ldap_entries corresponding to DN, if any */
-int backsql_dn2id( backsql_info *bi, backsql_entryID *id,
-               SQLHDBC dbh, struct berval *dn );
+int backsql_dn2id( Operation *op, SlapReply *rs, SQLHDBC dbh,
+               struct berval *ndn, backsql_entryID *id,
+               int matched, int muck );
 
 /* stores in *nchildren the count of children for an entry */
 int backsql_count_children( backsql_info *bi, SQLHDBC dbh,
@@ -104,11 +124,19 @@ int backsql_count_children( backsql_info *bi, SQLHDBC dbh,
 int backsql_has_children( backsql_info *bi, SQLHDBC dbh, struct berval *dn );
 
 /* frees *id and returns next in list */
-backsql_entryID *backsql_free_entryID( backsql_entryID *id, int freeit );
+backsql_entryID *backsql_free_entryID( Operation *op, backsql_entryID *id,
+               int freeit );
 
 /* turns an ID into an entry */
-Entry *backsql_id2entry( backsql_srch_info *bsi, Entry *e, 
-               backsql_entryID *id );
+int backsql_id2entry( backsql_srch_info *bsi, backsql_entryID *id );
+
+/*
+ * operational.c
+ */
+
+Attribute *backsql_operational_entryUUID( backsql_info *bi, backsql_entryID *id );
+
+Attribute *backsql_operational_entryCSN( Operation *op );
 
 /*
  * schema-map.c
@@ -135,10 +163,11 @@ int backsql_destroy_schema_map( backsql_info *si );
  * search.c
  */
 
-void backsql_init_search( backsql_srch_info *bsi, 
+int backsql_init_search( backsql_srch_info *bsi, 
                struct berval *nbase, int scope, int slimit, int tlimit,
                time_t stoptime, Filter *filter, SQLHDBC dbh,
-               Operation *op, AttributeName *attrs );
+               Operation *op, SlapReply *rs, AttributeName *attrs,
+               unsigned flags );
 
 /*
  * sql-wrap.h
@@ -146,17 +175,31 @@ void backsql_init_search( backsql_srch_info *bsi,
 
 RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, char* query, int timeout );
 
-#define backsql_BindParamStr( sth, par_ind, str, maxlen )              \
+#define backsql_BindParamStr( sth, par_ind, io, str, maxlen )          \
        SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
-                       SQL_PARAM_INPUT,                                \
-                       SQL_C_CHAR, SQL_VARCHAR,                        \
+                       (io), SQL_C_CHAR, SQL_VARCHAR,                  \
                        (SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str),    \
                        (SQLUINTEGER)(maxlen), NULL )
 
-#define backsql_BindParamID( sth, par_ind, id )                                \
+#define backsql_BindParamBerVal( sth, par_ind, io, bv )                \
+       SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
+                       (io), SQL_C_CHAR, SQL_VARCHAR,                  \
+                       (SQLUINTEGER)(bv)->bv_len, 0,                   \
+                       (SQLPOINTER)(bv)->bv_val,                       \
+                       (SQLUINTEGER)(bv)->bv_len, NULL )
+
+#define backsql_BindParamInt( sth, par_ind, io, val )                  \
        SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
-                       SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,      \
-                       0, 0, (SQLPOINTER)(id), 0, (SQLINTEGER*)NULL )
+                       (io), SQL_C_ULONG, SQL_INTEGER,                 \
+                       0, 0, (SQLPOINTER)(val), 0, (SQLINTEGER*)NULL )
+
+#ifdef BACKSQL_ARBITRARY_KEY
+#define backsql_BindParamID( sth, par_ind, io, id )                    \
+       backsql_BindParamBerVal( (sth), (par_ind), (io), (id) )
+#else /* ! BACKSQL_ARBITRARY_KEY */
+#define backsql_BindParamID( sth, par_ind, io, id )                    \
+       backsql_BindParamInt( (sth), (par_ind), (io), (id) )
+#endif /* ! BACKSQL_ARBITRARY_KEY */
 
 RETCODE backsql_BindRowAsStrings( SQLHSTMT sth, BACKSQL_ROW_NTS *row );
 
@@ -180,8 +223,10 @@ extern char
        backsql_def_oc_query[],
        backsql_def_needs_select_oc_query[],
        backsql_def_at_query[],
-       backsql_def_delentry_query[],
-       backsql_def_insentry_query[],
+       backsql_def_delentry_stmt[],
+       backsql_def_renentry_stmt[],
+       backsql_def_insentry_stmt[],
+       backsql_def_delobjclasses_stmt[],
        backsql_def_subtree_cond[],
        backsql_def_upper_subtree_cond[],
        backsql_id_query[],
@@ -192,7 +237,7 @@ extern char
 struct berbuf * backsql_strcat( struct berbuf *dest, ... );
 struct berbuf * backsql_strfcat( struct berbuf *dest, const char *fmt, ... );
 
-int backsql_entry_addattr( Entry *e, struct berval *at_name
+int backsql_entry_addattr( Entry *e, AttributeDescription *ad
                struct berval *at_val, void *memctx );
 
 int backsql_merge_from_clause( struct berbuf *dest_from, 
@@ -204,4 +249,41 @@ int backsql_split_pattern( const char *pattern, BerVarray *split_pattern,
 int backsql_prepare_pattern( BerVarray split_pattern, BerVarray values,
                struct berval *res );
 
+int backsql_entryUUID( backsql_info *bi, backsql_entryID *id,
+               struct berval *entryUUID, void *memctx );
+int backsql_entryUUID_decode( struct berval *entryUUID, unsigned long *oc_id,
+#ifdef BACKSQL_ARBITRARY_KEY
+       struct berval   *keyval
+#else /* ! BACKSQL_ARBITRARY_KEY */
+       unsigned long   *keyval
+#endif /* ! BACKSQL_ARBITRARY_KEY */
+       );
+
+/*
+ * former external.h
+ */
+
+extern BI_init                 sql_back_initialize;
+
+extern BI_destroy              backsql_destroy;
+
+extern BI_db_init              backsql_db_init;
+extern BI_db_open              backsql_db_open;
+extern BI_db_close             backsql_db_close;
+extern BI_db_destroy           backsql_db_destroy;
+extern BI_db_config            backsql_db_config;
+
+extern BI_op_bind              backsql_bind;
+extern BI_op_search            backsql_search;
+extern BI_op_compare           backsql_compare;
+extern BI_op_modify            backsql_modify;
+extern BI_op_modrdn            backsql_modrdn;
+extern BI_op_add               backsql_add;
+extern BI_op_delete            backsql_delete;
+
+extern BI_operational          backsql_operational;
+extern BI_entry_get_rw         backsql_entry_get;
+
+extern BI_connection_destroy   backsql_connection_destroy;
+
 #endif /* PROTO_SQL_H */