I have some downtime @ cf.Objective() at the mo', so looking at some of the stuff Gert showed us in his presentation. It's that or have a beer... but it's perhaps slightly too early for that. Maybe... hmmm. Anyway, whilst I mull over having a beer, I have this article in my head, so I'll type it in.
Railo has a new function queryColumnData(). This is kind of an augmentation of valueArray(). valueArray() is a function I was unaware Railo had... it's an array equivalent of valueList(). I think returning an array is better than a list, so this is good stuff too.
Anyway, queryColumnData() works like this:
array queryColumnData(Query, column [, callback])
So one can either just specify the query and the column to return as an array, or one can pass-in a callback to, and this is called on each row value in the column before being appended to the resultant array. EG:
q = queryNew("");
queryAddColumn(q, "id", "Integer", [1,2,3,4]);
queryAddColumn(q, "en", "VarChar" , ["one", "two", "three", "four"]);
queryAddColumn(q, "ma", "VarChar" , ["tahi", "rua", "toru", "wha"]);
ids = valueArray(q.id);
english = queryColumnData(q, "en");
maori = queryColumnData(q, "ma", function(v){
return ucase(v);
});
dump([ids,english,maori]);
Result:
Array | ||||||||||||||||||||
1 |
| |||||||||||||||||||
2 |
| |||||||||||||||||||
3 |
|
I like the idea of adding more callback functionality in the language. Nice one!
Anyway... I have a session to go to now. And then a beer.
--
Adam