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


PHP PMA_Tracker::getTrackedData方法代码示例

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


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

示例1: unserialize

 * Schema snapshot
 */
if (isset($_REQUEST['snapshot'])) {
    ?>
    <h3><?php 
    echo $strTrackingStructureSnapshot;
    ?>
  [<a href="tbl_tracking.php?<?php 
    echo $url_query;
    ?>
"><?php 
    echo $strTrackingReportClose;
    ?>
</a>]</h3>
<?php 
    $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']);
    // Get first DROP TABLE and CREATE TABLE statements
    $drop_create_statements = $data['ddlog'][0]['statement'];
    if (strstr($data['ddlog'][0]['statement'], 'DROP TABLE')) {
        $drop_create_statements .= $data['ddlog'][1]['statement'];
    }
    // Print SQL code
    PMA_showMessage(sprintf($strTrackingVersionSnapshotSQL, $_REQUEST['version']), $drop_create_statements);
    // Unserialize snapshot
    $temp = unserialize($data['schema_snapshot']);
    $columns = $temp['COLUMNS'];
    $indexes = $temp['INDEXES'];
    ?>
    <h3><?php 
    echo $strStructure;
    ?>
开发者ID:shishenkov,项目名称:zpanel,代码行数:31,代码来源:tbl_tracking.php

示例2: PMA_getHtmlForSchemaSnapshot

/**
 * Function to get html for schema snapshot
 *
 * @param string $url_query url query
 *
 * @return string
 */
function PMA_getHtmlForSchemaSnapshot($url_query)
{
    $html = '<h3>' . __('Structure snapshot') . '  [<a href="tbl_tracking.php' . $url_query . '">' . __('Close') . '</a>]</h3>';
    $data = PMA_Tracker::getTrackedData($_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']);
    // Get first DROP TABLE/VIEW and CREATE TABLE/VIEW statements
    $drop_create_statements = $data['ddlog'][0]['statement'];
    if (mb_strstr($data['ddlog'][0]['statement'], 'DROP TABLE') || mb_strstr($data['ddlog'][0]['statement'], 'DROP VIEW')) {
        $drop_create_statements .= $data['ddlog'][1]['statement'];
    }
    // Print SQL code
    $html .= PMA_Util::getMessage(sprintf(__('Version %s snapshot (SQL code)'), htmlspecialchars($_REQUEST['version'])), $drop_create_statements);
    // Unserialize snapshot
    $temp = unserialize($data['schema_snapshot']);
    $columns = $temp['COLUMNS'];
    $indexes = $temp['INDEXES'];
    $html .= PMA_getHtmlForColumns($columns);
    if (count($indexes) > 0) {
        $html .= PMA_getHtmlForIndexes($indexes);
    }
    // endif
    $html .= '<br /><hr /><br />';
    return $html;
}
开发者ID:saisai,项目名称:phpmyadmin,代码行数:30,代码来源:tracking.lib.php

示例3: testGetTrackedData

    /**
     * Test for PMA_Tracker::getTrackedData()
     *
     * @param array $fetchArrayReturn Value to be returned by mocked fetchArray
     * @param array $expectedArray    Expected array
     *
     * @return void
     * @test
     * @dataProvider getTrackedDataProvider
     */
    public function testGetTrackedData($fetchArrayReturn, $expectedArray)
    {
        $GLOBALS['cfg']['Server']['pmadb'] = 'pma_db';
        $GLOBALS['cfg']['Server']['tracking'] = 'tracking';

        $reflection = new \ReflectionProperty('PMA_Tracker', 'pma_table');
        $reflection->setAccessible(true);
        $reflection->setValue(null, "`pma_db`.`tracking`");

        $sql_query = " SELECT * FROM `pma_db`.`tracking`" .
            " WHERE `db_name` = 'pma''db' " .
            " AND `table_name` = 'pma''table' " .
            " AND `version` = '1.0' ".
            " ORDER BY `version` DESC LIMIT 1";

        $GLOBALS['controllink'] = null;

        $dbi = $this->getMockBuilder('PMA_DatabaseInterface')
            ->disableOriginalConstructor()
            ->getMock();

        $dbi->expects($this->at(0))
            ->method('query')
            ->with($sql_query, null, 0, false)
            ->will($this->returnValue("executed_1"));

        $dbi->expects($this->at(1))
            ->method('fetchAssoc')
            ->with("executed_1")
            ->will($this->returnValue($fetchArrayReturn));

        $GLOBALS['dbi'] = $dbi;
        $result = PMA_Tracker::getTrackedData("pma'db", "pma'table", "1.0");

        $this->assertEquals(
            $expectedArray,
            $result
        );
    }
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:49,代码来源:PMA_Tracker_test.php

示例4: MAX

// Work to do?
//  (here, do not use $_REQUEST['db] as it can be crafted)
if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) {
    PMA_Tracker::deleteTracking($GLOBALS['db'], $_REQUEST['table']);
    /**
     * If in an Ajax request, generate the success message and use
     * {@link PMA_Response()} to send the output
     */
    if ($GLOBALS['is_ajax_request'] == true) {
        $response = PMA_Response::getInstance();
        $response->addJSON('message', PMA_Message::success());
        exit;
    }
}
// Get tracked data about the database
$data = PMA_Tracker::getTrackedData($_REQUEST['db'], '', '1');
// No tables present and no log exist
if ($num_tables == 0 && count($data['ddlog']) == 0) {
    echo '<p>' . __('No tables found in database.') . '</p>' . "\n";
    if (empty($db_is_system_schema)) {
        include 'libraries/display_create_table.lib.php';
    }
    exit;
}
// ---------------------------------------------------------------------------
$cfgRelation = PMA_getRelationsParam();
// Prepare statement to get HEAD version
$all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['tracking']) . ' WHERE db_name = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) . '\' ' . ' GROUP BY table_name' . ' ORDER BY table_name ASC';
$all_tables_result = PMA_queryAsControlUser($all_tables_query);
// If a HEAD version exists
if ($GLOBALS['dbi']->numRows($all_tables_result) > 0) {
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:31,代码来源:db_tracking.php


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