1 #ifndef __BACKSQL_SCHEMA_MAP_H__
2 #define __BACKSQL_SCHEMA_MAP_H__
5 * Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
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.
15 * FIXME: we explicitly keep the objectClass name because
16 * the ObjectClass structure does not use bervals (yet?)
20 * Structure of corresponding LDAP objectClass definition
25 /* expected to return keyval of newly created entry */
27 /* in case create_proc does not return the keyval of the newly
30 /* supposed to expect keyval as parameter and delete
31 * all the attributes as well */
33 /* flags whether delete_proc is a function (whether back-sql
34 * should bind first parameter as output for return code) */
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(?,?,?)" */
49 /* supposed to expect 2 binded values: entry keyval
50 * and attr. value to delete */
52 /* for optimization purposes attribute load query
53 * is preconstructed from parts on schemamap load time */
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" */
60 /* flags whether one or more of procedures is a function
61 * (whether back-sql should bind first parameter as output
65 struct berval sel_expr_u;
68 /* defines to support bitmasks above */
69 #define BACKSQL_ADD 0x1
70 #define BACKSQL_DEL 0x2
72 #define BACKSQL_IS_ADD(x) ( BACKSQL_ADD & (x) )
73 #define BACKSQL_IS_DEL(x) ( BACKSQL_DEL & (x) )
75 #define BACKSQL_NCMP(v1,v2) ber_bvcmp((v1),(v2))
77 int backsql_load_schema_map( backsql_info *si, SQLHDBC dbh );
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 );
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 );
89 #endif /* __BACKSQL_SCHEMA_MAP_H__ */