Skip to content

Instantly share code, notes, and snippets.

@despeset
Created January 22, 2013 02:39
Show Gist options
  • Save despeset/a642878c96b82b21b52c to your computer and use it in GitHub Desktop.
Save despeset/a642878c96b82b21b52c to your computer and use it in GitHub Desktop.
<!--- Build a query of tags --->
<cfset qTags = QueryNew('id,tag') />
<cfset QueryAddRow(qTags, 3) />
<cfset QuerySetCell(qTags, 'id', 1, 1) />
<cfset QuerySetCell(qTags, 'id', 2, 2) />
<cfset QuerySetCell(qTags, 'id', 3, 3) />
<cfset QuerySetCell(qTags, 'tag', 'Kitchen', 1) />
<cfset QuerySetCell(qTags, 'tag', 'Blue', 2) />
<cfset QuerySetCell(qTags, 'tag', 'Happy, smiling', 3) />
<!--- This will only return 1 and 2 --->
<cfquery name="qTest" dbtype="query">
SELECT id FROM qTags
WHERE tag IN (<cfqueryparam CFSQLType="CF_SQL_VARCHAR" value="#ValueList(qTags.tag)#" list="Yes" />)
</cfquery>
<!--- You can see the cause in the dump, the params are wrong. --->
<cfdump var="#qTest#" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment