]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/back-sql.h
remove unnecessary data from search_info
[openldap] / servers / slapd / back-sql / back-sql.h
index e3dad04a34f4e10c70c89059cb0c910b18ee41b5..78ca48e791ec7e372d3e00868744009bd4aa3547 100644 (file)
  * 1. id_query.patch           applied (with changes)
  * 2. shortcut.patch           applied (reworked)
  * 3. create_hint.patch                applied
- * 4. count_query.patch                rejected (conflicts with other features)
+ * 4. count_query.patch                applied (reworked)
  * 5. returncodes.patch                applied (with sanity checks)
  * 6. connpool.patch           under evaluation
- * 7. modoc.patch              under evaluation
- * 8. miscfixes.patch          applied (reworked; FIXME: other
- *                             operations may need to load the
- *                             entire entry for ACL purposes)
+ * 7. modoc.patch              under evaluation (requires
+ *                             manageDSAit and "manage"
+ *                             access privileges)
+ * 8. miscfixes.patch          applied (reworked; other
+ *                             operations need to load the
+ *                             entire entry for ACL purposes;
+ *                             see ITS#3480, now fixed)
  *
  * original description:
 
@@ -195,6 +198,21 @@ typedef struct {
  */
 #undef BACKSQL_TRACE
 
+/*
+ * define if using MS SQL and workaround needed (see sql-wrap.c)
+ */
+#undef BACKSQL_MSSQL_WORKAROUND
+
+/*
+ * define to enable values counting for attributes
+ */
+#define BACKSQL_COUNTQUERY
+
+/*
+ * define to enable prettification/validation of values
+ */
+#define BACKSQL_PRETTY_VALIDATE
+
 /*
  * define to enable varchars as unique keys in user tables
  *
@@ -227,8 +245,9 @@ typedef struct {
  * in quotes.  This is especially true for those that do not
  * allow keywords used as aliases.
  */
-/* #define BACKSQL_ALIASING_QUOTE      '"' */
-/* #define BACKSQL_ALIASING_QUOTE      '\'' */
+#define BACKSQL_ALIASING_QUOTE ""
+/* #define BACKSQL_ALIASING_QUOTE      "\"" */
+/* #define BACKSQL_ALIASING_QUOTE      "'" */
 
 /*
  * API
@@ -333,6 +352,9 @@ typedef struct backsql_at_map_rec {
        /* for optimization purposes attribute load query 
         * is preconstructed from parts on schemamap load time */
        char            *bam_query;
+#ifdef BACKSQL_COUNTQUERY
+       char            *bam_countquery;
+#endif /* BACKSQL_COUNTQUERY */
        /* following flags are bitmasks (first bit used for add_proc, 
         * second - for delete_proc) */
        /* order of parameters for procedures above; 
@@ -375,6 +397,16 @@ typedef struct berbuf {
 
 #define BB_NULL                { BER_BVNULL, 0 }
 
+/* the function must collect the entry associated to nbase */
+#define BACKSQL_ISF_GET_ID     0x1U
+#define BACKSQL_ISF_GET_ENTRY  ( 0x2U | BACKSQL_ISF_GET_ID )
+#define BACKSQL_ISF_MATCHED    0x4U
+#define BACKSQL_IS_GET_ID(f) \
+       ( ( (f) & BACKSQL_ISF_GET_ID ) == BACKSQL_ISF_GET_ID )
+#define BACKSQL_IS_GET_ENTRY(f) \
+       ( ( (f) & BACKSQL_ISF_GET_ENTRY ) == BACKSQL_ISF_GET_ENTRY )
+#define BACKSQL_IS_MATCHED(f) \
+       ( ( (f) & BACKSQL_ISF_MATCHED ) == BACKSQL_ISF_MATCHED )
 typedef struct backsql_srch_info {
        Operation               *bsi_op;
        SlapReply               *bsi_rs;
@@ -404,15 +436,12 @@ typedef struct backsql_srch_info {
  * is used */
 #define BACKSQL_SCOPE_BASE_LIKE                ( LDAP_SCOPE_BASE | 0x1000 )
        Filter                  *bsi_filter;
-       int                     bsi_slimit,
-                               bsi_tlimit;
        time_t                  bsi_stoptime;
 
        backsql_entryID         *bsi_id_list,
                                **bsi_id_listtail,
                                *bsi_c_eid;
        int                     bsi_n_candidates;
-       int                     bsi_abandon;
        int                     bsi_status;
 
        backsql_oc_map_rec      *bsi_oc;
@@ -448,8 +477,8 @@ typedef struct backsql_info {
                        *sql_at_query;
        char            *sql_insentry_stmt,
                        *sql_delentry_stmt,
-                       *sql_delobjclasses_stmt,
-                       *sql_delreferrals_stmt;
+                       *sql_renentry_stmt,
+                       *sql_delobjclasses_stmt;
        char            *sql_id_query;
        char            *sql_has_children_query;
 
@@ -462,6 +491,10 @@ typedef struct backsql_info {
        BerVarray       sql_concat_func;
        struct berval   sql_strcast_func;
 
+       struct berval   sql_aliasing;
+       struct berval   sql_aliasing_quote;
+       struct berval   sql_dn_oc_aliasing;
+
        AttributeName   *sql_anlist;
 
        unsigned int    sql_flags;
@@ -477,6 +510,7 @@ typedef struct backsql_info {
 #define BSQLF_FETCH_ALL_USERATTRS      0x0200
 #define BSQLF_FETCH_ALL_OPATTRS                0x0400
 #define        BSQLF_FETCH_ALL_ATTRS           (BSQLF_FETCH_ALL_USERATTRS|BSQLF_FETCH_ALL_OPATTRS)
+#define BSQLF_CHECK_SCHEMA             0x0800
 
 #define BACKSQL_ISF(si, f) \
        (((si)->sql_flags & f) == f)
@@ -507,6 +541,8 @@ typedef struct backsql_info {
        BACKSQL_ISF(si, BSQLF_FETCH_ALL_OPATTRS)
 #define BACKSQL_FETCH_ALL_ATTRS(si) \
        BACKSQL_ISF(si, BSQLF_FETCH_ALL_ATTRS)
+#define BACKSQL_CHECK_SCHEMA(si) \
+       BACKSQL_ISF(si, BSQLF_CHECK_SCHEMA)
 
        Entry           *sql_baseObject;
 #ifdef BACKSQL_ARBITRARY_KEY