Forum OpenACS CMS: Re: Figuring out CMS

Collapse
5: Re: Figuring out CMS (response to 1)
Posted by Adrian Byng-Clarke on
Thank you very much. This is quite simple really - but of course this is not in the CMS doc. I just assumed that everything was done through the UI. I suppose that this is more related to how OACS does templating. Very confusing compared with ACS 3.x . But more useful/flexible I suppose.

I'm have another error in trying to relate 2 different content items together via a relationship. I followed the following steps:

- went to the content type page for my custom content type (research_topic).
- on the relation types page, I registered a new item relationship type. I want to relate (research_topic) to (research_topic), with the relation tag (child_topic).
- i put one research_topic item on the clipboard
then I went into another topic item and the add related items page.
- on the following page (Type:Item Relationship, Topic: child_topic)hit next and then got the error below

I think that I'm probably missing a step but I can't figure out where.

Request Error
ora8.c:3908:ora_tcl_command: error in `OCIStmtExecute ()': ORA-00904: invalid column name

SQL:

        select
      !>>>!coalesce(max(order_n) + 1, 1)
    from
      cr_item_rels
    where
      item_id = :item_id


    while executing
"ns_ora 0or1row nsdb0 {

        select
      coalesce(max(order_n) + 1, 1)
    from
      cr_item_rels
    where
      item_id = :item_id

      }"
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_ora $type $db $sql] $args"
    invoked from within
"db_exec 0or1row $db $full_name $sql"
    invoked from within
"set selection [db_exec 0or1row $db $full_name $sql]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle db {
    set selection [db_exec 0or1row $db $full_name $sql]
    }"
    (procedure "db_string" line 7)
    invoked from within
"db_string get_order """
    ("for" body line 9)
    invoked from within
"for { set i 1 } { $i <= ${rel_attrs:rowcount} } {incr i} {
          upvar 0 "rel_attrs:$i" row
          template::util::array_to_vars row

        ..."
    ("uplevel" body line 5)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 1)
    invoked from within
"db_transaction {

      unset row

      for { set i 1 } { $i <= ${rel_attrs:rowcount} } {incr i} {
          upvar 0 "rel_attrs:$i" row
          te..."
    invoked from within
"if { [form is_valid rel_form_2] || $form_complete } {

  # sort order_n for all related items for consistency
  form get_values rel_form_2 item_id
..."
    ("uplevel" body line 97)
    invoked from within
"uplevel {
          # Step 2 in the relate item wizard - presents a custom form
# for each relation

request create -params {
  item_id    -datatype int..."
    (procedure "code::tcl::/web/drrdemo/packages/cms/www/modules/items/relat..." line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare "
    (procedure "template::adp_parse" line 30)
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 7)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    $handler
      } ad_script_abort val {
    # do nothing
      }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    rp_serve_abstract_file "$root/$path"
    set tcl_url2file([ad_conn url]) [ad_conn file]
    set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."

Collapse
6: Re: Figuring out CMS (response to 5)
Posted by Robert Gaszewski on

I repeated your steps and in my case everything works OK but I tested it with PostgreSQL version of OACS. I don't have any Oracle installation so I can't test it with Oracle.

But it looks that you have problems (ORA-00904: invalid column name) with following sql code:
select
 coalesce(max(order_n) + 1, 1)
from
 cr_item_rels
where
 item_id = :item_id


My results from psql (PostgreSQL interactive terminal) session:


openacs-4-6-2=# select * from cr_item_rels;
rel_id | item_id | related_object_id | relation_tag | order_n
--------+-----------+---------------------+----------------+-----------
429 | 417 | 344 | child_topic | 0
453 | 417 | 432 | child_topic | 1
(2 rows)

openacs-4-6-2=# select coalesce(max(order_n)+1,1) from cr_item_rels where item_id = 417;
case
------
2
(1 row)


IMO You should type following sql code in sqlplus terminal:
select * from cr_item_rels
and
select coalesce(max(order_n)+1,1) from cr_item_rels where item_id = your_item_id and look what you get.

Unfortunately I can't help you more with this problem because I have only little experience with Oracle.