]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/util.h
Sync with HEAD
[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_MAX(a,b) ((a)>(b)?(a):(b))
18 #define BACKSQL_MIN(a,b) ((a)<(b)?(a):(b))
19
20 #define BACKSQL_STR_GROW 64
21
22 extern struct berval 
23         bv_n_objectclass,
24         bv_n_0_10;
25
26 struct berval *backsql_strcat( struct berval *dest, int *buflen, ... );
27
28 int backsql_entry_addattr( Entry *e, struct berval *at_name, 
29                 struct berval *at_val );
30
31 typedef struct __backsql_srch_info {
32         struct berval           *base_dn;
33         int                     scope;
34         Filter                  *filter;
35         int                     slimit, tlimit;
36         time_t                  stoptime;
37         backsql_entryID         *id_list, *c_eid;
38         int                     n_candidates;
39         int                     abandon;
40         backsql_info            *bi;
41         backsql_oc_map_rec      *oc;
42         struct berval           sel, from, join_where, flt_where;
43         int                     sel_len, from_len, jwhere_len, fwhere_len;
44         SQLHDBC                 dbh;
45         int                     status;
46         Backend                 *be;
47         Connection              *conn;
48         Operation               *op;
49         AttributeName           *attrs;
50         Entry                   *e;
51         /* 1 if the db is TimesTen; 0 if it's not */
52         int                     isTimesTen; 
53 } backsql_srch_info;
54
55 int backsql_process_filter( backsql_srch_info *bsi, Filter *f );
56 void backsql_init_search( backsql_srch_info *bsi, backsql_info *bi,
57                 struct berval *nbase, int scope, int slimit, int tlimit,
58                 time_t stoptime, Filter *filter, SQLHDBC dbh,
59                 BackendDB *be, Connection *conn, Operation *op,
60                 AttributeName *attrs );
61 Entry *backsql_id2entry( backsql_srch_info *bsi, Entry *e, 
62                 backsql_entryID *id );
63
64 extern char 
65         backsql_def_oc_query[],
66         backsql_def_at_query[],
67         backsql_def_delentry_query[],
68         backsql_def_insentry_query[],
69         backsql_def_subtree_cond[],
70         backsql_def_upper_subtree_cond[],
71         backsql_id_query[];
72 extern char 
73         backsql_check_dn_ru_query[];
74
75 int backsql_merge_from_clause( char **dest_from, int *dest_len, 
76                 char *src_from );
77
78
79 #endif /* __BACKSQL_UTIL_H__ */
80