<cfsilent>
	<cfif thisTag.executionMode IS "end">
		<cfassociate basetag="cf_del" datacollection="dependencies" />
		
		<!--- following are tag attribute placeholders. Coorresponding data are used by parent tags!--->
		<cfparam name="ATTRIBUTES.entity" default=""/>
		<cfparam name="ATTRIBUTES.title" default=""/>
		<cfparam name="ATTRIBUTES.page" default="#ATTRIBUTES.entity#.cfm"/>
		<cfparam name="ATTRIBUTES.delete_page" default="#ATTRIBUTES.entity#_del.cfm"/>	
		<cfparam name="ATTRIBUTES.showDetails" type="boolean" default="Yes"/>	
		<cfparam name="ATTRIBUTES.denyMessage" type="string" default="Необходимо удалить соответствующие записи"/><!--- displayed instead of details when ATTRIBUTES.showDetails IS "No"--->
		<!---<cfparam name="ATTRIBUTES.ondelete" default="restrict"/>  implement 1-level Cascade? --->		
		
		<cfparam name="thisTag.fields" type="array"/>
		<cfparam name="thisTag.from" type="array"/>
		<cfparam name="thisTag.conditions" type="array"/>
		<cfparam name="thisTag.order_by" type="array"/>
		
		<cfset ATTRIBUTES.fields=thisTag.fields/>
		<cfset ATTRIBUTES.keys=arrayNew(1)/>	

		<cfset i=0/>
		<cfloop array=#thisTag.fields# index="field">
			<cfif len(field.name)> 
				<cfif structKeyExists(field, "key")>
					<cfset arrayAppend(ATTRIBUTES.keys, #field.name#)/>
				</cfif>
			</cfif>
		</cfloop>
	
		<cfquery name="qDependency" datasource="#request.DS#">
			select 
			<cfset i = 0 />
			<cfloop array=#thisTag.fields# index="field">
				<cfif i GT 0>, </cfif><cfset i = i+1/>#field.expression#
			</cfloop>
			from
			<cfloop array=#thisTag.from# index="from">
				#from.expression#
			</cfloop>
			where 
			<cfset i = 0 />
			<cfloop array=#thisTag.conditions# index="condition">
				<cfif i GT 0> AND </cfif><cfset i = i+1/>
				#condition.expression#=<cfqueryparam cfsqltype='#condition.cfsqltype#' value='#condition.value#' null='#condition.null#'/>				
			</cfloop>
			order by
			<cfset i = 0 />
			<cfloop array=#thisTag.order_by# index="order">
				<cfif i GT 0>, </cfif><cfset i = i+1/>#order.expression#
			</cfloop>
		</cfquery>		
		<cfset ATTRIBUTES.query=#qDependency#/>
	</cfif>
	<cfset thisTag.generatedContent=""/>
</cfsilent>
