Try this bugalicious little duplicate() test case... spent me last bit of sanity trying to chase down this little bugger so i thought i'd share the "strap me down on a fast growing bamboo shoot" pain.
Everything thing appears peachy until somewhere in the bowels of your ColdFusion application you try and duplicate(). **sigh** Feels good to have nailed this brain bender -- time for some hard liquor.
Couple of folks have pinged me asking what's this all about. Its nothing serious just an interesting little gotcha. Run the code and it makes much more sense.
We're building a structure dynamically from a query result. If you build it with one syntax you end up with a struct that simply doesn't work with duplicate() I think it has to do with the age old assumption in CF that if you reference a recordset variable without indicating the row number it defaults to the first record. I seems that q[key] isn't aware of the default and tries to duplicate the entire recordset column structure instead of just the first value. It shouldn't surprise you that you can add an array notation to the end of q[key] and get a working structure once more.
Posted by modius at 12:34 AM | Permalink