Is mysql_insert_id thread safe?

I use the MySQL C API to create a db client application, and I need to get the last auto-increment value in the INSERT statement, so mysql_insert_id does.

But this client is multi-threaded and the piece of code looks like this:

mysql_query (conn, query_string); value = mysql_insert_id (conn);

I do not know what it will return, this request will automatically generate id or something else. Any clues?

Thanks in advance.

+3
source share
1 answer

According to the documentation, mysql_insert_id will return the identifier of the last successful insert in the current connection .

, , .

+3

Source: https://habr.com/ru/post/1724091/


All Articles