Re: cfquery result="resultInfo"
This is the syntax for doing it with an array of structures: SELECT * FROM Tablename What would be the syntax for using a structure of structures? > > Q: What's the best way to return two structures from a function? > > Should I return an array of structures or can I return the > resultInfo in one of the arguments > > from the calling program? > > Well, strictly speaking, if you set the value of something within the > calling program that's not returning a value. You'll want to return a > single value, which could be an array or a structure. It really > doesn't matter which you do. I'd probably return a structure with > both, if I wanted to return both, so that I could then refer to the > contents of that structure by name instead of by position. Arrays are > generally used to hold a bunch of items of the same type, although CF > doesn't force you to only put items of one type within an array as > many other languages do. > > Gerald's point about returning arrays of structures is useful if > you're going to interact with non-CF systems, but those systems won't > be able to consume a query object anyway, so that's not too important > in this case. If you wanted to write a service which could be > consumed > by other platforms, you'd have to return the query itself as an array > of structures. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > > Fig Leaf Software provides the highest caliber vendor-authorized > instruction at our training centers in Washington DC, Atlanta, > Chicago, Baltimore, Northern Virginia, or on-site at your location. > Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320721 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cfquery result="resultInfo"
> Q: What's the best way to return two structures from a function? > Should I return an array of structures or can I return the resultInfo in one > of the arguments > from the calling program? Well, strictly speaking, if you set the value of something within the calling program that's not returning a value. You'll want to return a single value, which could be an array or a structure. It really doesn't matter which you do. I'd probably return a structure with both, if I wanted to return both, so that I could then refer to the contents of that structure by name instead of by position. Arrays are generally used to hold a bunch of items of the same type, although CF doesn't force you to only put items of one type within an array as many other languages do. Gerald's point about returning arrays of structures is useful if you're going to interact with non-CF systems, but those systems won't be able to consume a query object anyway, so that's not too important in this case. If you wanted to write a service which could be consumed by other platforms, you'd have to return the query itself as an array of structures. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320695 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cfquery result="resultInfo"
>>and have already picked up a nugget. A tasty one at that. Thanx for sharing. >>Should I return an array of structures I would say yes. From what I have been reading, arrays of structures is the standard way to exchange data between platforms (Think web services). If you do it that way (arrays of structures) systems using Java, .NET, PHP etc.will be able to call the CFC as a web service if the need ever arises. G! On Thu, Mar 19, 2009 at 10:23 AM, Phillip Senn wrote: > > I am reading the cfcurriculum at > http://www.adobe.com/education/instruction/teach/cfcurriculum.html > and have already picked up a nugget. > > I didn't realize that cfquery returned two results, the name= attribute and > the result= attribute. > I've always just returned the query in my functions, but now I'm > considering returning both the query and the result info. > > Q: What's the best way to return two structures from a function? > Should I return an array of structures or can I return the resultInfo in > one of the arguments from the calling program? > > > > ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320693 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
cfquery result="resultInfo"
I am reading the cfcurriculum at http://www.adobe.com/education/instruction/teach/cfcurriculum.html and have already picked up a nugget. I didn't realize that cfquery returned two results, the name= attribute and the result= attribute. I've always just returned the query in my functions, but now I'm considering returning both the query and the result info. Q: What's the best way to return two structures from a function? Should I return an array of structures or can I return the resultInfo in one of the arguments from the calling program? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320691 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4