Created
July 2, 2025 16:44
-
-
Save trycf/793ecc53b0d2af03d3a8d04d3c90a019 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 = 1; | |
user_id = 1; | |
// 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 = []; | |
queryUser.forEach(function(row) { | |
userInfo = {}; | |
userInfo.userID = user_id; | |
userInfo.username = username; | |
userInfo.email = email; | |
userInfo.lastUpdated = 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