[Freeswitch-users] dbh:query - insert id

Nathan Neulinger nneul at mst.edu
Sat May 25 19:29:54 MSD 2013


Looking at the code, I'm not seeing anything that would do this. Affected rows is directly implemented as part of ODBC, 
that's why it's easily available.


You could probably do a subsequent select on last_insert_id(), but there is a high risk of race condition - some other 
thread could use the dbh driver in the intervening time.

I don't believe that the last insert id is returned automatically on any of the mysql api (underlying calls not FS) 
calls, and then you have the odbc layer on top of that.

The way I've seen some other packages do it is to implement a mysql specific sql execute call that runs the statement, 
and then immediately runs a select last_insert_id() and returns it.

-- Nathan

On 05/25/2013 10:01 AM, Lloyd Aloysius wrote:
> William,
>
> Thank you for the reply. Question was related to freeswitch dbh driver. Not related to sql specific.
>
> Most of the SQL Driver have a method to get the id after the insert record. My questions was does freeswitch dbh have
> any method to get the id?
>
> For Example dbh have a method dbh:affected_rows() for insert , update.
>
> Like this do we have a method for ID?
>
> Thanks
> Lloyd
> *
-- 
------------------------------------------------------------
Nathan Neulinger                       nneul at mst.edu
Missouri S&T Information Technology    (573) 612-1412
System Administrator - Architect



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