Skip to content

Instantly share code, notes, and snippets.

<cfscript>
/* Put this in the Setup Tab */
myTable = queryNew("fruit,color","Integer,Varchar",[ ["apples","green"], ["banannas","yellow"], ["grapes","purple"] ]);
/****************************/
/* Put this in the Default Tab */
writeDump(myTable);
local.svc = new query(
sql = "SELECT * FROM myTable",
<cfscript>
arrayTest = [['a','b','c'],['d','e','f']];
writeDump(arrayTest);
// same as
arrayTest2 = arrayNew(2);
arrayTest2[1][1] = 'a';
arrayTest2[1][2] = 'b';
arrayTest2[1][3] = 'c';
arrayTest2[2][1] = 'd';
arrayTest2[2][2] = 'e';
@abramadams
abramadams / structPassByValueOfReference.cfm
Last active January 1, 2016 23:28
Here's a demonstration of how ColdFusion doesn't actually pass things by reference. (derived from http://cfmlblog.adamcameron.me/2012/08/complex-data-types-in-cf-and-how-theyre.html)
<cfscript>
st1 = {
one = "Tahi",
two = "Rua",
three = "Toru",
four = "Wha"
};
st2 = f(st1);