<?xml version="1.0"?>
<queryset>


    <fullquery name="classified-ads::get_main_keyword_id.get_main_keyword">
        <querytext>
    
            select keyword_id
            from cr_keywords
            where heading = :heading and
                  description = :description

        </querytext>
    </fullquery>


    <fullquery name="classified-ads::root_folder_exists_p.get_root_folder">
        <querytext>
    
            select folder_id
            from cr_folders f, cr_items i
            where i.name = :name and
                  f.label = :label and
                  f.description = :description

        </querytext>
    </fullquery>


    <fullquery name="classified-ads::get_mounted_packages.select_packages">
        <querytext>
    
            select a.package_id
            from apm_packages a,
                 site_nodes s
            where package_key = :package_key and
                  a.package_id = s.object_id

        </querytext>
    </fullquery>


    <fullquery name="classified-ads::get_table_name.select_table_name">
        <querytext>

              select table_name
              from acs_object_types
              where object_type = :content_type

        </querytext>
    </fullquery>


    <fullquery name="classified-ads::get_attribute_names.select_names">
        <querytext>

            select coalesce(aa.column_name, aa.attribute_name) as column_name,
                   aa.datatype
	        from acs_attributes aa,
                 ca_attributes ca,
                 acs_object_types at
            where aa.attribute_id = ca.attribute_id and
                  (ca.package_id = :package_id or
                   ca.sitewide_p = 't') and
                  aa.object_type = :content_type and
                  at.object_type = :content_type
            $storage_stub

        </querytext>
    </fullquery>


    <fullquery name="classified-ads::get_attribute_values.select_values">
        <querytext>

            $query_string

        </querytext>
    </fullquery>


    <fullquery name="classified-ads::get_supertype.select_supertype">
        <querytext>

            select supertype
            from acs_object_types
            where object_type = :content_type

        </querytext>
    </fullquery>

    <fullquery name="classified-ads::install_sitewide_attributes.count_attributes">
        <querytext>

            SELECT COUNT(*)
	      FROM acs_attributes
	     WHERE object_type = 'ca_ad'
	       AND attribute_name = :attrib 

        </querytext>
    </fullquery>

</queryset>