Re: How can I get MySQL protocol information with PDO?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




O/H Kazuhiro IIzuka ??????:
Hi All.

Now I'm trying to get MySQL protocol information with PDO.
There are "mysql_get_proto_info" and "mysqli_get_proto_info" to get MySQL protocol information.

But PDO_MySQL doesn't seems to support this feature.
If I mistake,please let me know.and How to get MySQL protocol information with *PDO*.

Thanks,
Kazu.


Although I have never used other methods to access mysql but PDO and I am not sure what you mean. This could be the answer:

http://www.php.net/manual/en/ref.pdo-mysql.php

You can retrieve some info for the mysql connection (server,driver etc) using PDO::getAttribute()

For e.g. you can do something like that:

<?php
  $dbhost = 'localhost';
  $dbuser = 'user_name';
  $dbpass = 'password';
  $db = 'database';

  $dbh= new PDO('mysql:host='.$dbhost.';dbname='.$db, $dbuser, $dbpass);

  echo $dbh->getAttribute(PDO::ATTR_DRIVER_NAME);
  echo "<br>";
  echo $dbh->getAttribute(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE);
  echo "<br>";
  echo $dbh->getAttribute(PDO::ATTR_SERVER_VERSION);
  echo "<br>";
  echo $dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS);
?>

In order to find out driver details like the driver name, buffer size, mysql version and connection status. A list of some of the the attributes can be found in the link above or in the section of Predefined Constants list in:

http://www.php.net/manual/en/ref.pdo.php

--
Thodoris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux