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
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
item_id,
content_type
from
cr_items
where 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
where
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 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)