<?xml version="1.0" encoding="utf-8"?>
<metadata name="Обьекты базы даных">
	<type id="-1">
		<columns><!--Список параметров которые будут взяты из текущего результсета и переданных нижнему уровню-->
		</columns>
		<type n="Cities" d="Города" c="caption" ObjectID="id" id="0">
			<sql-query><![CDATA[select id,caption,icon_id,lon,lat from "Cities" where del='f' and name!='' order by caption]]></sql-query>
			<columns>
				<param n="id"><![CDATA[]]></param>
			</columns>
			<type n="BusinessTypes" d="" c="name" ObjectID="id" id="1">
				<sql-query>
					<![CDATA[
						select
							bt.id,
							${id} as city_id,
							bt.name,
							bt.icon_id
						from
							"BusinessTypes" bt
						where
							bt.del='f'
							and id in(select bt_id from "BusinessSubTypes" where id in (select bst_id from "Business" where del='f' and city_id=${id}))
						order by bt.name
					]]></sql-query>
				<columns>
					<param n="id"><![CDATA[]]></param>
					<param n="city_id"><![CDATA[]]></param>
				</columns>
				<type n="BusinessSubTypes" d="" c="name" ObjectID="id" id="2">
					<sql-query>
						<![CDATA[
							select
								bst.id,
								${city_id} as city_id,
								bst.name,
								bst.icon_id
							from
								"BusinessSubTypes" bst
							where
								bst.del='f'
								and bst.bt_id=${id}
								and bst.id in (select b.bst_id from "Business" b where b.del='f' and b.city_id=${city_id})
							order by bst.name
						]]>
					</sql-query>
					<columns>
						<param n="id"><![CDATA[]]></param>
						<param n="city_id"><![CDATA[]]></param>
					</columns>
					<type n="Business" d="Список рубрик" c="name" ObjectID="id" id="3">
						<sql-query>
							<![CDATA[
								select
									b.id,
									b.name,
									b.icon_id,
									b.city_id,
									b.lon,
									b.lat
								from
									"Business" b
								where
									b.del='f'
									and b.city_id=${city_id}
									and business_id is null
									and bst_id=${id}
								order by b.name
							]]>
						</sql-query>
						<columns>
							<param n="id"><![CDATA[]]></param>
							<param n="city_id"><![CDATA[]]></param>
						</columns>
						<type n="Business" d="Список рубрик" c="name" ObjectID="id" id="4">
							<sql-query>
								<![CDATA[
									select
										b.id,
										b.name,
										b.icon_id,
										b.city_id,
										b.lon,
										b.lat
									from
										"Business" b
									where
										b.del='f'
										and b.city_id=${city_id}
										and business_id=${id}
									order by b.name
								]]>
							</sql-query>
							<columns>
								<param n="id"><![CDATA[]]></param>
								<param n="city_id"><![CDATA[]]></param>
							</columns>
							<goto id="4"/>
						</type>
					</type>
				</type>
			</type>
		</type>
	</type>
</metadata>