Re: How can I get MySQL protocol information with PDO?
| From: | Thodoris | Date: | Fri, 30 Nov 2007 07:15:44 +0000 |
| Subject: | Re: How can I get MySQL protocol information with PDO? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44374@lists.php.net to get a copy of this message | ||
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