Skip to content

Instantly share code, notes, and snippets.

@cameroncf
Created June 13, 2014 15:39
Show Gist options
  • Save cameroncf/d0786acf48ce377d2dd8 to your computer and use it in GitHub Desktop.
Save cameroncf/d0786acf48ce377d2dd8 to your computer and use it in GitHub Desktop.
<cffunction access="public" name="qry_ordersGet" output="no" returntype="query">
<cfargument name="orderKeyList" type="string" required="no" default="">
<cfargument name="personKeyList" type="string" required="no" default="">
<cftry>
<cfquery
name="qry_ordersGet"
datasource="#variables.datasource#">
SELECT o.tablePK
,o.tblPeopleFK
,o.createdOn
,o.shippingMethod
,o.itemSubTotal
,o.totalBeforeTax
,o.tax
,o.shippingCost
,o.total
,p.firstName + ' ' + p.lastName AS name
FROM #request.sqlObjectPrefix#tblOrders o
INNER JOIN #request.sqlObjectPrefix#tblPeople p
ON o.tblPeopleFK = p.tablePK
WHERE 1 = 1
<cfif len(arguments.orderKeyList)>
AND o.tablePK = <cfqueryparam value="#arguments.orderKeyList#" cfsqltype="CF_SQL_INTEGER" list="Yes">
</cfif>
<cfif len(arguments.personKeyList)>
AND o.tblPeopleFK = <cfqueryparam value="#arguments.personKeyList#" cfsqltype="CF_SQL_INTEGER" list="Yes">
</cfif>
</cfquery>
<cfcatch>
<cfdump var="#arguments#" />
<cfdump var="#cfcatch.sql#" abort="true" />
</cfcatch>
</cftry>
<cfreturn qry_ordersGet />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment