select 1 from acs_object_types
where object_type = :content_type
select attribute_id from acs_attributes
where object_type = :content_type
and attribute_name = :a_name
select 1 from cr_items
where parent_id = etp_get_folder_id(:package_id)
and name = :name
select i.item_id, i.name, r.revision_id, r.title,
r.description, r.publish_date, r.content $extended_attributes
from cr_items i, cr_revisions r
where i.parent_id = etp_get_folder_id(:package_id)
and i.name = :name
and i.item_id = r.item_id
and r.revision_id = i.live_revision
select i.item_id, i.name, r.revision_id, r.title,
r.description, r.publish_date, r.content $extended_attributes
from cr_items i, cr_revisions r
where i.parent_id = etp_get_folder_id(:package_id)
and i.name = :name
and i.item_id = r.item_id
and r.revision_id = :revision_id
select max(revision_id) as revision_id
from cr_revisions r, cr_items i
where i.parent_id = etp_get_folder_id(:package_id)
and i.name = :name
and i.item_id = r.item_id
select live_revision as revision_id
from cr_items i
where i.parent_id = etp_get_folder_id(:package_id)
and i.name = :name
select * from (
select $columns
from cr_items i
left join
cr_revisions r
on (i.live_revision = r.revision_id)
where i.parent_id = etp_get_folder_id(:package_id)
and i.name != 'index'
) as attributes
where $extra_where_clauses
order by $orderby
$limit_clause
select child.name, child.node_id, child.object_id as package_id,
etp_package_title(child.object_id) as title,
etp_package_description(child.object_id) as description
from site_nodes parent, site_nodes child, apm_packages p
where parent.object_id = :package_id
and child.parent_id = parent.node_id
and child.object_id = p.package_id
and p.package_key = 'edit-this-page'