PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

MysqlndUhConnection::changeUser - Changes the user of the specified mysqlnd database connection | JavaScript入門&応用&リファレンスなら「JavaScriptist」

  

MysqlndUhConnection::changeUser

(PECL mysqlnd-uh >= 1.0.0-alpha)

MysqlndUhConnection::changeUserChanges the user of the specified mysqlnd database connection

説明

public bool MysqlndUhConnection::changeUser ( mysqlnd_connection $connection , string $user , string $password , string $database , bool $silent , int $passwd_len )

Changes the user of the specified mysqlnd database connection

パラメータ

connection

Mysqlnd connection handle. Do not modify!

user

The MySQL user name.

password

The MySQL password.

database

The MySQL database to change to.

silent

Controls if mysqlnd is allowed to emit errors or not.

passwd_len

Length of the MySQL password.

返り値

Returns TRUE on success. Otherwise, returns FALSE

例1 MysqlndUhConnection::changeUser() example

<?php
class proxy extends MysqlndUhConnection {
 
/* Hook mysqlnd's connection::change_user call */
 
public function changeUser($res$user$passwd$db$silent$passwd_len) {
   
printf("%s(%s)\n"__METHOD__var_export(func_get_args(), true));
   
$ret parent::changeUser($res$user$passwd$db$silent$passwd_len);
   
printf("%s returns %s\n"__METHOD__var_export($rettrue));
   return 
$ret;
 }
}
/* Install proxy/hooks to be used with all future mysqlnd connection */
mysqlnd_uh_set_connection_proxy(new proxy());

/* Create mysqli connection which is using the mysqlnd library */
$mysqli = new mysqli("localhost""root""""test");

/* Example of a user API call which triggers the hooked mysqlnd call */
var_dump($mysqli->change_user("root""bar""test"));
?>

上の例の出力は以下となります。

proxy::changeUser(array (
  0 => NULL,
  1 => 'root',
  2 => 'bar',
  3 => 'test',
  4 => false,
  5 => 3,
))
proxy::changeUser returns false
bool(false)

参考


忘却曲線を使ってこの知識を確実に記憶に残す

フォーラムで「MysqlndUhConnection::changeUser - Changes the user of the specified mysqlnd database connection」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | MysqlndUhConnection::changeUser - Changes the user of the specified mysqlnd database connection」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: