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 * Structure of corresponding LDAP objectClass definition
18 #define BACKSQL_OC_NAME(ocmap) ((ocmap)->oc->soc_cname.bv_val)
22 /* expected to return keyval of newly created entry */
24 /* in case create_proc does not return the keyval of the newly
27 /* supposed to expect keyval as parameter and delete
28 * all the attributes as well */
30 /* flags whether delete_proc is a function (whether back-sql
31 * should bind first parameter as output for return code) */
38 /* Description of corresponding LDAP attribute type */
39 AttributeDescription *ad;
40 struct berval from_tbls;
41 struct berval join_where;
42 struct berval sel_expr;
43 /* supposed to expect 2 binded values: entry keyval
44 * and attr. value to add, like "add_name(?,?,?)" */
46 /* supposed to expect 2 binded values: entry keyval
47 * and attr. value to delete */
49 /* for optimization purposes attribute load query
50 * is preconstructed from parts on schemamap load time */
52 /* following flags are bitmasks (first bit used for add_proc,
53 * second - for delete_proc) */
54 /* order of parameters for procedures above;
55 * 1 means "data then keyval", 0 means "keyval then data" */
57 /* flags whether one or more of procedures is a function
58 * (whether back-sql should bind first parameter as output
62 struct berval sel_expr_u;
65 /* defines to support bitmasks above */
66 #define BACKSQL_ADD 0x1
67 #define BACKSQL_DEL 0x2
69 #define BACKSQL_IS_ADD(x) ( BACKSQL_ADD & (x) )
70 #define BACKSQL_IS_DEL(x) ( BACKSQL_DEL & (x) )
72 #define BACKSQL_NCMP(v1,v2) ber_bvcmp((v1),(v2))
74 int backsql_load_schema_map( backsql_info *si, SQLHDBC dbh );
76 backsql_oc_map_rec *backsql_name2oc( backsql_info *si, struct berval *oc_name );
77 backsql_oc_map_rec *backsql_oc2oc( backsql_info *si, ObjectClass *oc );
78 backsql_oc_map_rec *backsql_id2oc( backsql_info *si, unsigned long id );
80 backsql_at_map_rec *backsql_name2at( backsql_oc_map_rec *objclass,
81 struct berval *at_name );
82 backsql_at_map_rec *backsql_ad2at( backsql_oc_map_rec *objclass,
83 AttributeDescription *ad );
84 int backsql_destroy_schema_map( backsql_info *si );
86 #endif /* __BACKSQL_SCHEMA_MAP_H__ */