]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/schema-map.h
Final run of changes to back-sql; IBM db2 support has been tested.
[openldap] / servers / slapd / back-sql / schema-map.h
1 #ifndef __BACKSQL_SCHEMA_MAP_H__
2 #define __BACKSQL_SCHEMA_MAP_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 typedef struct {
14         /*
15          * FIXME: we explicitly keep the objectClass name because
16          * the ObjectClass structure does not use bervals (yet?)
17          */
18         struct berval   name;
19         /*
20          * Structure of corresponding LDAP objectClass definition
21          */
22         ObjectClass     *oc;
23         struct berval   keytbl;
24         struct berval   keycol;
25         /* expected to return keyval of newly created entry */
26         char            *create_proc;
27         /* in case create_proc does not return the keyval of the newly
28          * created row */
29         char            *create_keyval;
30         /* supposed to expect keyval as parameter and delete 
31          * all the attributes as well */
32         char            *delete_proc;
33         /* flags whether delete_proc is a function (whether back-sql 
34          * should bind first parameter as output for return code) */
35         int             expect_return;
36         unsigned long   id;
37         Avlnode         *attrs;
38 } backsql_oc_map_rec;
39
40 typedef struct {
41         /* Description of corresponding LDAP attribute type */
42         AttributeDescription    *ad;
43         struct berval   from_tbls;
44         struct berval   join_where;
45         struct berval   sel_expr;
46         /* supposed to expect 2 binded values: entry keyval 
47          * and attr. value to add, like "add_name(?,?,?)" */
48         char            *add_proc;
49         /* supposed to expect 2 binded values: entry keyval 
50          * and attr. value to delete */
51         char            *delete_proc;
52         /* for optimization purposes attribute load query 
53          * is preconstructed from parts on schemamap load time */
54         char            *query;
55         /* following flags are bitmasks (first bit used for add_proc, 
56          * second - for delete_proc) */
57         /* order of parameters for procedures above; 
58          * 1 means "data then keyval", 0 means "keyval then data" */
59         int             param_order;
60         /* flags whether one or more of procedures is a function 
61          * (whether back-sql should bind first parameter as output 
62          * for return code) */
63         int             expect_return;
64         /* TimesTen */
65         struct berval   sel_expr_u;
66 } backsql_at_map_rec;
67
68 /* defines to support bitmasks above */
69 #define BACKSQL_ADD     0x1
70 #define BACKSQL_DEL     0x2
71
72 #define BACKSQL_IS_ADD(x)       ( BACKSQL_ADD & (x) )
73 #define BACKSQL_IS_DEL(x)       ( BACKSQL_DEL & (x) )
74
75 #define BACKSQL_NCMP(v1,v2)     ber_bvcmp((v1),(v2))
76
77 int backsql_load_schema_map( backsql_info *si, SQLHDBC dbh );
78 /* Deprecated */
79 backsql_oc_map_rec *backsql_name2oc( backsql_info *si, struct berval *oc_name );
80 backsql_oc_map_rec *backsql_oc2oc( backsql_info *si, ObjectClass *oc );
81 backsql_oc_map_rec *backsql_id2oc( backsql_info *si, unsigned long id );
82 /* Deprecated */
83 backsql_at_map_rec *backsql_name2at( backsql_oc_map_rec *objclass,
84                 struct berval *at_name );
85 backsql_at_map_rec *backsql_ad2at( backsql_oc_map_rec *objclass,
86                 AttributeDescription *ad );
87 int backsql_destroy_schema_map( backsql_info *si );
88
89 #endif /* __BACKSQL_SCHEMA_MAP_H__ */
90