select case when count(*) = 0 then 0 else 1 end from apm_package_versions
where version_id = :version_id
and enabled_p = 't'
select package_key from apm_package_version_info where version_id = :version_id
select file_id, path
from apm_package_files
where version_id = :version_id
and file_type in ('tcl_procs', 'query_file')
and (db_type is null or db_type = '[db_type]')
order by path
select package_key
from apm_package_version_info
where version_id = :version_id
select v.package_id, p.parameter_name,
case when v.value_id is null then p.default_value else v.attr_value end as attr_value
from apm_parameters p left outer join apm_parameter_values v
using (parameter_id)
where p.package_key = :package_key
select distinct package_key
from apm_package_versions
where enabled_p='t'
select distinct package_key
from apm_package_versions
where enabled_p='t'
select distinct package_key
from apm_package_versions
where enabled_p='t'
select pretty_name
from apm_package_file_types
where file_type_key = :type
select pretty_db_name
from apm_package_db_types
where db_type_key = :db_type
select parameter_name from apm_parameters
where package_key = :package_key
select 1 from apm_package_types
where package_key = :package_key
select 1 from apm_package_versions
where package_key = :package_key
and installed_p = 't'
select 1 from apm_package_versions
where version_id = :version_id
and installed_p = 't'
update apm_parameters
set parameter_name = :parameter_name,
default_value = :default_value,
datatype = :datatype,
description = :description,
section_name = :section_name,
min_n_values = :min_n_values,
max_n_values = :max_n_values
where parameter_id = :parameter_id
select package_id, parameter_id, parameter_name
from apm_packages p, apm_parameters ap
where p.package_key = ap.package_key
and ap.parameter_id = :parameter_id
select package_key from apm_packages where package_id = :package_id
select package_id from apm_packages where package_key = :package_key
select pretty_name, version_name, package_key, installed_p, distribution_uri, tagged_p
from apm_package_version_info where version_id = :version_id
select parameter_name, attr_value
from apm_parameters p, apm_parameter_values v, apm_packages a
where p.parameter_id = v.parameter_id
and a.package_id = v.package_id
and a.package_id = :package_id