mysql_thread_id
(PHP 4 >= 4.3.0, PHP 5, PECL mysql:1.0)
mysql_thread_id — 현재 쓰레드 ID를 반환
설명
int mysql_thread_id
([ resource $link_identifier
] )
현재 쓰레드 ID를 반환한다. 접속이 종료되어 mysql_ping()를 실행하면 재접속되고 쓰레드 ID가 변할 것이다. 이 의미는 쓰레드 ID는 필요할때만 조회해야한다.
매개변수
- link_identifier
-
MySQL 연결. 지정하지 않으면 mysql_connect()로 연 마지막 연결을 사용합니다. 연결이 없으면, 매개변수 없이 mysql_connect()를 호출하여 연결을 만듭니다. 연결이 성립되지 않으면 E_WARNING 경고를 생성합니다.
반환값
성공하면 쓰레드 ID를, 실패하면 FALSE를 반환한다.
예제
Example#1 mysql_thread_id() 예제
<?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