PHP 8.0.0 Beta 4 available for testing

MysqlndUhConnection::getErrorNumber

(PECL mysqlnd-uh >= 1.0.0-alpha)

MysqlndUhConnection::getErrorNumberReturns the error code for the most recent function call

Descrição

public MysqlndUhConnection::getErrorNumber ( mysqlnd_connection $connection ) : int

Returns the error code for the most recent function call.

Parâmetros

connection

Mysqlnd connection handle. Do not modify!

Valor Retornado

Error code for the most recent function call.

Exemplos

MysqlndUhConnection::getErrorNumber() is not only executed after the invocation of a user space API call which maps directly to it but also called internally.

Exemplo #1 MysqlndUhConnection::getErrorNumber() example

<?php
class proxy extends MysqlndUhConnection {
 public function 
getErrorNumber($res) {
   
printf("%s(%s)\n"__METHOD__var_export(func_get_args(), true));
   
$ret parent::getErrorNumber($res);
   
printf("%s returns %s\n"__METHOD__var_export($rettrue));
   return 
$ret;
 }
}
mysqlnd_uh_set_connection_proxy(new proxy());

printf("connect...\n");
$mysqli = new mysqli("localhost""root""""test");
printf("query...\n");
$mysqli->query("PLEASE_LET_THIS_BE_INVALID_SQL");
printf("errno...\n");
var_dump($mysqli->errno);
printf("close...\n");
$mysqli->close();
?>

O exemplo acima irá imprimir:

connect...
proxy::getErrorNumber(array (
  0 => NULL,
))
proxy::getErrorNumber returns 0
query...
errno...
proxy::getErrorNumber(array (
  0 => NULL,
))
proxy::getErrorNumber returns 1064
int(1064)
close...

Veja Também

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top