]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/schema-map.h
changes:
[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
14 typedef struct {
15         char            *name;
16         char            *keytbl;
17         char            *keycol;
18         /* expected to return keyval of newly created entry */
19         char            *create_proc;
20         /* supposed to expect keyval as parameter and delete 
21          * all the attributes as well */
22         char            *delete_proc;
23         /* flags whether delete_proc is a function (whether back-sql 
24          * should bind first parameter as output for return code) */
25         int             expect_return;
26         unsigned long   id;
27         Avlnode         *attrs;
28 } backsql_oc_map_rec;
29
30 typedef struct {
31         /* literal name of corresponding LDAP attribute type */
32         char            *name;
33         char            *from_tbls;
34         char            *join_where;
35         char            *sel_expr;
36         /* supposed to expect 2 binded values: entry keyval 
37          * and attr. value to add, like "add_name(?,?,?)" */
38         char            *add_proc;
39         /* supposed to expect 2 binded values: entry keyval 
40          * and attr. value to delete */
41         char            *delete_proc;
42         /* for optimization purposes attribute load query 
43          * is preconstructed from parts on schemamap load time */
44         char            *query;
45         /* following flags are bitmasks (first bit used for add_proc, 
46          * second - for modify, third - for delete_proc) */
47         /* order of parameters for procedures above; 
48          * 1 means "data then keyval", 0 means "keyval then data" */
49         int             param_order;
50         /* flags whether one or more of procedures is a function 
51          * (whether back-sql should bind first parameter as output 
52          * for return code) */
53         int             expect_return;
54         /* TimesTen */
55         char            *sel_expr_u;
56 } backsql_at_map_rec;
57
58 /* defines to support bitmasks above */
59 #define BACKSQL_ADD     1
60 #define BACKSQL_DEL     2
61
62 int backsql_load_schema_map( backsql_info *si, SQLHDBC dbh );
63 backsql_oc_map_rec *backsql_oc_with_name( backsql_info *si, char *objclass );
64 backsql_oc_map_rec *backsql_oc_with_id( backsql_info *si, unsigned long id );
65 backsql_at_map_rec *backsql_at_with_name( backsql_oc_map_rec *objclass,
66                 char *attr );
67 int backsql_destroy_schema_map( backsql_info *si );
68
69 #endif /* __BACKSQL_SCHEMA_MAP_H__ */
70