<font color='black' size='2' face='Arial, Helvetica, sans-serif'>Hi<font size="2"> Daniel,<br>
<br>
Thanks for your description, it is much appreciated. :-)<br>
<br>
5 word one liners from people too lazy to explain properly would really be best if they didn't reply at all.<br>
<br>
Cheers, thanks again.<br>
<br>
-Jm<br>
</font><font color="black" face="Arial, Helvetica, sans-serif" size="2">
<div> <br>
</div>
<div> <br>
</div>
<div> <br>
</div>
<div style="font-family:helvetica,arial;font-size:10pt;color:black">-----Original Message-----<br>
From: Daniel Ivanov <sertys@gmail.com><br>
To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org><br>
Sent: Sat, May 25, 2013 5:57 pm<br>
Subject: Re: [Freeswitch-users] dbh:query - insert id<br>
<br>
<div id="AOLMsgPart_2_1b3920ba-6a9f-4427-8d5a-985624a5965a">
<div dir="ltr">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.<br>
</div>
<div class="gmail_quote">On May 25, 2013 7:03 AM, "John M" <<a href="mailto:j_mj@aol.com">j_mj@aol.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="black" face="Arial, Helvetica, sans-serif"><font color="black" face="Arial, Helvetica, sans-serif">
<div> Hi <font color="black" face="Arial, Helvetica, sans-serif">Seven Du</font>,<br>
<br>
I'd really like to know if this is possible too, couldn't find it documented anywhere.<br>
<br>
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?<br>
<br>
Does it somehow return mysql_insert_id()?<br>
<br>
How should we use it.<br>
<br>
You help is invaluable and is contributing to the freeswitch community.<br>
<br>
-Jm<br>
</div>
<div> <br>
</div>
<div> <br>
</div>
<div style="font-size:10pt;font-family:helvetica,arial">-----Original Message-----<br>
From: Seven Du <<a href="mailto:dujinfang@gmail.com">dujinfang@gmail.com</a>><br>
To: FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>><br>
Sent: Sat, May 25, 2013 12:52 pm<br>
Subject: Re: [Freeswitch-users] dbh:query - insert id<br>
<br>
<div>
<div>
Maybe try the RETURNING clause ?
</div>
<div>
<div><br>
</div>
<div>-- </div>
<div>Seven Du</div>
<div><span style="font-size:10pt"><a target="_blank" href="http://www.freeswitch.org.cn">http://www.freeswitch.org.cn</a></span></div>
<div><a target="_blank" href="http://about.me/dujinfang">http://about.me/dujinfang</a></div>
<div>
<div><a target="_blank" href="http://www.dujinfang.com">http://www.dujinfang.com</a></div>
</div>
<div><br>
</div>
<div>Sent with <a target="_blank" href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div>
<div><br>
</div>
</div>
<div style="color:#a0a0a8">On Saturday, May 25, 2013 at 8:14 AM, Lloyd Aloysius wrote:</div>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
<span>
<div>
<div>
<div><font face="verdana, sans-serif">
<div>
<div><font face="verdana, sans-serif">
<div>Hello All</div>
<div><br>
</div>
<div>How to get the id value after insert a record a record using dbh:query</div>
<div><br>
</div>
<div><u>table_a - columns</u>.</div>
<div><br>
</div>
<div>id - auto increment</div>
<div>field1</div>
<div>field2</div>
<div><br>
</div>
<div><br>
</div>
<div>dbh:query("insert into table_a ( field1,field2) values ('11','Test')")</div>
<div>
<br>
</div>
<div><br>
</div>
<div>After insert how to get the table_a - id value for the inserted record?</div>
<div><br>
</div>
<div>Thanks</div>
<div>Lloyd</div>
</font></div>
</div>
</font></div>
</div>
<div>
<div>_________________________________________________________________________</div>
<div>Professional FreeSWITCH Consulting Services:</div>
<div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div>
<div><a target="_blank" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div>
<div><br>
</div>
<div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div>
<div><a target="_blank" href="http://www.cudatel.com">http://www.cudatel.com</a></div>
<div><br>
</div>
<div>Official FreeSWITCH Sites</div>
<div><a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a></div>
<div><a target="_blank" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div>
<div><a target="_blank" href="http://www.cluecon.com">http://www.cluecon.com</a></div>
<div><br>
</div>
<div>FreeSWITCH-users mailing list</div>
<div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div>
<div><a target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div>
<div>UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div>
<div><a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a></div>
</div>
</div>
</span>
</blockquote>
<div>
<br>
</div>
</div>
<div style="font-size:12px;font-family:Tahoma,Verdana,Arial,Sans-Serif;margin:0px">
<pre style="font-size:9pt"><tt>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a target="_blank" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a target="_blank" href="http://www.cudatel.com">http://www.cudatel.com</a>
Official FreeSWITCH Sites
<a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
<a target="_blank" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a>
<a target="_blank" href="http://www.cluecon.com">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
</tt></pre>
</div>
</div>
</font></font><br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a target="_blank" href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a target="_blank" href="http://www.cudatel.com">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
<a target="_blank" href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><br>
<a target="_blank" href="http://www.cluecon.com">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a target="_blank" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a target="_blank" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a target="_blank" href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
<br>
</blockquote></div>
</div>
<div id="AOLMsgPart_3_1b3920ba-6a9f-4427-8d5a-985624a5965a" style="margin: 0px;font-family: Tahoma, Verdana, Arial, Sans-Serif;font-size: 12px;color: #000;background-color: #fff;">
<pre style="font-size: 9pt;"><tt>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>
Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>
FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</tt></pre>
</div>
<!-- end of AOLMsgPart_3_1b3920ba-6a9f-4427-8d5a-985624a5965a -->
</div>
</font></font>