need to perform a select after adds...

This commit is contained in:
Pierangelo Masarati 2004-08-24 15:37:10 +00:00
parent aae3c074f1
commit d25ade71e9
4 changed files with 11 additions and 6 deletions

View File

@ -6,6 +6,7 @@ create table ldap_oc_mappings
keytbl varchar(64) not null,
keycol varchar(64) not null,
create_proc varchar(255),
create_keyval varchar(255),
delete_proc varchar(255),
expect_return integer not null
);

View File

@ -6,19 +6,21 @@
-- keytbl the name of the table that is referenced for the primary key of an entry
-- keycol the name of the column in "keytbl" that contains the primary key of an entry; the pair "keytbl.keycol" uniquely identifies an entry of objectClass "id"
-- create_proc a procedure to create the entry
-- create_keyval a query that returns the id of the last inserted entry
-- delete_proc a procedure to delete the entry; it takes "keytbl.keycol" of the row to be deleted
-- expect_return a bitmap that marks whether create_proc (1) and delete_proc (2) return a value or not
insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return)
insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,create_keyval,delete_proc,expect_return)
values (1,'inetOrgPerson','persons','id','insert into persons (id,name,surname) values ((select max(id)+1 from persons),'''','''')',
'select max(id) from persons',
'delete from persons where id=?',0);
insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return)
insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,create_keyval,delete_proc,expect_return)
values (2,'document','documents','id','insert into documents (id,title,abstract) values ((select max(id)+1 from documents),'''','''')',
'delete from documents where id=?',0);
'select max(id) from documents','delete from documents where id=?',0);
insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,delete_proc,expect_return)
insert into ldap_oc_mappings (id,name,keytbl,keycol,create_proc,create_keyval,delete_proc,expect_return)
values (3,'organization','institutes','id','insert into institutes (id,name) values ((select max(id)+1 from institutes),'''')',
'delete from institutes where id=?',0);
'select max(id) from institutes','delete from institutes where id=?',0);
-- attributeType mappings: describe how an attributeType for a certain objectClass maps to the SQL data.
-- id a unique number identifying the attribute

View File

@ -59,6 +59,8 @@ dbpasswd secret
#ibmdb2#upper_needs_cast "yes"
#ibmdb2#concat_pattern "?||?"
#ibmdb2#children_cond "ucase(ldap_entries.dn)=ucase(cast(? as varchar(255)))"
#ibmdb2#create_needs_select "yes"
#ibmdb2#insentry_query "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select case when max(id) is null then 1 else max(id) + 1 end from ldap_entries),?,?,?,?)"
#
# PostgreSQL
#postgres#insentry_query "insert into ldap_entries (id,dn,oc_map_id,parent,keyval) values ((select case when max(id) is null then 1 else max(id) + 1 end from ldap_entries),?,?,?,?)"

View File

@ -64,7 +64,7 @@ fi
BASEDN="dc=example,dc=com"
case ${RDBMS} in
# list here the RDBMSes whose mapping allows writes
postgres)
postgres|ibmdb2)
MANAGERDN="cn=Manager,${BASEDN}"
echo "Testing add..."
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \