<%cffunction name="find#root.bean.xmlAttributes.name#s" access="public" returntype="query" %> <%cfargument name="#root.bean.dbTable.xmlChildren[i].xmlAttributes.name#" type="#root.bean.dbTable.xmlChildren[i].xmlAttributes.type#" required="false" default=""%> <%cfargument name="startRow" required="false" type="string" default="1" hint="The row offset"%> <%cfargument name="maxRows" required="false" type="string" default="0" hint="The max rows to retrieve"%> <%cfset var qSelect#root.bean.xmlAttributes.name# = '' %> <%cfquery name="qSelect#root.bean.xmlAttributes.name#" datasource="{dsn}"%> <%cfif %arguments.maxRows% GT 0%> SELECT TOP %arguments.maxRows% * FROM #root.bean.xmlAttributes.name# T1 WHERE T1.#primaryKey# <%cfif %arguments.startRow% gt 1%> NOT <%/cfif%> IN ( <%/cfif%> SELECT <%cfif %arguments.maxRows% gt 0%> TOP <%cfif %arguments.startRow% gt (%arguments.maxRows%*2)%> %arguments.startRow +%arguments.maxRows% <%cfelse%> %arguments.maxRows% <%/cfif%> s1.#primaryKey# <%cfelse%> s1.* <%/cfif%> FROM #root.bean.xmlAttributes.name# s1 WHERE 1=1 AND #root.bean.dbtable.xmlChildren[i].xmlAttributes.name#= <%cfqueryparam value="%arguments.#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#%" CFSQLType="#root.bean.dbtable.xmlChildren[i].xmlAttributes.cfSqlType#" null="%not len(arguments.#root.bean.xmlAttributes.name#.get#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#())%" /%>, <%cfif arguments.maxRows GT 0%> ) AND #root.bean.dbtable.xmlChildren[i].xmlAttributes.name#= <%cfqueryparam value="%arguments.#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#%" CFSQLType="#root.bean.dbtable.xmlChildren[i].xmlAttributes.cfSqlType#" null="%not len(arguments.#root.bean.xmlAttributes.name#.get#root.bean.dbtable.xmlChildren[i].xmlAttributes.name#())%" /%>, <%/cfif%> <%/cfquery%> <%cfreturn qSelect#root.bean.xmlAttributes.name#%> <%/cffunction%>