postgresql7.1
select site_node__url(node_id) as package_url from site_nodes where object_id = (select package_id from cr_folders where folder_id= (select parent_id from cr_items where latest_revision = :object_id))
select acs_object_type__create_type (
:content_type,
:pretty_name,
:pretty_plural,
'etp_page_revision',
:content_type,
:content_type,
null,
'f',
null,
null
)
select acs_attribute__create_attribute (
:content_type,
:a_name,
:a_datatype,
:a_pretty_name,
:a_pretty_plural,
null,
null,
:a_default,
1,
1,
null,
'generic',
'f'
)
select etp__create_page(
:package_id,
:name,
:title,
:content_type
)
select object_id as package_id
from site_nodes
where node_id = site_node__node_id(:url_stub, null)
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'
) 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'
etp__get_attribute_value(r.revision_id, $attribute_id)
sort_order
i.item_id, i.name, tree_sortkey as sort_order,
to_char(r.publish_date, 'Mon DD, YYYY') as publish_date,
(select object_type from acs_objects
where object_id = i.item_id) as object_type,
etp__get_relative_url(i.item_id, i.name) as url,
etp__get_title(i.item_id, r.title) as title,
etp__get_description(i.item_id, r.description) as description