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*.


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:


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

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

  $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:



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

Reply via email to