Paul Belanger wrote:
On 11-01-26 02:59 PM, Tilghman Lesher wrote:
On Wednesday 26 January 2011 07:01:12 Paul Belanger wrote:
[CREATECALL]
dsn=Example
writesql=INSERT INTO x (y) VALUES (z)
readsql=SELECT LAST_INSERT_ID();
That assumes you have only one call in existence at a time.  If two calls
came in and executed the query at about the same time, it's possible for
both reads to return the same value.

Yup, didn't even think of that.  My testing of ODBC was a single
channel.  Guess I need another method to return the last ID of the
record that was just inserted.

In this case, does the Asterisk connection to MySQL through odbc counts as a unique 'client', or does each call to a function will count as a 'client'?

I ask because of this:
"For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection basis. It is not changed by another client. It is not even changed if you update another AUTO_INCREMENT column with a nonmagic value (that is, a value that is not NULL and not 0). Using LAST_INSERT_ID() and AUTO_INCREMENT columns simultaneously from multiple clients is perfectly valid. Each client will receive the last inserted ID for the last statement that client executed."

at: http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html



--
Jose P. Espinal
http://www.eSlackware.com
IRC: Khratos @ #asterisk / -doc / -bugs


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
              http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to