当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_DBI_convert_message函数代码示例

本文整理汇总了PHP中PMA_DBI_convert_message函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_DBI_convert_message函数的具体用法?PHP PMA_DBI_convert_message怎么用?PHP PMA_DBI_convert_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_DBI_convert_message函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PMA_DBI_getError

/**
 * returns last error message or false if no errors occured
 *
 * @uses    PMA_DBI_convert_message()
 * @uses    $GLOBALS['errno']
 * @uses    $GLOBALS['userlink']
 * @uses    $GLOBALS['strServerNotResponding']
 * @uses    $GLOBALS['strSocketProblem']
 * @uses    $GLOBALS['strDetails']
 * @uses    mysql_errno()
 * @uses    mysql_error()
 * @uses    defined()
 * @uses    PMA_generate_common_url()
 * @param   resource        $link   mysql link
 * @return  string|boolean  $error or false
 */
function PMA_DBI_getError($link = null)
{
    $GLOBALS['errno'] = 0;
    /* Treat false same as null because of controllink */
    if ($link === false) {
        $link = null;
    }
    if (null === $link && isset($GLOBALS['userlink'])) {
        $link =& $GLOBALS['userlink'];
        // Do not stop now. On the initial connection, we don't have a $link,
        // we don't have a $GLOBALS['userlink'], but we can catch the error code
        //    } else {
        //            return false;
    }
    if (null !== $link && false !== $link) {
        $error_number = mysql_errno($link);
        $error_message = mysql_error($link);
    } else {
        $error_number = mysql_errno();
        $error_message = mysql_error();
    }
    if (0 == $error_number) {
        return false;
    }
    // keep the error number for further check after the call to PMA_DBI_getError()
    $GLOBALS['errno'] = $error_number;
    if (!empty($error_message)) {
        $error_message = PMA_DBI_convert_message($error_message);
    }
    $error_message = htmlspecialchars($error_message);
    // Some errors messages cannot be obtained by mysql_error()
    if ($error_number == 2002) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
    } elseif ($error_number == 2003) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'];
    } elseif ($error_number == 1005) {
        /* InnoDB contraints, see
         * http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html
         */
        $error = '#' . (string) $error_number . ' - ' . $error_message . ' (<a href="server_engines.php' . PMA_generate_common_url(array('engine' => 'InnoDB', 'page' => 'Status')) . '">' . $GLOBALS['strDetails'] . '</a>)';
    } else {
        $error = '#' . (string) $error_number . ' - ' . $error_message;
    }
    return $error;
}
开发者ID:wdingsoft,项目名称:test1.jit,代码行数:61,代码来源:mysql.dbi.lib.php

示例2: PMA_DBI_formatError

/**
 * Formats database error message in a friendly way.
 * This is needed because some errors messages cannot
 * be obtained by mysql_error().
 *
 * @param int    $error_number  Error code
 * @param string $error_message Error message as returned by server
 *
 * @return string HML text with error details
 */
function PMA_DBI_formatError($error_number, $error_message)
{
    if (!empty($error_message)) {
        $error_message = PMA_DBI_convert_message($error_message);
    }
    $error_message = htmlspecialchars($error_message);
    $error = '#' . (string) $error_number;
    if ($error_number == 2002) {
        $error .= ' - ' . $error_message;
        $error .= '<br />';
        $error .= __('The server is not responding (or the local server\'s socket is not correctly configured).');
    } elseif ($error_number == 2003) {
        $error .= ' - ' . $error_message;
        $error .= '<br />' . __('The server is not responding.');
    } elseif ($error_number == 1005) {
        if (strpos($error_message, 'errno: 13') !== false) {
            $error .= ' - ' . $error_message;
            $error .= '<br />' . __('Please check privileges of directory containing database.');
        } else {
            /* InnoDB contraints, see
             * http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html
             */
            $error .= ' - ' . $error_message . ' (<a href="server_engines.php' . PMA_generate_common_url(array('engine' => 'InnoDB', 'page' => 'Status')) . '">' . __('Details...') . '</a>)';
        }
    } else {
        $error .= ' - ' . $error_message;
    }
    return $error;
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:39,代码来源:database_interface.lib.php

示例3: PMA_DBI_getError

/**
 * returns last error message or false if no errors occured
 *
 * @uses    PMA_DBI_convert_message()
 * @uses    $GLOBALS['errno']
 * @uses    $GLOBALS['userlink']
 * @uses    mysqli_errno()
 * @uses    mysqli_error()
 * @uses    mysqli_connect_errno()
 * @uses    mysqli_connect_error()
 * @uses    defined()
 * @param   resource        $link   mysql link
 * @return  string|boolean  $error or false
 */
function PMA_DBI_getError($link = null)
{
    $GLOBALS['errno'] = 0;
    /* Treat false same as null because of controllink */
    if ($link === false) {
        $link = null;
    }
    if (null === $link && isset($GLOBALS['userlink'])) {
        $link =& $GLOBALS['userlink'];
        // Do not stop now. We still can get the error code
        // with mysqli_connect_errno()
        //    } else {
        //        return false;
    }
    if (null !== $link) {
        $error_number = mysqli_errno($link);
        $error_message = mysqli_error($link);
    } else {
        $error_number = mysqli_connect_errno();
        $error_message = mysqli_connect_error();
    }
    if (0 == $error_number) {
        return false;
    }
    // keep the error number for further check after the call to PMA_DBI_getError()
    $GLOBALS['errno'] = $error_number;
    if (!empty($error_message)) {
        $error_message = PMA_DBI_convert_message($error_message);
    }
    $error_message = htmlspecialchars($error_message);
    if ($error_number == 2002) {
        $error = '#' . (string) $error_number . ' - ' . __('The server is not responding') . ' ' . __('(or the local MySQL server\'s socket is not correctly configured)');
    } else {
        $error = '#' . (string) $error_number . ' - ' . $error_message;
    }
    return $error;
}
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:51,代码来源:mysqli.dbi.lib.php

示例4: PMA_DBI_getError

/**
 * returns last error message or false if no errors occured
 *
 * @uses    PMA_MYSQL_INT_VERSION
 * @uses    PMA_convert_display_charset()
 * @uses    PMA_DBI_convert_message()
 * @uses    $GLOBALS['errno']
 * @uses    $GLOBALS['userlink']
 * @uses    $GLOBALS['strServerNotResponding']
 * @uses    $GLOBALS['strSocketProblem']
 * @uses    mysqli_errno()
 * @uses    mysqli_error()
 * @uses    mysqli_connect_errno()
 * @uses    mysqli_connect_error()
 * @uses    defined()
 * @param   resource        $link   mysql link
 * @return  string|boolean  $error or false
 */
function PMA_DBI_getError($link = null)
{
    $GLOBALS['errno'] = 0;
    if (null === $link && isset($GLOBALS['userlink'])) {
        $link =& $GLOBALS['userlink'];
        // Do not stop now. We still can get the error code
        // with mysqli_connect_errno()
        //    } else {
        //        return false;
    }
    if (null !== $link) {
        $error_number = mysqli_errno($link);
        $error_message = mysqli_error($link);
    } else {
        $error_number = mysqli_connect_errno();
        $error_message = mysqli_connect_error();
    }
    if (0 == $error_number) {
        return false;
    }
    // keep the error number for further check after the call to PMA_DBI_getError()
    $GLOBALS['errno'] = $error_number;
    if (!empty($error_message)) {
        $error_message = PMA_DBI_convert_message($error_message);
    }
    if ($error_number == 2002) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
    } elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) {
        $error = '#' . (string) $error_number . ' - ' . $error_message;
    } else {
        $error = '#' . (string) $error_number . ' - ' . PMA_convert_display_charset($error_message);
    }
    return $error;
}
开发者ID:alex-k,项目名称:velotur,代码行数:52,代码来源:mysqli.dbi.lib.php

示例5: PMA_DBI_getError

/**
 * returns last error message or false if no errors occured
 *
 * @uses    PMA_MYSQL_INT_VERSION
 * @uses    PMA_convert_display_charset()
 * @uses    PMA_DBI_convert_message()
 * @uses    $GLOBALS['errno']
 * @uses    $GLOBALS['userlink']
 * @uses    $GLOBALS['strServerNotResponding']
 * @uses    $GLOBALS['strSocketProblem']
 * @uses    mysql_errno()
 * @uses    mysql_error()
 * @uses    defined()
 * @param   resource        $link   mysql link
 * @return  string|boolean  $error or false
 */
function PMA_DBI_getError($link = null)
{
    $GLOBALS['errno'] = 0;
    if (null === $link && isset($GLOBALS['userlink'])) {
        $link =& $GLOBALS['userlink'];
        // Do not stop now. On the initial connection, we don't have a $link,
        // we don't have a $GLOBALS['userlink'], but we can catch the error code
        //    } else {
        //            return FALSE;
    }
    if (null !== $link) {
        $error_number = mysql_errno($link);
        $error_message = mysql_error($link);
    } else {
        $error_number = mysql_errno();
        $error_message = mysql_error();
    }
    if (0 == $error_number) {
        return false;
    }
    // keep the error number for further check after the call to PMA_DBI_getError()
    $GLOBALS['errno'] = $error_number;
    if (!empty($error_message)) {
        $error_message = PMA_DBI_convert_message($error_message);
    }
    // Some errors messages cannot be obtained by mysql_error()
    if ($error_number == 2002) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'] . ' ' . $GLOBALS['strSocketProblem'];
    } elseif ($error_number == 2003) {
        $error = '#' . (string) $error_number . ' - ' . $GLOBALS['strServerNotResponding'];
    } elseif (defined('PMA_MYSQL_INT_VERSION') && PMA_MYSQL_INT_VERSION >= 40100) {
        $error = '#' . (string) $error_number . ' - ' . $error_message;
    } else {
        $error = '#' . (string) $error_number . ' - ' . PMA_convert_display_charset($error_message);
    }
    return $error;
}
开发者ID:findlakes,项目名称:XSS-Platform,代码行数:53,代码来源:mysql.dbi.lib.php


注:本文中的PMA_DBI_convert_message函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。