Forum OpenACS Development: email-image problem installing on oracel

I recently made some procs (email_image) on acs-subsite, and in postgres works just fine, but in oracle I had some problems.
The problem is with a relation that I use to asociate a cr_item with the user_id, when I create that relation (rel_types::new) some kind of autogenerated package is created also, and that causes the error. Here is the code of the autogenerated package in the error.log:

create or replace package email_image_rel as

--/** THIS IS AN AUTO GENERATED PACKAGE. was the
-- user who created it
--
-- @creation-date 2005-01-19
--*/

function new (
REL_ID IN EMAIL_IMAGE_REL_EXT.REL_ID%TYPE DEFAULT NULL,
OBJECT_TYPE IN ACS_OBJECTS.OBJECT_TYPE%TYPE,
CREATION_DATE IN ACS_OBJECTS.CREATION_DATE%TYPE,
CREATION_IP IN ACS_OBJECTS.CREATION_IP%TYPE,
LAST_MODIFIED IN ACS_OBJECTS.LAST_MODIFIED%TYPE,
MODIFYING_IP IN ACS_OBJECTS.MODIFYING_IP%TYPE,
CREATION_USER IN ACS_OBJECTS.CREATION_USER%TYPE DEFAULT NULL,
CONTEXT_ID IN ACS_OBJECTS.CONTEXT_ID%TYPE DEFAULT NULL,
PACKAGE_ID IN ACS_OBJECTS.PACKAGE_ID%TYPE DEFAULT NULL,
TITLE IN ACS_OBJECTS.TITLE%TYPE DEFAULT NULL,
CONTEXT_ID IN ACS_OBJECTS.CONTEXT_ID%TYPE DEFAULT NULL,
CREATION_IP IN ACS_OBJECTS.CREATION_IP%TYPE DEFAULT NULL,
CREATION_USER IN ACS_OBJECTS.CREATION_USER%TYPE DEFAULT NULL,
OBJECT_ID_ONE IN ACS_RELS.OBJECT_ID_ONE%TYPE DEFAULT NULL,
OBJECT_ID_TWO IN ACS_RELS.OBJECT_ID_TWO%TYPE DEFAULT NULL,
REL_TYPE IN ACS_RELS.REL_TYPE%TYPE DEFAULT 'email_image_rel'
) return email_image_rel_ext.rel_id%TYPE;

procedure del (
rel_id in email_image_rel_ext.rel_id%TYPE
);
END email_image_rel;

as you can see there are some duplicates in the parameters so the package is not valid after compiling.

If some one can help me I will apreciate it.

Collapse
Posted by Miguel Marin on
OK, More information on the problem:

First I’m using the rel_types::new in an apm-callback.tcl like this:
rel_types::new email_image_rel "Email Image" "Email Images" user 0 1 content_item 0 1

in acs-subsite to create the relation when the package is installed, but when openacs is installed it shows an error with the message that acs-subsite could not be installed. The problem is that creates an autogenerated package with some duplicated parameters, so the package is created with compilation errors. If I create the relation this way (as is done with user portraits):

create table email_images (
user_id constraint email_image_fk
references users
constraint email_image_pk
primary key
);

begin
acs_rel_type.create_role('email_image', 'Email Image', 'Email Images');
acs_rel_type.create_type (
rel_type => 'email_image_rel',
pretty_name => 'Email Image',
pretty_plural => 'Email Images',
object_type_one => 'user',
role_one => 'user',
table_name => 'email_images',
id_column => 'user_id',
package_name => 'email_image_rel',
min_n_rels_one => 1,
max_n_rels_one => 1,
object_type_two => 'content_item',
min_n_rels_two => 0,
max_n_rels_two => 1
);

commit;
end;
/
show errors

the installation finish correctly but then when I user content::item::new then this function fails (It works fine in postgres). I calle content::item::new like this:

set item_id [content::item::new -name $image_name -parent_id $folder_id -content_type "email_image" -storage_type "lob" -creation_ip $creation_ip]

Collapse
Posted by Dave Bauer on
Where are you creating the email_image_rels table?

Somehwere you need this code before you try to define the rel_type.

create table email_image_rels (
rel_id integer email_image_rels_rel_id_fk references acs_objects
)

You can't use the email_images table to hold the relationships the way it is defined.

It also appears you are trying to use email_image for a subtype of content_revision.