Barneyb, Railo only retrieves the result when you actually use a result attribute in the query. If you are not using it then it is not slower. On the other hand the result attribute must already contain the value after the cfquery is executed. This is due to the fact that when retrieving AutoInc numbers a different code needs to be executed, containing data that is only available at query execution time. So even if lazy loading would be superb to have when you have a result attribute, it is not possible to execute the necessary code to fill the GENERATEDKEY field of the result struct.
PS: Your business card almost put me into trouble with my GF :-) Greetings from Switzerland Gert Franz Railo Technologies Professional Open Source skype: gert.franz [email protected] +41 76 5680 231 www.getrailo.com -----Ursprüngliche Nachricht----- Von: Barney Boisvert [mailto:[email protected]] Gesendet: Donnerstag, 1. Oktober 2009 07:36 An: cf-talk Betreff: Re: MySQL Auto Increment Field Just out of curiosity Sean, do you know if the value is lazy loaded, or do you have to pay the cost of retrieving the value on every query (or at least introspecting to determine whether a value is available) regardless? I know you're closest to Railo, but I'm interested in both (all three?) platforms if you've got the info. cheers, barneyb On Wed, Sep 30, 2009 at 10:19 PM, Sean Corfield <[email protected]> wrote: > > On Tue, Sep 29, 2009 at 12:22 PM, Azadi Saryev <[email protected]> wrote: >> if you are on CF8, use RESULT attribute of <cfquery> tag and then get >> GENERATED_KEY from that result: >> <cfquery name="myquery" datasource="..." result="qResult"> >> INSERT ... >> </cfquery> >> <cfset newID = qResult.GENERATED_KEY> > > As an aside, the generated key is placed into a different element of > the result struct for each different database in CF8 (why??!?!) but > that is fixed in CF9 which also adds GENERATEDKEY for *all* DB types > so you can write portable code (assuming you stick to standard SQL of > course and not TSQL - sorry Robert, couldn't resist! :) > > Railo recently implemented this same feature (both adding the various > DB-specific generated key elements as well as the generic GENERATEDKEY > element). I don't know whether Open BlueDragon supports this feature > yet. Anyone? > -- > Sean A Corfield -- (904) 302-SEAN > Railo Technologies US -- http://getrailo.com/ > An Architect's View -- http://corfield.org/ -- Barney Boisvert [email protected] http://www.barneyb.com/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326792 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

