當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。