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


PHP Message::getMessageForDeletedRows方法代码示例

本文整理汇总了PHP中PMA\libraries\Message::getMessageForDeletedRows方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getMessageForDeletedRows方法的具体用法?PHP Message::getMessageForDeletedRows怎么用?PHP Message::getMessageForDeletedRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA\libraries\Message的用法示例。


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

示例1: PMA_getMessageForNoRowsReturned

/**
 * Function to get the message for the no rows returned case
 *
 * @param string $message_to_show      message to show
 * @param array  $analyzed_sql_results analyzed sql results
 * @param int    $num_rows             number of rows
 *
 * @return string $message
 */
function PMA_getMessageForNoRowsReturned($message_to_show, $analyzed_sql_results, $num_rows)
{
    if ($analyzed_sql_results['querytype'] == 'DELETE"') {
        $message = Message::getMessageForDeletedRows($num_rows);
    } elseif ($analyzed_sql_results['is_insert']) {
        if ($analyzed_sql_results['querytype'] == 'REPLACE') {
            // For REPLACE we get DELETED + INSERTED row count,
            // so we have to call it affected
            $message = Message::getMessageForAffectedRows($num_rows);
        } else {
            $message = Message::getMessageForInsertedRows($num_rows);
        }
        $insert_id = $GLOBALS['dbi']->insertId();
        if ($insert_id != 0) {
            // insert_id is id of FIRST record inserted in one insert,
            // so if we inserted multiple rows, we had to increment this
            $message->addMessage('[br]');
            // need to use a temporary because the Message class
            // currently supports adding parameters only to the first
            // message
            $_inserted = Message::notice(__('Inserted row id: %1$d'));
            $_inserted->addParam($insert_id + $num_rows - 1);
            $message->addMessage($_inserted);
        }
    } elseif ($analyzed_sql_results['is_affected']) {
        $message = Message::getMessageForAffectedRows($num_rows);
        // Ok, here is an explanation for the !$is_select.
        // The form generated by sql_query_form.lib.php
        // and db_sql.php has many submit buttons
        // on the same form, and some confusion arises from the
        // fact that $message_to_show is sent for every case.
        // The $message_to_show containing a success message and sent with
        // the form should not have priority over errors
    } elseif (!empty($message_to_show) && $analyzed_sql_results['querytype'] != 'SELECT') {
        $message = Message::rawSuccess(htmlspecialchars($message_to_show));
    } elseif (!empty($GLOBALS['show_as_php'])) {
        $message = Message::success(__('Showing as PHP code'));
    } elseif (isset($GLOBALS['show_as_php'])) {
        /* User disable showing as PHP, query is only displayed */
        $message = Message::notice(__('Showing SQL query'));
    } else {
        $message = Message::success(__('MySQL returned an empty result set (i.e. zero rows).'));
    }
    if (isset($GLOBALS['querytime'])) {
        $_querytime = Message::notice('(' . __('Query took %01.4f seconds.') . ')');
        $_querytime->addParam($GLOBALS['querytime']);
        $message->addMessage($_querytime);
    }
    // In case of ROLLBACK, notify the user.
    if (isset($_REQUEST['rollback_query'])) {
        $message->addMessage(__('[ROLLBACK occurred.]'));
    }
    return $message;
}
开发者ID:Devuiux,项目名称:phpmyadmin,代码行数:63,代码来源:sql.lib.php


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