Thanks Thodoris.
But this is not things I desired.I've already read php manual and known
about PDO::getAttribute() before I post my question.
When I get to server version,I can use $dbh->getAttribute(PDO::
ATTR_SERVER_VERSION),but there are no attribute about mysql server
protocol.
I'm planing to make phpMyAdmin-clone with PDO.but I don't know PDO can
work instead of mysql/mysqli extension.and I couldn't find equivalent
function in PDO with mysql_get_proto_info(mysqli_get_proto_info).
// with mysql extension
$link = mysql_connect($host,$user,$password);
echo mysql_get_proto_info(); // returns 10 in my case.
but I cannot find the proper value like PDO::ATTR_SERVER_PROTOCOL in
PDO's getAttribute.
and PDO doesn't seems to use MySQL API's mysql_get_proto_info.
I check like this:
/path/to/php-5.2.4/ext$ grep -r 'mysql_get_proto_info' mysql
mysql/php_mysql.c: PHP_FE(mysql_get_proto_info, NULL)
mysql/php_mysql.c:/* {{{ proto int mysql_get_proto_info([int
link_identifier])
mysql/php_mysql.c:PHP_FUNCTION(mysql_get_proto_info)
mysql/php_mysql.c: RETURN_LONG(mysql_get_proto_info(&mysql->conn));
mysql/php_mysql.h:PHP_FUNCTION(mysql_get_proto_info);
Binary file mysql/.libs/php_mysql.o matches
/path/to/php-5.2.4/ext$ grep -r 'mysql_get_proto_info' pdo*
/path/to/php-5.2.4/ext$
I forgot to tell you my environment.
MySQL version: 5.0.27-standard-log
PHP: 5.2.4 (upgrade in near future)
Apache: 2.2.6
>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);
>?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php