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


PHP PMA_Table::isMerge方法代码示例

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


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

示例1:

 // $allrows comes from the form when "Dump all rows" has been selected
 if ($allrows == '0' && $limit_to > 0 && $limit_from >= 0) {
     $add_query = ' LIMIT ' . ($limit_from > 0 ? $limit_from . ', ' : '') . $limit_to;
 } else {
     $add_query = '';
 }
 $is_view = PMA_Table::isView($db, $table);
 if ($GLOBALS[$what . '_structure_or_data'] == 'structure' || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') {
     if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'create_view' : 'create_table', $export_type)) {
         break;
     }
 }
 // If this is an export of a single view, we have to export data;
 // for example, a PDF report
 // if it is a merge table, no data is exported
 if (($GLOBALS[$what . '_structure_or_data'] == 'data' || $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data') && !PMA_Table::isMerge($db, $table)) {
     if (!empty($sql_query)) {
         // only preg_replace if needed
         if (!empty($add_query)) {
             // remove trailing semicolon before adding a LIMIT
             $sql_query = preg_replace('%;\\s*$%', '', $sql_query);
         }
         $local_query = $sql_query . $add_query;
         PMA_DBI_select_db($db);
     } else {
         $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
     }
     if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
         break;
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:31,代码来源:export.php

示例2: PMA_getHtmlForDisplayTableStats

/**
 * Get HTML snippet for display table statistics
 *
 * @param array   $showtable           full table status info
 * @param integer $table_info_num_rows table info number of rows
 * @param boolean $tbl_is_view         whether table is view or not
 * @param boolean $db_is_system_schema whether db is information schema or not
 * @param string  $tbl_storage_engine  table storage engine
 * @param string  $url_query           url query
 * @param string  $tbl_collation       table collation
 *
 * @return string $html_output
 */
function PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine, $url_query, $tbl_collation)
{
    $html_output = '<div id="tablestatistics">';
    if (empty($showtable)) {
        $showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, true);
    }
    $nonisam = false;
    $is_innodb = isset($showtable['Type']) && $showtable['Type'] == 'InnoDB';
    if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
        $nonisam = true;
    }
    // Gets some sizes
    $mergetable = PMA_Table::isMerge($GLOBALS['db'], $GLOBALS['table']);
    // this is to display for example 261.2 MiB instead of 268k KiB
    $max_digits = 3;
    $decimals = 1;
    list($data_size, $data_unit) = PMA_Util::formatByteDown($showtable['Data_length'], $max_digits, $decimals);
    if ($mergetable == false) {
        list($index_size, $index_unit) = PMA_Util::formatByteDown($showtable['Index_length'], $max_digits, $decimals);
    }
    // InnoDB returns a huge value in Data_free, do not use it
    if (!$is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
        list($free_size, $free_unit) = PMA_Util::formatByteDown($showtable['Data_free'], $max_digits, $decimals);
        list($effect_size, $effect_unit) = PMA_Util::formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals);
    } else {
        list($effect_size, $effect_unit) = PMA_Util::formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
    }
    list($tot_size, $tot_unit) = PMA_Util::formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
    if ($table_info_num_rows > 0) {
        list($avg_size, $avg_unit) = PMA_Util::formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
    }
    // Displays them
    $odd_row = false;
    $html_output .= '<fieldset>' . '<legend>' . __('Information') . '</legend>' . '<a id="showusage"></a>';
    if (!$tbl_is_view && !$db_is_system_schema) {
        $html_output .= '<table id="tablespaceusage" class="data">' . '<caption class="tblHeaders">' . __('Space usage') . '</caption>' . '<tbody>';
        $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Data'), $data_size, $data_unit);
        $odd_row = !$odd_row;
        if (isset($index_size)) {
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Index'), $index_size, $index_unit);
            $odd_row = !$odd_row;
        }
        if (isset($free_size)) {
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Overhead'), $free_size, $free_unit);
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Effective'), $effect_size, $effect_unit);
            $odd_row = !$odd_row;
        }
        if (isset($tot_size) && $mergetable == false) {
            $html_output .= PMA_getHtmlForSpaceUsageTableRow($odd_row, __('Total'), $tot_size, $tot_unit);
            $odd_row = !$odd_row;
        }
        // Optimize link if overhead
        if (isset($free_size) && !PMA_DRIZZLE && ($tbl_storage_engine == 'MYISAM' || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA' || $tbl_storage_engine == 'BDB')) {
            $html_output .= PMA_getHtmlForOptimizeLink($url_query);
        }
        $html_output .= '</tbody>' . '</table>';
    }
    $html_output .= getHtmlForRowStatsTable($showtable, $tbl_collation, $is_innodb, $mergetable, isset($avg_size) ? $avg_size : '', isset($avg_unit) ? $avg_unit : '');
    $html_output .= '</fieldset>' . '</div>';
    return $html_output;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:74,代码来源:structure.lib.php

示例3: __

    if ($cfg['ShowStats']) {
        echo '<th>' . __('Size') . '</th>';
    }
    ?>
    <th><?php 
    echo __('Comments');
    ?>
</th>
</tr>
</thead>
<tbody>
    <?php 
    $sum_entries = $sum_size = 0;
    $odd_row = true;
    foreach ($tables as $sts_data) {
        if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME']) || strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
            $merged_size = true;
        } else {
            $merged_size = false;
        }
        $sum_entries += $sts_data['TABLE_ROWS'];
        ?>
<tr class="<?php 
        echo $odd_row ? 'odd' : 'even';
        ?>
">
    <th>
        <?php 
        echo htmlspecialchars($sts_data['TABLE_NAME']);
        ?>
    </th>
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:31,代码来源:db_printview.php

示例4: list

 /**
  * Displays indexes
  */
 echo PMA_Index::getView($table, $db, true);
 /**
  * Displays Space usage and row statistics
  *
  */
 if ($cfg['ShowStats']) {
     $nonisam = false;
     if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
         $nonisam = true;
     }
     if ($nonisam == false) {
         // Gets some sizes
         $mergetable = PMA_Table::isMerge($db, $table);
         list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
         if ($mergetable == false) {
             list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
         }
         if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
             list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free']);
             list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
         } else {
             unset($free_size);
             unset($free_unit);
             list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
         }
         list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
         if ($num_rows > 0) {
             list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
开发者ID:rizwanaabbas,项目名称:phpmyadmin,代码行数:31,代码来源:tbl_printview.php

示例5: unset

         // if table is broken, Engine is reported as null, so one more test
         if ($each_table['TABLE_TYPE'] == 'VIEW') {
             // countRecords() takes care of $cfg['MaxExactCountViews']
             $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db, $each_table['TABLE_NAME'], $force_exact = true, $is_view = true);
             $table_is_view = true;
         }
         break;
     default:
         // Unknown table type.
         if ($is_show_stats) {
             $formatted_size = 'unknown';
             $unit = '';
         }
 }
 // end switch
 if (!PMA_Table::isMerge($db, $each_table['TABLE_NAME'])) {
     $sum_entries += $each_table['TABLE_ROWS'];
 }
 if (isset($each_table['Collation'])) {
     $collation = '<dfn title="' . PMA_getCollationDescr($each_table['Collation']) . '">' . $each_table['Collation'] . '</dfn>';
 } else {
     $collation = '---';
 }
 if ($is_show_stats) {
     if (isset($formatted_overhead)) {
         $overhead = '<a href="tbl_structure.php?' . $tbl_url_query . '#showusage">' . $formatted_overhead . ' ' . $overhead_unit . '</a>' . "\n";
         unset($formatted_overhead);
         $overhead_check .= "document.getElementById('checkbox_tbl_" . ($i + 1) . "').checked = true;";
     } else {
         $overhead = '-';
     }
开发者ID:bugyak,项目名称:phporadmin,代码行数:31,代码来源:db_structure.php

示例6: urlencode

// Instance of PMA_RecentFavoriteTable class.
$fav_instance = PMA_RecentFavoriteTable::getInstance('favorite');
foreach ($tables as $keyname => $current_table) {
    // Get valid statistics whatever is the table type
    $drop_query = '';
    $drop_message = '';
    $already_favorite = false;
    $overhead = '';
    $table_is_view = false;
    $table_encoded = urlencode($current_table['TABLE_NAME']);
    // Sets parameters for links
    $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
    // do not list the previous table's size info for a view
    list($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size, $table_is_view, $sum_size) = PMA_getStuffForEngineTypeTable($current_table, $db_is_system_schema, $is_show_stats, $table_is_view, $sum_size, $overhead_size);
    $_table = new PMA_Table($current_table['TABLE_NAME'], $db);
    if (!$_table->isMerge()) {
        $sum_entries += $current_table['TABLE_ROWS'];
    }
    if (isset($current_table['Collation'])) {
        $collation = '<dfn title="' . PMA_getCollationDescr($current_table['Collation']) . '">' . $current_table['Collation'] . '</dfn>';
    } else {
        $collation = '---';
    }
    if ($is_show_stats) {
        if ($formatted_overhead != '') {
            $overhead = '<a href="tbl_structure.php' . $tbl_url_query . '#showusage">' . '<span>' . $formatted_overhead . '</span>&nbsp;' . '<span class="unit">' . $overhead_unit . '</span>' . '</a>' . "\n";
            $overhead_check .= "markAllRows('row_tbl_" . ($i + 1) . "');";
        } else {
            $overhead = '-';
        }
    }
开发者ID:bajajahsaas,项目名称:phpmyadmin,代码行数:31,代码来源:db_structure.php

示例7: PMA_DBI_query

         PMA_DBI_query($sql_view_standin);
         $GLOBALS['sql_query'] .= "\n" . $sql_view_standin;
     }
 }
 foreach ($tables_full as $each_table => $tmp) {
     // skip the views; we have creted stand-in definitions
     if (PMA_Table::isView($db, $each_table)) {
         continue;
     }
     $back = $sql_query;
     $sql_query = '';
     // value of $what for this table only
     $this_what = $what;
     // do not copy the data from a Merge table
     // note: on the calling FORM, 'data' means 'structure and data'
     if (PMA_Table::isMerge($db, $each_table)) {
         if ($this_what == 'data') {
             $this_what = 'structure';
         }
         if ($this_what == 'dataonly') {
             $this_what = 'nocopy';
         }
     }
     if ($this_what != 'nocopy') {
         // keep the triggers from the original db+table
         // (third param is empty because delimiters are only intended
         //  for importing via the mysql client or our Import feature)
         $triggers = PMA_DBI_get_triggers($db, $each_table, '');
         if (!PMA_Table::moveCopy($db, $each_table, $newname, $each_table, isset($this_what) ? $this_what : 'data', $move, 'db_copy')) {
             $_error = true;
             // $sql_query is filled by PMA_Table::moveCopy()
开发者ID:rizwanaabbas,项目名称:phpmyadmin,代码行数:31,代码来源:db_operations.php

示例8: PMA_getHtmlForExportOptions

/**
 * Prints Html For Export Options
 *
 * @param String         $export_type    Selected Export Type
 * @param String         $db             Selected DB
 * @param String         $table          Selected Table
 * @param String         $multi_values   Export selection
 * @param String         $num_tables     number of tables
 * @param ExportPlugin[] $export_list    Export List
 * @param String         $unlim_num_rows Number of Rows
 *
 * @return string
 */
function PMA_getHtmlForExportOptions($export_type, $db, $table, $multi_values, $num_tables, $export_list, $unlim_num_rows)
{
    global $cfg;
    $html = PMA_getHtmlForExportOptionsMethod();
    $html .= PMA_getHtmlForExportOptionsFormatDropdown($export_list);
    $html .= PMA_getHtmlForExportOptionsSelection($export_type, $multi_values);
    $tableLength = mb_strlen($table);
    if ($tableLength && empty($num_tables) && !PMA_Table::isMerge($db, $table)) {
        $html .= PMA_getHtmlForExportOptionsRows($db, $table, $unlim_num_rows);
    }
    if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
        $html .= PMA_getHtmlForExportOptionsQuickExport();
    }
    $html .= PMA_getHtmlForAliasModalDialog($db, $table);
    $html .= PMA_getHtmlForExportOptionsOutput($export_type);
    $html .= PMA_getHtmlForExportOptionsFormat($export_list);
    return $html;
}
开发者ID:szepeviktor,项目名称:phpmyadmin,代码行数:31,代码来源:display_export.lib.php

示例9: PMA_getSqlQueryForCopyTable

/**
 * Get sql query for copy/rename table and boolean for whether copy/rename or not
 *
 * @param array   $tables_full array of all tables in given db or dbs
 * @param string  $sql_query   sql query for all operations
 * @param boolean $move        whether database name is empty or not
 * @param string  $db          database name
 *
 * @return array ($sql_query, $error)
 */
function PMA_getSqlQueryForCopyTable($tables_full, $sql_query, $move, $db)
{
    $error = false;
    foreach ($tables_full as $each_table => $tmp) {
        // skip the views; we have created stand-in definitions
        if (PMA_Table::isView($db, $each_table)) {
            continue;
        }
        $back = $sql_query;
        $sql_query = '';
        // value of $what for this table only
        $this_what = $_REQUEST['what'];
        // do not copy the data from a Merge table
        // note: on the calling FORM, 'data' means 'structure and data'
        if (PMA_Table::isMerge($db, $each_table)) {
            if ($this_what == 'data') {
                $this_what = 'structure';
            }
            if ($this_what == 'dataonly') {
                $this_what = 'nocopy';
            }
        }
        if ($this_what != 'nocopy') {
            // keep the triggers from the original db+table
            // (third param is empty because delimiters are only intended
            //  for importing via the mysql client or our Import feature)
            $triggers = $GLOBALS['dbi']->getTriggers($db, $each_table, '');
            if (!PMA_Table::moveCopy($db, $each_table, $_REQUEST['newname'], $each_table, isset($this_what) ? $this_what : 'data', $move, 'db_copy')) {
                $error = true;
                // $sql_query is filled by PMA_Table::moveCopy()
                $sql_query = $back . $sql_query;
                break;
            }
            // apply the triggers to the destination db+table
            if ($triggers) {
                $GLOBALS['dbi']->selectDb($_REQUEST['newname']);
                foreach ($triggers as $trigger) {
                    $GLOBALS['dbi']->query($trigger['create']);
                    $GLOBALS['sql_query'] .= "\n" . $trigger['create'] . ';';
                }
            }
            // this does not apply to a rename operation
            if (isset($_REQUEST['add_constraints']) && !empty($GLOBALS['sql_constraints_query'])) {
                $GLOBALS['sql_constraints_query_full_db'][] = $GLOBALS['sql_constraints_query'];
                unset($GLOBALS['sql_constraints_query']);
            }
        }
        // $sql_query is filled by PMA_Table::moveCopy()
        $sql_query = $back . $sql_query;
    }
    return array($sql_query, $error);
}
开发者ID:FilipeRamosFernandes,项目名称:phpmyadmin,代码行数:62,代码来源:operations.lib.php

示例10: array

$overhead_size = (double) 0;
$hidden_fields = array();
$odd_row = true;
$sum_row_count_pre = '';
foreach ($tables as $keyname => $current_table) {
    // Get valid statistics whatever is the table type
    $drop_query = '';
    $drop_message = '';
    $overhead = '';
    $table_is_view = false;
    $table_encoded = urlencode($current_table['TABLE_NAME']);
    // Sets parameters for links
    $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;
    // do not list the previous table's size info for a view
    list($current_table, $formatted_size, $unit, $formatted_overhead, $overhead_unit, $overhead_size, $table_is_view, $sum_size) = PMA_getStuffForEngineTypeTable($current_table, $db_is_information_schema, $is_show_stats, $table_is_view, $sum_size, $overhead_size);
    if (!PMA_Table::isMerge($db, $current_table['TABLE_NAME'])) {
        $sum_entries += $current_table['TABLE_ROWS'];
    }
    if (isset($current_table['Collation'])) {
        $collation = '<dfn title="' . PMA_getCollationDescr($current_table['Collation']) . '">' . $current_table['Collation'] . '</dfn>';
    } else {
        $collation = '---';
    }
    if ($is_show_stats) {
        if ($formatted_overhead != '') {
            $overhead = '<a href="tbl_structure.php?' . $tbl_url_query . '#showusage">' . '<span>' . $formatted_overhead . '</span>' . '<span class="unit">' . $overhead_unit . '</span>' . '</a>' . "\n";
            $overhead_check .= "markAllRows('row_tbl_" . ($i + 1) . "');";
        } else {
            $overhead = '-';
        }
    }
开发者ID:AtomPy,项目名称:AtomPySite,代码行数:31,代码来源:db_structure.php

示例11:

 // $allrows comes from the form when "Dump all rows" has been selected
 if (isset($allrows) && $allrows == '0' && $limit_to > 0 && $limit_from >= 0) {
     $add_query = ' LIMIT ' . ($limit_from > 0 ? $limit_from . ', ' : '') . $limit_to;
 } else {
     $add_query = '';
 }
 $is_view = PMA_Table::isView($db, $table);
 if ($whatStrucOrData == 'structure' || $whatStrucOrData == 'structure_and_data') {
     if (!$export_plugin->exportStructure($db, $table, $crlf, $err_url, $is_view ? 'create_view' : 'create_table', $export_type, $do_relation, $do_comments, $do_mime, $do_dates)) {
         break;
     }
 }
 // If this is an export of a single view, we have to export data;
 // for example, a PDF report
 // if it is a merge table, no data is exported
 if (($whatStrucOrData == 'data' || $whatStrucOrData == 'structure_and_data') && !PMA_Table::isMerge($db, $table)) {
     if (!empty($sql_query)) {
         // only preg_replace if needed
         if (!empty($add_query)) {
             // remove trailing semicolon before adding a LIMIT
             $sql_query = preg_replace('%;\\s*$%', '', $sql_query);
         }
         $local_query = $sql_query . $add_query;
         $GLOBALS['dbi']->selectDb($db);
     } else {
         $local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . $add_query;
     }
     if (!$export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) {
         break;
     }
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:31,代码来源:export.php

示例12: PMA_exportDatabase

/**
 * Export at the database level
 *
 * @param string       $db              the database to export
 * @param array        $tables          the tables to export
 * @param string       $whatStrucOrData structure or data or both
 * @param array        $table_structure whether to export structure for each table
 * @param array        $table_data      whether to export data for each table
 * @param ExportPlugin $export_plugin   the selected export plugin
 * @param string       $crlf            end of line character(s)
 * @param string       $err_url         the URL in case of error
 * @param string       $export_type     the export type
 * @param bool         $do_relation     whether to export relation info
 * @param bool         $do_comments     whether to add comments
 * @param bool         $do_mime         whether to add MIME info
 * @param bool         $do_dates        whether to add dates
 * @param array        $aliases         Alias information for db/table/column
 * @param string       $separate_files  whether it is a separate-files export
 *
 * @return void
 */
function PMA_exportDatabase($db, $tables, $whatStrucOrData, $table_structure, $table_data, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases, $separate_files)
{
    $db_alias = !empty($aliases[$db]['alias']) ? $aliases[$db]['alias'] : '';
    if (!$export_plugin->exportDBHeader($db, $db_alias)) {
        return;
    }
    if (!$export_plugin->exportDBCreate($db, $export_type, $db_alias)) {
        return;
    }
    if ($separate_files == 'database') {
        PMA_saveObjectInBuffer('database', true);
    }
    if (($GLOBALS['sql_structure_or_data'] == 'structure' || $GLOBALS['sql_structure_or_data'] == 'structure_and_data') && isset($GLOBALS['sql_procedure_function'])) {
        $export_plugin->exportRoutines($db, $aliases);
        if ($separate_files == 'database') {
            PMA_saveObjectInBuffer('routines');
        }
    }
    $views = array();
    foreach ($tables as $table) {
        $_table = new PMA_Table($table, $db);
        // if this is a view, collect it for later;
        // views must be exported after the tables
        $is_view = $_table->isView();
        if ($is_view) {
            $views[] = $table;
        }
        if (($whatStrucOrData == 'structure' || $whatStrucOrData == 'structure_and_data') && in_array($table, $table_structure)) {
            // for a view, export a stand-in definition of the table
            // to resolve view dependencies (only when it's a single-file export)
            if ($is_view) {
                if ($separate_files == '' && isset($GLOBALS['sql_create_view']) && !$export_plugin->exportStructure($db, $table, $crlf, $err_url, 'stand_in', $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)) {
                    break;
                }
            } else {
                if (isset($GLOBALS['sql_create_table'])) {
                    $table_size = $GLOBALS['maxsize'];
                    // Checking if the maximum table size constrain has been set
                    // And if that constrain is a valid number or not
                    if ($table_size !== '' && is_numeric($table_size)) {
                        // This obtains the current table's size
                        $query = 'SELECT data_length + index_length
                          from information_schema.TABLES
                          WHERE table_schema = "' . $db . '"
                          AND table_name = "' . $table . '"';
                        $size = $GLOBALS['dbi']->fetchValue($query);
                        //Converting the size to MB
                        $size = $size / 1024 / 1024;
                        if ($size > $table_size) {
                            continue;
                        }
                    }
                    if (!$export_plugin->exportStructure($db, $table, $crlf, $err_url, 'create_table', $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)) {
                        break;
                    }
                }
            }
        }
        // if this is a view or a merge table, don't export data
        if (($whatStrucOrData == 'data' || $whatStrucOrData == 'structure_and_data') && in_array($table, $table_data) && !($is_view || $_table->isMerge())) {
            $local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table);
            if (!$export_plugin->exportData($db, $table, $crlf, $err_url, $local_query, $aliases)) {
                break;
            }
        }
        // this buffer was filled, we save it and go to the next one
        if ($separate_files == 'database') {
            PMA_saveObjectInBuffer('table_' . $table);
        }
        // now export the triggers (needs to be done after the data because
        // triggers can modify already imported tables)
        if (isset($GLOBALS['sql_create_trigger']) && ($whatStrucOrData == 'structure' || $whatStrucOrData == 'structure_and_data') && in_array($table, $table_structure)) {
            if (!$export_plugin->exportStructure($db, $table, $crlf, $err_url, 'triggers', $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)) {
                break;
            }
            if ($separate_files == 'database') {
                PMA_saveObjectInBuffer('table_' . $table, true);
            }
        }
//.........这里部分代码省略.........
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:101,代码来源:export.lib.php

示例13:

 // $allrows comes from the form when "Dump all rows" has been selected
 if ($allrows == '0' && $limit_to > 0 && $limit_from >= 0) {
     $add_query = ' LIMIT ' . ($limit_from > 0 ? $limit_from . ', ' : '') . $limit_to;
 } else {
     $add_query = '';
 }
 $is_view = PMA_Table::isView($db, $table);
 if (isset($GLOBALS[$what . '_structure'])) {
     if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'create_view' : 'create_table', $export_type)) {
         break;
     }
 }
 // If this is an export of a single view, we have to export data;
 // for example, a PDF report
 // if it is a merge table, no data is exported
 if (isset($GLOBALS[$what . '_data']) && !PMA_Table::isMerge($db, $table)) {
     if (!empty($sql_query)) {
         // only preg_replace if needed
         if (!empty($add_query)) {
             // remove trailing semicolon before adding a LIMIT
             $sql_query = preg_replace('%;\\s*$%', '', $sql_query);
         }
         $local_query = $sql_query . $add_query;
         PMA_DBI_select_db($db);
     } else {
         $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
     }
     if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
         break;
     }
 }
开发者ID:shishenkov,项目名称:zpanel,代码行数:31,代码来源:export.php

示例14: PMA_exportTable

/**
 * Export at the table level
 *
 * @param string       $db              the database to export
 * @param string       $table           the table to export
 * @param string       $whatStrucOrData structure or data or both
 * @param ExportPlugin $export_plugin   the selected export plugin
 * @param string       $crlf            end of line character(s)
 * @param string       $err_url         the URL in case of error
 * @param string       $export_type     the export type
 * @param bool         $do_relation     whether to export relation info
 * @param bool         $do_comments     whether to add comments
 * @param bool         $do_mime         whether to add MIME info
 * @param bool         $do_dates        whether to add dates
 * @param string       $allrows         whether "dump all rows" was ticked
 * @param string       $limit_to        upper limit
 * @param string       $limit_from      starting limit
 * @param string       $sql_query       query for which exporting is requested
 * @param array        $aliases         Alias information for db/table/column
 *
 * @return void
 */
function PMA_exportTable($db, $table, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $allrows, $limit_to, $limit_from, $sql_query, $aliases)
{
    $db_alias = !empty($aliases[$db]['alias']) ? $aliases[$db]['alias'] : '';
    if (!$export_plugin->exportDBHeader($db, $db_alias)) {
        return;
    }
    if (isset($allrows) && $allrows == '0' && $limit_to > 0 && $limit_from >= 0) {
        $add_query = ' LIMIT ' . ($limit_from > 0 ? $limit_from . ', ' : '') . $limit_to;
    } else {
        $add_query = '';
    }
    $_table = new PMA_Table($table, $db);
    $is_view = $_table->isView();
    if ($whatStrucOrData == 'structure' || $whatStrucOrData == 'structure_and_data') {
        if ($is_view) {
            if (isset($GLOBALS['sql_create_view'])) {
                if (!$export_plugin->exportStructure($db, $table, $crlf, $err_url, 'create_view', $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)) {
                    return;
                }
            }
        } else {
            if (isset($GLOBALS['sql_create_table'])) {
                if (!$export_plugin->exportStructure($db, $table, $crlf, $err_url, 'create_table', $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)) {
                    return;
                }
            }
        }
    }
    // If this is an export of a single view, we have to export data;
    // for example, a PDF report
    // if it is a merge table, no data is exported
    $table = new PMA_Table($table, $db);
    if (($whatStrucOrData == 'data' || $whatStrucOrData == 'structure_and_data') && !$table->isMerge()) {
        if (!empty($sql_query)) {
            // only preg_replace if needed
            if (!empty($add_query)) {
                // remove trailing semicolon before adding a LIMIT
                $sql_query = preg_replace('%;\\s*$%', '', $sql_query);
            }
            $local_query = $sql_query . $add_query;
            $GLOBALS['dbi']->selectDb($db);
        } else {
            $local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . $add_query;
        }
        if (!$export_plugin->exportData($db, $table, $crlf, $err_url, $local_query, $aliases)) {
            return;
        }
    }
    // now export the triggers (needs to be done after the data because
    // triggers can modify already imported tables)
    if (isset($GLOBALS['sql_create_trigger']) && ($whatStrucOrData == 'structure' || $whatStrucOrData == 'structure_and_data')) {
        if (!$export_plugin->exportStructure($db, $table, $crlf, $err_url, 'triggers', $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)) {
            return;
        }
    }
    if (!$export_plugin->exportDBFooter($db)) {
        return;
    }
    if (isset($GLOBALS['sql_metadata'])) {
        // Types of metadata to export.
        // In the future these can be allowed to be selected by the user
        $metadataTypes = PMA_getMetadataTypesToExport();
        $export_plugin->exportMetadata($db, $table, $metadataTypes);
    }
}
开发者ID:scriptpazar,项目名称:phpmyadmin,代码行数:87,代码来源:export.lib.php

示例15: __

    <?php 
if ($export_type == 'server') {
    echo '<h3>' . __('Database(s):') . '</h3>';
} else {
    if ($export_type == 'database') {
        echo '<h3>' . __('Table(s):') . '</h3>';
    }
}
if (!empty($multi_values)) {
    echo $multi_values;
}
?>
</div>

<?php 
if (strlen($table) && !isset($num_tables) && !PMA_Table::isMerge($db, $table)) {
    ?>
    <div class="exportoptions" id="rows">
        <h3><?php 
    echo __('Rows:');
    ?>
</h3>
        <ul>
            <li>
                <?php 
    if (isset($_GET['allrows']) && $_GET['allrows'] == 1) {
        echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" />';
    } else {
        echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
    }
    echo '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>';
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:31,代码来源:display_export.lib.php


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