item::get_revision_content (public, deprecated)

 item::get_revision_content revision_id [ args... ]

Defined in packages/acs-content-repository/tcl/deprecated-procs.tcl

Deprecated. Invoking this procedure generates a warning.

Parameters:
revision_id (required)
The revision whose attributes are to be retrieved
Options:
-item_id
{default auto-generated} The item_id of the corresponding item.
Returns:
1 on success (and create a content array in the calling frame), 0 on failure
See Also:

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc item::get_revision_content

  template::util::get_opts $args

  if { ![info exists opts(item_id)] } {
    # Get the item id
    set item_id [::content::revision::item_id -revision_id $revision_id]

    if { [template::util::is_nil item_id] } {
      ns_log warning "item::get_revision_content: No such revision: $revision_id"
      return 0
    }
  } else {
    set item_id $opts(item_id)
  }

  # Get the mime type, decide if we want the text
  content::item::get -item_id $item_id -array_name item_info

  if { [info exists item_info(mime_type)]
       && $item_info(mime_type) ne ""
       && [string match "text/*" $item_info(mime_type)]
   } {
      set text_sql [db_map grc_get_all_content_1]
  } else {
      set text_sql ""
  }

  # Get the content type
  set content_type $item_info(content_type)

  # Get the table name
  set table_name [db_string grc_get_table_names ""]

  upvar content content

  # Get (all) the content (note this is really dependent on file type)
  db_0or1row grc_get_all_content "" -column_array content

  if { ![array exists content] } {
    ns_log warning "item::get_revision_content: No data found for item $item_id, revision $revision_id"
    return 0
  }

  return 1
Generic XQL file:
<fullquery name="item::get_revision_content.grc_get_table_names">
    <querytext>
      
    select table_name from acs_object_types 
    where object_type = :content_type
  
      </querytext>
</fullquery>

<fullquery name="item::get_revision_content.grc_get_all_content">
    <querytext>
      select 
    x.*, 
    :item_id as item_id $text_sql, 
    :content_type as content_type
  from
    cr_revisions r, ${table_name}x x
  where
    r.revision_id = :revision_id
  and 
    x.revision_id = r.revision_id
  
      </querytext>
</fullquery>
packages/acs-content-repository/tcl/deprecated-procs.xql

PostgreSQL XQL file:
<fullquery name="item::get_revision_content.grc_get_all_content_1">
    <querytext>

	, content as text

	</querytext>
</fullquery>
packages/acs-content-repository/tcl/deprecated-procs-postgresql.xql

Oracle XQL file:
<fullquery name="item::get_revision_content.grc_get_all_content_1">
    <querytext>

	, content.blob_to_string(content) as text

	</querytext>
</fullquery>
packages/acs-content-repository/tcl/deprecated-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: