mysql_thread_id

(PHP 4 >= 4.3.0, PHP 5)

mysql_thread_id -- Return the current thread ID

説明

int mysql_thread_id ( [resource link_identifier] )

Retrieves the current thread ID. If the connection is lost, and a reconnect with mysql_ping() is executed, the thread ID will change. This means only retrieve the thread ID when needed.

パラメータ

link_identifier

MySQL接続。 指定されない場合、mysql_connect() により直近にオープンされたリンクが 指定されたと仮定されます。そのようなリンクがない場合、引数を指定せずに mysql_connect() がコールした時と同様にリンクを確立します。 リンクが見付からない、または、確立できない場合、 E_WARNING レベルの警告が生成されます。

戻り値

The thread ID on success, or FALSE on failure.

例 1. mysql_thread_id() example

<?php
$link
= mysql_connect('localhost', 'mysql_user', 'mysql_password');
$thread_id = mysql_thread_id($link);
if (
$thread_id){
    
printf("current thread id is %d\n", $thread_id);
}
?>

上の例の出力は例えば 以下のようになります:

current thread id is 73

以下も参照ください

mysql_ping()
mysql_list_processes()