From: Pierangelo Masarati Date: Tue, 24 Aug 2004 15:37:10 +0000 (+0000) Subject: need to perform a select after adds... X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~654 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d25ade71e9e622505d4f5d3d05a16c52edefb6b1;p=openldap need to perform a select after adds... --- diff --git a/servers/slapd/back-sql/rdbms_depend/ibmdb2/backsql_create.sql b/servers/slapd/back-sql/rdbms_depend/ibmdb2/backsql_create.sql index ca19bb1ed1..c82e75002e 100644 --- a/servers/slapd/back-sql/rdbms_depend/ibmdb2/backsql_create.sql +++ b/servers/slapd/back-sql/rdbms_depend/ibmdb2/backsql_create.sql @@ -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 ); diff --git a/servers/slapd/back-sql/rdbms_depend/ibmdb2/testdb_metadata.sql b/servers/slapd/back-sql/rdbms_depend/ibmdb2/testdb_metadata.sql index 57f7a4a926..ad6708d782 100644 --- a/servers/slapd/back-sql/rdbms_depend/ibmdb2/testdb_metadata.sql +++ b/servers/slapd/back-sql/rdbms_depend/ibmdb2/testdb_metadata.sql @@ -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 diff --git a/tests/data/slapd-sql.conf b/tests/data/slapd-sql.conf index 6c2d613660..baa7afe83d 100644 --- a/tests/data/slapd-sql.conf +++ b/tests/data/slapd-sql.conf @@ -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),?,?,?,?)" diff --git a/tests/scripts/sql-test900-write b/tests/scripts/sql-test900-write index b9b24d27d2..0d1eee4c92 100755 --- a/tests/scripts/sql-test900-write +++ b/tests/scripts/sql-test900-write @@ -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 \