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