How to determine the Mysql connection identifier in Perl?

I am trying to figure out if my modules make sharing a DBI connection with MySQL or not. I would like to determine their connection identifier. There may be better solutions (and I would like to know them), but the first question is still about knowing the connection identifier.

+4
source share
2 answers

You can use the CONNECTION_ID function, for example:

 my ($id) = $dbh->selectrow_array('SELECT CONNECTION_ID()'); 
+10
source

You can also try this since you mention MySQL

 my $threadId = $dbmyh->{ q{mysql_thread_id} }; 

From DBD Documentation :: mysql

+1
source

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


All Articles