[Freeswitch-users] dbh:query - insert id

John M j_mj at aol.com
Sat May 25 18:23:27 MSD 2013


Yep, super helpful..  /sarcasm

Point us to general sql related pages, none of which are related to freeswitch and the way the language interacts with the db ..

We all know that insert_id exists that's why we are asking. What we don't know is how specifically the freeswitch:dbh handler interacts and can return the inserted record id.

 

 

-----Original Message-----
From: William King <william.king at quentustech.com>
To: freeswitch-users <freeswitch-users at lists.freeswitch.org>
Sent: Sat, May 25, 2013 11:24 pm
Subject: Re: [Freeswitch-users] dbh:query - insert id


http://lmgtfy.com/?q=sql+returning+clause

http://en.wikipedia.org/wiki/Insert_%28SQL%29#Retrieving_the_key

http://www.postgresql.org/docs/9.2/static/sql-insert.html

Much less useful unless you have no other choice than to use mysql:
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_last-insert-id

William King
Senior Engineer
Quentus Technologies, INC
1037 NE 65th St Suite 273
Seattle, WA 98115
Main:   (877) 211-9337
Office: (206) 388-4772
Cell:   (253) 686-5518
william.king at quentustech.com

On 05/24/2013 08:59 PM, John M 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 <http://www.sparrowmailapp.com/?sig>
> 
> 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 <mailto: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
>> <mailto: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 <mailto: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 <mailto: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/20130525/5c52550a/attachment.html 


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