Forum OpenACS Development: rel_types::new creates bad autogenerated package

OK, I have this problem with Oracle and a checkout from cvs.openacs.org from HEAD. Im using the function rel_types::new to make a new relations between two objects. Im calling the function rel_types::new with an after-install calback as follows:

# To associate one course to dotlrn class

rel_types::new -role_one d_catalog_role -role_two dotlrn_class_role dotlrn_catalog_class_rel \

"DotLRN Catalog Class" "DotLRN Catalog Class" dotlrn_catalog 0 1 dotlrn_class_instance 0 1
# To associate one course to dotrln community
rel_types::new -role_one d_catalog_role -role_two dotlrn_com_role dotlrn_catalog_dotcom_rel \
"DotLRN Catalog Community" "DotLRN Catalog Community" dotlrn_catalog 0 1 dotlrn_club 0 1

the message that I get is this one:

create or replace package dotlrn_catalog_class_rel as

--/** THIS IS AN AUTO GENERATED PACKAGE. miguel marin was the
-- user who created it
--
-- @creation-date 2005-02-15
--*/

function new (
REL_ID IN DOTLRN_CATALOG_CLASS_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 'dotlrn_catalog_class_rel'
) return dotlrn_catalog_class_rel_ext.rel_id%TYPE;

procedure del (
rel_id in dotlrn_catalog_class_rel_ext.rel_id%TYPE
);
END dotlrn_catalog_class_rel;

if you notice the problem is that there are duplicate names on the parameters of the package.

Collapse
Posted by Miguel Marin on
Im also having some problems with the content::item::new function on Oracle. Im using content::item::new from oacs-5-1 to create one item in the CR as follows:

set item_id [content::item::new -name $course_key -parent_id $folder_id -content_type "dotlrn_catalog" -creation_user $user_id -attributes $form_attributes -is_live t -title $course_key]

it supposed to create on row in table dotlrn_catalog table with the attributes from variable $form_attributes and create a new revision. In postgres everithing works fine but in oracle it only creates one new item and doesn't fill the table and doesn't create a new revision. The attribute table and the neccesary stuff for the items were created as follows:

content::type::new -content_type "dotlrn_catalog" \
-pretty_name "DotLRN Catalog" \
-pretty_plural "DotLRN Catalog" \
-table_name "dotlrn_catalog" \
-id_column "course_id"

# now set up the attributes that by default we need for the course
content::type::attribute::new \
-content_type "dotlrn_catalog" \
-attribute_name "course_key" \
-datatype "string" \
-pretty_name "Course Key" \
-pretty_plural "Course Key" \
-sort_order 1 \
-column_spec "varchar(50)"

content::type::attribute::new \
-content_type "dotlrn_catalog" \
-attribute_name "course_name" \
-datatype "string" \
-pretty_name "Course Name" \
-sort_order 2 \
-column_spec "varchar(200)"

content::type::attribute::new \
-content_type "dotlrn_catalog" \
-attribute_name "course_info" \
-datatype "text" \
-pretty_name "Course Information" \
-sort_order 3 \
-column_spec "text"

content::type::attribute::new \
-content_type "dotlrn_catalog" \
-attribute_name "assessment_id" \
-datatype "integer" \
-pretty_name "Assessment ID" \

# To store the courses in the content repository

set folder_id [content::folder::new -name "DotLRN Catalog" -label "DotLRN Catalog"]
content::folder::register_content_type -folder_id $folder_id
-content_type "dotlrn_catalog" -sort_order 4 -column_spec "integer"

Collapse
Posted by Dave Bauer on
Miguel

DO you have the latest code from the oacs-5-1 branch? If the last few days there were changes to fix some problems with Oracle.

Once you have the latest code. please run the automated tests for content repository and report the results here if you are still having problems.

Collapse
Posted by Anny Flores on
Hi

I'm working with Miguel, we made a checkout from oacs-5-1 and we add the patch that Timo did for content::revision::new, we don't get the LOB error any more but we can't create a new revision. What I did is:

1. I replaced the if statement

if {[exists_and_not_null attributes] } {

....
}

with the one in Timo's patch

2. I add to content-revision-procs-oracle.xql :
"content::revision::new.update_lob_attribute"

update $lob_table
set $lob_attribute = empty_clob()
where $lob_id_column = :revision_id
returning $lob_attribute into :1

also from Timo's patch

And when I try to make a new revision for an item, it doesn't work, the revision is not in the table cr_revisions.

I'll appreciate if someone tells me what am I doing wrong?

Thanks

Anny Flores