I am struggling b/w two syntaxes of coldfusion. Please, Help..!!
QueryExecute(sql, params, options);
Normal syntax:
sqlEmployees = "SELECT * FROM Employees
WHERE empid = :empid
AND country = :country";
sqlParamsEmployees.empid = { value = 1, cfsqltype = "cf_sql_integer", "null": "yes"};
sqlOptionsEmployees = {dataSource = "#DSN_new#", maxRows = "10", returnType = "json/struct"};
qEmployees = queryExecute(sqlEmployees, sqlParamsEmployees, sqlOptionsEmployees);
Proposed syntax:
sqlEmployees = "SELECT * FROM Employees
WHERE empid = :empid
AND country = :country";
sqlParamsEmployees.empid = {
"value": 1,
"cfsqltype": "cf_sql_integer",
"null": "yes"
};
sqlOptionsEmployees = {
"dataSource": "#newDS#",
"maxRows": "10",
"returnType": "json/struct"
};
qEmployees = queryExecute(sqlEmployees, sqlParamsEmployees, sqlOptionsEmployees);
Can anyone help which is the best and why?
thanks.
i tried both syntaxes buy why should i use one over the other. What is the recommendation and why?