Created
July 2, 2025 17:40
-
-
Save trycf/0686e95c2ca567edcae71450394b90cd to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 | |
, 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