Skip to content

Update cfparam.json #1695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions data/en/cfparam.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
"code": "param someVar; //declare the param\nparam someVar=5; //declare the param with a default value\nparam numeric someVar=3.1415; //declare the param with adefault value and set the type",
"result": "",
"runnable": true
},
{
"title": "cfparam using type=\"query\"",
"description": "How to use cfparam with a query object.",
"code": "<!--- Ensure the query object exists --->\n<cfparam name=\"variables.myQuery\" default=\"\">\n\n<!--- Check if the variable is a query object --->\n<cfif NOT isQuery(variables.myQuery)>\n <!--- Create a new query object with the required structure --->\n <cfset variables.myQuery = queryNew(\"id,name,age\", \"integer,varchar,varchar\")>\n\n <!--- Add rows to the query --->\n <cfset queryAddRow(variables.myQuery, 2)> <!-- Add 2 rows -->\n\n <!--- Populate the rows with data --->\n <cfset querySetCell(variables.myQuery, \"id\", 1, 1)>\n <cfset querySetCell(variables.myQuery, \"name\", \"John Doe\", 1)>\n <cfset querySetCell(variables.myQuery, \"age\", \"30\", 1)>\n\n <cfset querySetCell(variables.myQuery, \"id\", 2, 2)>\n <cfset querySetCell(variables.myQuery, \"name\", \"Jane Smith\", 2)>\n <cfset querySetCell(variables.myQuery, \"age\", \"25\", 2)>\n</cfif>\n\n<!--- Output the query for debugging purposes --->\n<cfdump var=\"#variables.myQuery#\" label=\"Query Object\">",
"result": "",
"runnable": false
}
]
}