]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/util.h
fix context memory and more cleanup
[openldap] / servers / slapd / back-sql / util.h
1 #ifndef __BACKSQL_UTIL_H__
2 #define __BACKSQL_UTIL_H__
3
4 /*
5  *       Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
6  *
7  *       Redistribution and use in source and binary forms are permitted only
8  *       as authorized by the OpenLDAP Public License.  A copy of this
9  *       license is available at http://www.OpenLDAP.org/license.html or
10  *       in file LICENSE in the top-level directory of the distribution.
11  */
12
13
14 #include "entry-id.h"
15 #include "schema-map.h"
16
17 #define BACKSQL_CONCAT
18
19 struct berval * backsql_strcat( struct berval *dest, ber_len_t *buflen, ... );
20 struct berval * backsql_strfcat( struct berval *dest, ber_len_t *buflen,
21                 const char *fmt, ... );
22
23 int backsql_entry_addattr( Entry *e, struct berval *at_name, 
24                 struct berval *at_val, void *memctx );
25
26 typedef struct backsql_srch_info {
27         struct berval           *base_dn;
28         int                     scope;
29         Filter                  *filter;
30         int                     slimit, tlimit;
31         time_t                  stoptime;
32         backsql_entryID         *id_list, *c_eid;
33         int                     n_candidates;
34         int                     abandon;
35         backsql_info            *bi;
36         backsql_oc_map_rec      *oc;
37         struct berval           sel, from, join_where, flt_where;
38         ber_len_t               sel_len, from_len, jwhere_len, fwhere_len;
39         SQLHDBC                 dbh;
40         int                     status;
41         Operation               *op;
42         AttributeName           *attrs;
43         int                     bsi_flags;
44 #define BSQL_SF_ALL_OPER                0x0001
45 #define BSQL_SF_FILTER_HASSUBORDINATE   0x0002
46         Entry                   *e;
47         /* 1 if the db is TimesTen; 0 if it's not */
48         int                     use_reverse_dn; 
49 } backsql_srch_info;
50
51 void backsql_init_search( backsql_srch_info *bsi, 
52                 struct berval *nbase, int scope, int slimit, int tlimit,
53                 time_t stoptime, Filter *filter, SQLHDBC dbh,
54                 Operation *op, AttributeName *attrs );
55 Entry *backsql_id2entry( backsql_srch_info *bsi, Entry *e, 
56                 backsql_entryID *id );
57
58 extern char 
59         backsql_def_oc_query[],
60         backsql_def_needs_select_oc_query[],
61         backsql_def_at_query[],
62         backsql_def_delentry_query[],
63         backsql_def_insentry_query[],
64         backsql_def_subtree_cond[],
65         backsql_def_upper_subtree_cond[],
66         backsql_id_query[],
67         backsql_def_concat_func[];
68 extern char 
69         backsql_check_dn_ru_query[];
70
71 int backsql_merge_from_clause( struct berval *dest_from, ber_len_t *dest_len, 
72                 struct berval *src_from );
73
74 int backsql_split_pattern( const char *pattern, BerVarray *split_pattern,
75                 int expected );
76 int backsql_prepare_pattern( BerVarray split_pattern, BerVarray values,
77                 struct berval *res );
78
79 #endif /* __BACKSQL_UTIL_H__ */
80