postgresql7.3
SELECT
live_revision
FROM
cr_items
WHERE
item_id = :project_item_id
SELECT
i.item_id
FROM
cr_items i,
cr_revisions r
WHERE
i.item_id = r.item_id and
r.revision_id = :project_id
select status_id
from pm_project_status
where status_type = 'o'
limit 1
select status_id
from pm_project_status
where status_type = 'c'
limit 1
INSERT INTO
pm_task_logger_proj_map
(task_item_id,
logger_entry)
VALUES
(:task_item_id,
:entry_id)
select pm_project__new_project_item (
:project_name,
:project_code,
:parent_id,
:goal,
:description,
:mime_type,
to_timestamp(:planned_start_date,'YYYY MM DD HH24 MI SS'),
to_timestamp(:planned_end_date,'YYYY MM DD HH24 MI SS'),
null,
null,
:logger_project,
:ongoing_p,
:status_id,
:organization_id,
current_timestamp,
:creation_user,
:creation_ip,
:package_id
);
SELECT
i.item_id,
i.content_type
FROM
cr_items i,
pm_tasks_active t
WHERE
i.item_id = t.task_id and
i.parent_id = :project_item_id
select
sum(t.actual_hours_worked) as actual_hours_completed,
sum(t.estimated_hours_work) as estimated_hours_total,
to_char(current_timestamp,'J') as today_j
from
pm_tasks_revisionsx t,
cr_items i,
pm_tasks_active a
where
i.item_id = a.task_id and
t.item_id in ([join $task_list ", "]) and
i.live_revision = t.revision_id
SELECT
case when t.actual_hours_worked is null then 0
else t.actual_hours_worked end as worked,
t.estimated_hours_work as to_work,
t.item_id as my_iid,
to_char(end_date,'J') as task_deadline_j,
to_char(earliest_start,'J') as old_earliest_start_j,
to_char(earliest_finish,'J') as old_earliest_finish_j,
to_char(latest_start,'J') as old_latest_start_j,
to_char(latest_finish,'J') as old_latest_finish_j,
t.percent_complete as my_percent_complete,
s.status_type
from
pm_tasks_revisionsx t,
cr_items i,
pm_tasks_active ti,
pm_task_status s
where
t.item_id in ([join $task_list ", "]) and
i.live_revision = t.revision_id and
i.item_id = ti.task_id and
ti.status = s.status_id
select
d.dependency_id,
d.task_id as task_item_id,
d.parent_task_id,
d.dependency_type
from
pm_task_dependency d
where
d.task_id in ([join $task_list ", "])
select
to_char(planned_start_date,'J') as start_date_j,
to_char(planned_end_date,'J') as end_date_j,
ongoing_p
from
pm_projects
where
project_id = (select live_revision from cr_items where item_id = :project_item_id)
update
pm_projects
set
actual_hours_completed = :actual_hours_completed,
estimated_hours_total = :estimated_hours_total,
earliest_finish_date = :max_earliest_finish,
latest_finish_date = :min_latest_start
where
project_id = (select live_revision from cr_items where item_id = :project_item_id)
select
parent_id
from
cr_items
where
item_id = :my_item_id
select pm_project__get_root_folder (:package_id, 'f')
update
pm_tasks_revisions
set
earliest_start = :es,
earliest_finish = :ef,
latest_start = :ls,
latest_finish = :lf
where
task_revision_id = (select live_revision from cr_items where item_id = :task_item)
SELECT
case when o.name is null then p.title else p.title || ' (' || o.name || ')' end,
p.item_id
FROM pm_projectsx p
LEFT JOIN
organizations o
ON p.customer_id = o.organization_id,
cr_items i,
pm_project_status s
WHERE
p.project_id = i.live_revision and
s.status_id = p.status_id and
s.status_type = 'o'
ORDER BY
lower(p.title), lower(o.name)
SELECT
party_id
FROM
pm_project_assignment
WHERE
project_id = :project_item_id and
party_id = :party_id
LIMIT 1