MysqlndUhConnection::getThreadId

(PECL mysqlnd-uh >= 1.0.0-alpha)

MysqlndUhConnection::getThreadIdRetourne l'identifiant du thread pour la connexion courante

Description

public int MysqlndUhConnection::getThreadId ( mysqlnd_connection $connection )

Retourne l'identifiant du thread de la connexion courante.

Liste de paramètres

connection

Le gestionnaire de connexion Mysqlnd. Ne pas modifier !

Valeurs de retour

L'identifiant du thread de la connexion.

Exemples

Exemple #1 Exemple avec MysqlndUhConnection::getThreadId()

  1. <?php
  2. class proxy extends MysqlndUhConnection {
  3. public function getThreadId($res) {
  4. printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
  5. $ret = parent::getThreadId($res);
  6. printf("%s retourne %s\n", __METHOD__, var_export($ret, true));
  7. return $ret;
  8. }
  9. }
  10. mysqlnd_uh_set_connection_proxy(new proxy());
  11.  
  12. $mysqli = new mysqli("localhost", "root", "", "test");
  13. var_dump($mysqli->thread_id);
  14. ?>

L'exemple ci-dessus va afficher :

proxy::getThreadId(array (
  0 => NULL,
))
proxy::getThreadId retourne 27646
int(27646)

Voir aussi

LoadingChargement en cours