20 views
Skip to first unread message

Andrew Dixon

unread,
Feb 12, 2017, 6:11:52 PM2/12/17
to lu...@googlegroups.com
Hi All,

If I have a query like this in a function:

    return queryExecute("
        INSERT 
            INTO myTable
            SET colName = :colValue
        ",
        {
            colValue = {
                value = arguments.colValue,
                sqltype = 'string'
            }
        }
    );

Is there a way to return the `generated_key` value… I’ve tried adding `.GENERATED_KEY` at the end of the queryExecute but it just complains the column doesn't exist, which is fair enough… If I add a `result = 'myVar'` and remove the `return` and then `return myVar.GENERATED_KEY` that works fine… just trying to be clean and have a single call.

Thanks.

Kind regards,

Andrew

Nando Breiter

unread,
Feb 12, 2017, 6:47:44 PM2/12/17
to lu...@googlegroups.com
Andrew,

I tried this to see if it would chain:

s = {};
WriteDump( s.insert( 'hello','there' ).hello );

And it does on Lucee 5, but not on ACF 11, (however the structInsert() version errors on both).

Reminds me of method chaining in jQuery. Have you ever done this elsewhere in CFML? 




Aria Media Sagl
+41 (0)76 303 4477 cell
skype: ariamedia

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAG1WijURCfRDLGpqYv1hU-CqL4S7D83W%3DmOCqPs41mOSw2W1vQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages