Various coding style improvements

This commit is contained in:
Michal Čihař 2012-09-18 16:57:22 +02:00
parent 3628d0a593
commit ed83a0874a
4 changed files with 54 additions and 26 deletions

View File

@ -182,7 +182,7 @@ function PMA_DBI_select_db($dbname, $link = null)
*
* @param string $query query to execute
* @param PMA_DrizzleCon $link connection object
* @param int $options
* @param int $options query options
*
* @return PMA_DrizzleResult
*/
@ -248,6 +248,8 @@ function PMA_DBI_data_seek($result, $offset)
* Frees memory associated with the result
*
* @param PMA_DrizzleResult $result database result
*
* @return void
*/
function PMA_DBI_free_result($result)
{

View File

@ -340,6 +340,8 @@ function PMA_DBI_data_seek($result, $offset)
* Frees memory associated with the result
*
* @param resource $result database result
*
* @return void
*/
function PMA_DBI_free_result($result)
{

View File

@ -17,18 +17,24 @@ require_once './libraries/logging.lib.php';
*/
if (! defined('PMA_MYSQL_CLIENT_API')) {
$client_api = explode('.', mysql_get_client_info());
define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
define(
'PMA_MYSQL_CLIENT_API',
(int)sprintf(
'%d%02d%02d',
$client_api[0], $client_api[1], intval($client_api[2])
)
);
unset($client_api);
}
/**
* Helper function for connecting to the database server
*
* @param string $server
* @param string $user
* @param string $password
* @param int $client_flags
* @param bool $persistent
* @param array $server host/port/socket
* @param string $user mysql user name
* @param string $password mysql user password
* @param int $client_flags client flags of connection
* @param bool $persistent whether to use peristent connection
*
* @return mixed false on error or a mysql connection resource on success
*/
@ -267,6 +273,8 @@ function PMA_DBI_data_seek($result, $offset)
* Frees memory associated with the result
*
* @param resource $result database result
*
* @return void
*/
function PMA_DBI_free_result($result)
{
@ -461,10 +469,11 @@ function PMA_DBI_affected_rows($link = null, $get_from_cache = true)
/**
* returns metainfo for fields in $result
*
* @todo add missing keys like in mysqli_query (decimals)
* @param resource $result MySQL result
*
* @return array meta info for fields in $result
*
* @todo add missing keys like in mysqli_query (decimals)
*/
function PMA_DBI_get_fields_meta($result)
{
@ -496,7 +505,7 @@ function PMA_DBI_num_fields($result)
* returns the length of the given field $i in $result
*
* @param resource $result MySQL result
* @param int $i field
* @param int $i field
*
* @return int length of field
*/
@ -509,7 +518,7 @@ function PMA_DBI_field_len($result, $i)
* returns name of $i. field in $result
*
* @param resource $result MySQL result
* @param int $i field
* @param int $i field
*
* @return string name of $i. field in $result
*/
@ -522,7 +531,7 @@ function PMA_DBI_field_name($result, $i)
* returns concatenated string of human readable field flags
*
* @param resource $result MySQL result
* @param int $i field
* @param int $i field
*
* @return string field flags
*/

View File

@ -17,7 +17,13 @@ require_once './libraries/logging.lib.php';
*/
if (!defined('PMA_MYSQL_CLIENT_API')) {
$client_api = explode('.', mysqli_get_client_info());
define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
define(
'PMA_MYSQL_CLIENT_API',
(int)sprintf(
'%d%02d%02d',
$client_api[0], $client_api[1], intval($client_api[2])
)
);
unset($client_api);
}
@ -52,20 +58,22 @@ if (! defined('MYSQLI_TYPE_VARCHAR')) {
/**
* Helper function for connecting to the database server
*
* @param mysqli $link
* @param string $host
* @param string $user
* @param string $password
* @param string $dbname
* @param int $server_port
* @param string $server_socket
* @param int $client_flags
* @param bool $persistent
* @param mysqli $link connection link
* @param string $host mysql hostname
* @param string $user mysql user name
* @param string $password mysql user password
* @param string $dbname database name
* @param int $server_port server port
* @param string $server_socket server socket
* @param int $client_flags client flags of connection
* @param bool $persistent whether to use peristent connection
*
* @return bool
*/
function PMA_DBI_real_connect($link, $host, $user, $password, $dbname, $server_port, $server_socket, $client_flags = null, $persistent = false)
{
function PMA_DBI_real_connect(
$link, $host, $user, $password, $dbname, $server_port,
$server_socket, $client_flags = null, $persistent = false
) {
global $cfg;
// mysqli persistent connections only on PHP 5.3+
@ -165,7 +173,10 @@ function PMA_DBI_connect(
$client_flags
);
// Retry with empty password if we're allowed to
if ($return_value == false && isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword'] && !$is_controluser) {
if ($return_value == false
&& isset($cfg['Server']['nopassword']) && $cfg['Server']['nopassword']
&& !$is_controluser
) {
$return_value = @PMA_DBI_real_connect(
$link,
$cfg['Server']['host'],
@ -239,7 +250,7 @@ function PMA_DBI_select_db($dbname, $link = null)
*
* @param string $query query to execute
* @param mysqli $link mysqli object
* @param int $options
* @param int $options query options
*
* @return mysqli_result|bool
*/
@ -705,7 +716,11 @@ function PMA_DBI_field_flags($result, $i)
// structure. Watch out: some types like DATE returns 63 in charsetnr
// so we have to check also the type.
// Unfortunately there is no equivalent in the mysql extension.
if (($type == MYSQLI_TYPE_TINY_BLOB || $type == MYSQLI_TYPE_BLOB || $type == MYSQLI_TYPE_MEDIUM_BLOB || $type == MYSQLI_TYPE_LONG_BLOB || $type == MYSQLI_TYPE_VAR_STRING || $type == MYSQLI_TYPE_STRING) && 63 == $charsetnr) {
if (($type == MYSQLI_TYPE_TINY_BLOB || $type == MYSQLI_TYPE_BLOB
|| $type == MYSQLI_TYPE_MEDIUM_BLOB || $type == MYSQLI_TYPE_LONG_BLOB
|| $type == MYSQLI_TYPE_VAR_STRING || $type == MYSQLI_TYPE_STRING)
&& 63 == $charsetnr
) {
$flags .= 'binary ';
}
if ($f & MYSQLI_ZEROFILL_FLAG) {