Forum OpenACS Development: Re: Adding comments to ADP pages in the www directory?

Collapse
Posted by Trenton Cameron on
After talking with Roberto I decided that it would be a good idea to create a ADP package to handle creating an object ID so that I could pass it to the general-comments package part of the reason for this logic is that I am using tcl/adp pairs.
I have called the package SDL-ADP (I work for SDL) any how when I try to create an object of this type I get the error

ora8.c:3568:ora_tcl_command: error in `OCIStmtExecute ()': ORA-06550: line 4, column 13:
PLS-00905: object TRENTORACLE.SDL is invalid
ORA-06550: line 4, column 7:
PL/SQL: Statement ignored

the create statement that I am using is

begin
  acs_object_type.create_type (
    supertype    => 'acs_object',
    object_type  => 'adppage',
    pretty_name  => 'AdpPage',
    pretty_plural => 'AdpPages',
    table_name    => 'ADPPAGE',
    id_column    => 'PAGE_ID'
  );
end;
/
show errors;

declare
attr_id acs_attributes.attribute_id%TYPE;
begin
  attr_id := acs_attribute.create_attribute (
    object_type    => 'adppage',
    attribute_name => 'URL',
    pretty_name    => 'URL',
    pretty_plural  => 'URLs',
    datatype      => 'string'
  );
end;
/
show errors;

create table adppage (
    page_id    integer references acs_objects(object_id) primary key,
    owner_id  integer references users(user_id),
    url        varchar(255) not null
)

create or replace package sdl-adp
as
  function new (
    page_id            in adppage.page_id%TYPE default null,
    owner_id            in adppage.owner_id%TYPE default null,
    url                in adppage.url%TYPE,
    object_type        in acs_object_types.object_type%TYPE default 'adppage',
    creation_date      in acs_objects.creation_date%TYPE
                          default sysdate,
    creation_user      in acs_objects.creation_user%TYPE
                          default null,
    creation_ip        in acs_objects.creation_ip%TYPE default null,
    context_id          in acs_objects.context_id%TYPE default null
  ) return adppage.page_id%TYPE;

  procedure delete (
    page_id      in adppage.page_id%TYPE
  );
end sdl-adp;
/
show errors

create or replace package body sdl-adp
as

  function new (
    page_id            in adppage.page_id%TYPE default null,
    owner_id            in adppage.owner_id%TYPE default null,
    url                in adppage.url%TYPE,
    object_type        in acs_object_types.object_type%TYPE default 'adppage',
    creation_date      in acs_objects.creation_date%TYPE
                          default sysdate,
    creation_user      in acs_objects.creation_user%TYPE
                          default null,
    creation_ip        in acs_objects.creation_ip%TYPE default null,
    context_id          in acs_objects.context_id%TYPE default null
  ) return adppage.page_id%TYPE
  is
    v_page_id integer;
  begin
    v_page_id := acs_object.new (
      object_id    => page_id,
      object_type  => object_type,
      creation_date => creation_date,
      creation_user => creation_user,
      creation_ip  => creation_ip,
      context_id    => context_id
    );

    insert into adppage
    (page_id, owner_id, url)
    values
    (v_page_id, owner_id, url);

    return v_page_id;
  end new;

  procedure delete (
    page_id      in adppage.page_id%TYPE
  )
  is
  begin
    delete from adppage
    where page_id = adppage.delete.page_id;

    acs_object.delete(page_id);
  end delete;

end sdl-adp;
/
show errors;

and the tcl code that is calling it is

set url_list [list url www.here.com]
set new_id [package_instantiate_object  -package_name sdl-adp -var_list $url_list adppage]

Any help would be greatly appreciated this is the first object that I have created and I am sure I am making some small fundimental mistake.  The basis for my code was the notes example.  Thanks again

  -Trent