[Freeswitch-users] dbh:query - insert id

Michael Jerris mike at jerris.com
Tue May 28 16:30:36 MSD 2013


This sort of snark is totally uncalled for on the mailing list.  If you can't be thankful for the people helping you for free, maybe its best you go find help elsewhere.

Mike

On May 25, 2013, at 4:01 AM, John M <j_mj at aol.com> wrote:

> Hi Daniel,
> 
> Thanks for your description, it is much appreciated. :-)
> 
> 5 word one liners from people too lazy to explain properly would really be best if they didn't reply at all.
> 
> Cheers, thanks again.
> 
> -Jm
> 
> 
> 
> -----Original Message-----
> From: Daniel Ivanov <sertys at gmail.com>
> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> Sent: Sat, May 25, 2013 5:57 pm
> Subject: Re: [Freeswitch-users] dbh:query - insert id
> 
> It is true that the luasql driver is overly basic and poorly documented . Unfortunately mysql doesn't support RETURNING clause like pgsql and oracle. You should however try SELECT LAST_INSERT_ID(); right after the insert query. I cannot guarantee it works due to the unknown nature(to me that is) of the luasql transaction handling, but it should keep a transaction open for as long as a db handler lives.
> On May 25, 2013 7:03 AM, "John M" <j_mj at aol.com> wrote:
> Hi Seven Du,
> 
> I'd really like to know if this is possible too, couldn't find it documented anywhere.
> 
> Instead of being cryptic, if you know the answer won't you please help by explaining what the RETURNING clause is and how to use it?
> 
> Does it somehow return mysql_insert_id()?
> 
> How should we use it.
> 
> You help is invaluable and is contributing to the freeswitch community.
> 
> -Jm
> 
> 
> -----Original Message-----
> From: Seven Du <dujinfang at gmail.com>
> To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
> Sent: Sat, May 25, 2013 12:52 pm
> Subject: Re: [Freeswitch-users] dbh:query - insert id
> 
> Maybe try the RETURNING clause ?
> 
> -- 
> Seven Du
> http://www.freeswitch.org.cn
> http://about.me/dujinfang
> http://www.dujinfang.com
> 
> Sent with Sparrow
> 
> On Saturday, May 25, 2013 at 8:14 AM, Lloyd Aloysius wrote:
>> Hello All
>> 
>> How to get the id value after insert a record a record using dbh:query
>> 
>> table_a - columns.
>> 
>> id - auto increment
>> field1
>> field2
>> 
>> 
>> dbh:query("insert into table_a ( field1,field2) values ('11','Test')")
>> 
>> 
>> After insert how to get the table_a - id value for the inserted record?
>> 
>> Thanks
>> Lloyd
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> 
>> 
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>> 
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130528/a5f9bd93/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list