select bug_id from bt_bugs
where bug_number = :bug_number
and project_id = :project_id
update apm_packages
set instance_name = :project_name
where package_id = :package_id
select count(*) from bt_user_prefs where project_id = :package_id and user_id = :user_id
insert into bt_user_prefs (user_id, project_id) values (:user_id, :package_id)
select version_name, version_id from bt_versions where project_id = :package_id order by version_name
select component_name, component_id from bt_components where project_id = :package_id order by component_name
select component_id, url_name from bt_components where project_id = :package_id
insert into bt_patch_bug_map (patch_id, bug_id) values (:patch_id, :bug_id)
delete from bt_patch_bug_map
where bug_id = (select bug_id from bt_bugs
where bug_number = :bug_number
and project_id = :package_id)
and patch_id = (select patch_id from bt_patches
where patch_number = :patch_number
and project_id = :package_id)
select b.bug_number,
b.summary
from bt_bugs b, bt_patch_bug_map bpbm
where b.bug_id = bpbm.bug_id
and bpbm.patch_id = (select patch_id
from bt_patches
where patch_number = :patch_number
and project_id = :package_id
)
$open_clause
select bt_patches.patch_number,
bt_patches.summary,
bt_patches.status
from bt_patch_bug_map, bt_patches
where bt_patch_bug_map.bug_id = :bug_id
and bt_patch_bug_map.patch_id = bt_patches.patch_id
$status_where_clause
select acs_objects.creation_user
from bt_patches, acs_objects
where bt_patches.patch_number = :patch_number
and bt_patches.project_id = :package_id
and bt_patches.patch_id = acs_objects.object_id
update bt_patches
set status = :new_status
where bt_patches.project_id = :package_id
and bt_patches.patch_number = :patch_number
select child.keyword_id as child_id,
child.heading as child_heading,
parent.keyword_id as parent_id,
parent.heading as parent_heading
from bt_projects p,
cr_keywords parent,
cr_keywords child
where p.project_id = :package_id
and parent.parent_id = p.root_keyword_id
and child.parent_id = parent.keyword_id
order by parent.heading, child.heading
update cr_items
set live_revision = null, latest_revision = null
where parent_id = :folder_id
select min(bug_id)
from bt_bugs
where project_id = :project_id