From 0419817bb5582c301bb321cfbc809f0a802dc945 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Thu, 24 Nov 2005 12:31:34 +0000 Subject: [PATCH] added PMA_DBI_get_client_info(), PMA_DBI_get_proto_info() PMA_DBI_get_host_info() --- ChangeLog | 2 ++ libraries/dbi/mysql.dbi.lib.php | 45 ++++++++++++++++++++++++++++++++ libraries/dbi/mysqli.dbi.lib.php | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) diff --git a/ChangeLog b/ChangeLog index 490e449ab..03fdbd0a0 100755 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ $Source$ * themes/original/*, css/phpmyadmin.css.php: - updated theme - added version, to include only needed styles + * libraries/dbi/*: added PMA_DBI_get_client_info(), PMA_DBI_get_proto_info() + PMA_DBI_get_host_info() 2005-11-23 Sebastian Mendel * *REVERTED* libraries/display_select_lang.lib.php: correct lang definition diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index c88f62469..8890db954 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -152,6 +152,51 @@ function PMA_DBI_free_result($result) { } } +/** + * Returns a string representing the type of connection used + * @uses mysql_get_host_info() + * @uses $GLOBALS['userlink'] as default for $link + * @param resource $link mysql link + * @return string type of connection used + */ +function PMA_DBI_get_host_info( $link = NULL ) { + if ( NULL === $link ) { + if ( isset( $GLOBALS['userlink'] ) ) { + $link = $GLOBALS['userlink']; + } else { + return false; + } + } + return mysql_get_host_info( $link ); +} + +/** + * Returns the version of the MySQL protocol used + * @uses mysql_get_proto_info() + * @uses $GLOBALS['userlink'] as default for $link + * @param resource $link mysql link + * @return integer version of the MySQL protocol used + */ +function PMA_DBI_get_proto_info( $link = NULL ) { + if ( NULL === $link ) { + if ( isset( $GLOBALS['userlink'] ) ) { + $link = $GLOBALS['userlink']; + } else { + return false; + } + } + return mysql_get_proto_info( $link ); +} + +/** + * returns a string that represents the client library version + * @uses mysql_get_client_info() + * @return string MySQL client library version + */ +function PMA_DBI_get_client_info() { + return mysql_get_client_info(); +} + /** * returns last error message or false if no errors occured * diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 03354721d..af00b4dbb 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -187,6 +187,51 @@ function PMA_DBI_free_result($result) { } } +/** + * Returns a string representing the type of connection used + * @uses mysqli_get_host_info() + * @uses $GLOBALS['userlink'] as default for $link + * @param resource $link mysql link + * @return string type of connection used + */ +function PMA_DBI_get_host_info( $link = NULL ) { + if ( NULL === $link ) { + if ( isset( $GLOBALS['userlink'] ) ) { + $link = $GLOBALS['userlink']; + } else { + return false; + } + } + return mysqli_get_host_info( $link ); +} + +/** + * Returns the version of the MySQL protocol used + * @uses mysqli_get_proto_info() + * @uses $GLOBALS['userlink'] as default for $link + * @param resource $link mysql link + * @return integer version of the MySQL protocol used + */ +function PMA_DBI_get_proto_info( $link = NULL ) { + if ( NULL === $link ) { + if ( isset( $GLOBALS['userlink'] ) ) { + $link = $GLOBALS['userlink']; + } else { + return false; + } + } + return mysqli_get_proto_info( $link ); +} + +/** + * returns a string that represents the client library version + * @uses mysqli_get_client_info() + * @return string MySQL client library version + */ +function PMA_DBI_get_client_info() { + return mysqli_get_client_info(); +} + /** * returns last error message or false if no errors occured *