Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/0686e95c2ca567edcae71450394b90cd to your computer and use it in GitHub Desktop.
Save trycf/0686e95c2ca567edcae71450394b90cd to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
// Simulate incoming arguments
arguments.userID = 101;
// Simulate Query
users = queryNew(
"User_ID,UserName,email,updated_at",
"integer,varchar,varchar,varchar"
);
// Add a row to the query
queryAddRow(users);
querySetCell(users, "User_ID", 101);
querySetCell(users, "UserName", "johndoe");
querySetCell(users, "email", "[email protected]");
querySetCell(users, "updated_at", "232432423");
qryUser = queryExecute("
SELECT user_id
, username
, email
, updated_at
FROM users
WHERE user_id = :userID
",
{
userID: { value: arguments.userID, cfsqltype: "cf_sql_integer" }
}, { dbtype: "query" });
users1 = [];
qryUser.each(function(row) {
userInfo = {};
userInfo.userID = row.user_id;
userInfo.username = row.username;
userInfo.email = row.email;
userInfo.lastUpdated = row.updated_at;
users1.append(userInfo);
});
dump(users1);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment