} } } /** * Displays the links */ require './libraries/server_links.inc.php'; /** * Displays the sub-page heading */ echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"' . ' height="16" alt="" />' : '') . ($dbstats ? $strDatabasesStats : $strDatabases) . "\n" . '</h2>' . "\n"; /** * Gets the databases list */ if ($server > 0) { $databases = PMA_DBI_get_databases_full(null, $dbstats, null, $sort_by, $sort_order, $pos, true); $databases_count = $PMA_List_Database->count(); } else { $databases_count = 0; } /** * Displays the page */ if ($databases_count > 0) { reset($databases); $first_database = current($databases); // table col order // there is no db specific collation or charset prior 4.1.0 if (PMA_MYSQL_INT_VERSION >= 40100) { $column_order['DEFAULT_COLLATION_NAME'] = array('disp_name' => $strCollation, 'description_function' => 'PMA_getCollationDescr', 'format' => 'string', 'footer' => PMA_getServerCollation()); }
* Displays the main page when none of the following buttons is pressed */ if (!isset($_REQUEST['submit_connect']) && !isset($_REQUEST['synchronize_db']) && !isset($_REQUEST['Table_ids'])) { /** * Displays the sub-page heading */ echo '<h2>' . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_sync.png" width="18"' . ' height="18" alt="" />' : '') . $strSynchronize . '</h2>'; echo '<div id="serverstatus"> <form name="connection_form" id="connection_form" method="post" action="server_synchronize.php" >' . PMA_generate_common_hidden_inputs('', ''); echo '<fieldset>'; echo '<legend>' . $GLOBALS['strSynchronize'] . '</legend>'; /** * Displays the forms */ $databases = PMA_DBI_get_databases_full(null, false, null, 'SCHEMA_NAME', 'ASC', 0, true); foreach ($cons as $type) { echo '<table id="serverconnection_' . $type . '_remote" class="data"> <tr> <th colspan="2">' . $GLOBALS['strDatabase_' . $type] . '</th> </tr> <tr class="odd"> <td colspan="2" style="text-align: center"> <select name="' . $type . '_type" id="' . $type . '_type"> <option value="rmt">' . $GLOBALS['strRemoteServer'] . '</option> <option value="cur">' . $GLOBALS['strCurrentServer'] . '</option> </select> </td> </tr> <tr class="even" id="' . $type . 'tr1"> <td>' . $GLOBALS['strHost'] . '</td>
} } } /** * Displays the links */ require './libraries/server_links.inc.php'; /** * Displays the sub-page heading */ echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"' . ' height="16" alt="" />' : '') . ($dbstats ? $strDatabasesStats : $strDatabases) . "\n" . '</h2>' . "\n"; /** * Gets the databases list */ if ($server > 0) { $databases = PMA_DBI_get_databases_full(null, $dbstats); } else { $databases = array(); } /** * Displays the page */ $tmp_count = count($databases); if ($tmp_count > 0) { if ($tmp_count > 1) { // sorts the array usort($databases, 'PMA_dbCmp'); } else { // when there is only one database, the sort would not happen and // the index would not become numeric (reproduced in MySQL 3.23.52) $tmp_each = each($databases);
/** * Generate table html when SQL statement have multiple queries * which return displayable results * * @param PMA_DisplayResults $displayResultsObject object * @param string $db database name * @param array $sql_data information about SQL statement * @param string $goto URL to go back in case of errors * @param string $pmaThemeImage path for theme images directory * @param string $text_dir text direction * @param string $printview whether printview is enabled * @param string $url_query URL query * @param array $disp_mode the display mode * @param string $sql_limit_to_append limit clause * @param bool $editable whether result set is editable * * @return string $table_html html content */ function getTableHtmlForMultipleQueries($displayResultsObject, $db, $sql_data, $goto, $pmaThemeImage, $text_dir, $printview, $url_query, $disp_mode, $sql_limit_to_append, $editable) { $table_html = ''; $tables_array = PMA_DBI_get_tables($db); $databases_array = PMA_DBI_get_databases_full(); $multi_sql = implode(";", $sql_data['valid_sql']); $querytime_before = array_sum(explode(' ', microtime())); // Assignment for variable is not needed since the results are // looiping using the connection @PMA_DBI_try_multi_query($multi_sql); $querytime_after = array_sum(explode(' ', microtime())); $querytime = $querytime_after - $querytime_before; $sql_no = 0; do { $analyzed_sql = array(); $is_affected = false; $result = PMA_DBI_store_result(); $fields_meta = $result !== false ? PMA_DBI_get_fields_meta($result) : array(); $fields_cnt = count($fields_meta); // Initialize needed params related to each query in multiquery statement if (isset($sql_data['valid_sql'][$sql_no])) { // 'Use' query can change the database if (stripos($sql_data['valid_sql'][$sql_no], "use ")) { $db = PMA_getNewDatabase($sql_data['valid_sql'][$sql_no], $databases_array); } $parsed_sql = PMA_SQP_parse($sql_data['valid_sql'][$sql_no]); $table = PMA_getTableNameBySQL($sql_data['valid_sql'][$sql_no], $tables_array); $analyzed_sql = PMA_SQP_analyze($parsed_sql); $is_select = isset($analyzed_sql[0]['queryflags']['select_from']); $unlim_num_rows = PMA_Table::countRecords($db, $table, true); $showtable = PMA_Table::sGetStatusInfo($db, $table, null, true); $url_query = PMA_generate_common_url($db, $table); list($is_group, $is_func, $is_count, $is_export, $is_analyse, $is_explain, $is_delete, $is_affected, $is_insert, $is_replace, $is_show, $is_maint) = PMA_getDisplayPropertyParams($sql_data['valid_sql'][$sql_no], $is_select); // Handle remembered sorting order, only for single table query if ($GLOBALS['cfg']['RememberSorting'] && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['select_expr']) && count($analyzed_sql[0]['select_expr']) == 0 && isset($analyzed_sql[0]['queryflags']['select_from']) && count($analyzed_sql[0]['table_ref']) == 1) { PMA_handleSortOrder($db, $table, $analyzed_sql, $sql_data['valid_sql'][$sql_no]); } // Do append a "LIMIT" clause? if ($_SESSION['tmp_user_values']['max_rows'] != 'all' && !($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['queryflags']['select_from']) && !isset($analyzed_sql[0]['queryflags']['offset']) && empty($analyzed_sql[0]['limit_clause'])) { $sql_limit_to_append = ' LIMIT ' . $_SESSION['tmp_user_values']['pos'] . ', ' . $_SESSION['tmp_user_values']['max_rows'] . " "; $sql_data['valid_sql'][$sql_no] = PMA_getSqlWithLimitClause($sql_data['valid_sql'][$sql_no], $analyzed_sql, $sql_limit_to_append); } // Set the needed properties related to executing sql query $displayResultsObject->__set('db', $db); $displayResultsObject->__set('table', $table); $displayResultsObject->__set('goto', $goto); } if (!$is_affected) { $num_rows = $result ? @PMA_DBI_num_rows($result) : 0; } elseif (!isset($num_rows)) { $num_rows = @PMA_DBI_affected_rows(); } if (isset($sql_data['valid_sql'][$sql_no])) { $displayResultsObject->__set('sql_query', $sql_data['valid_sql'][$sql_no]); $displayResultsObject->setProperties($unlim_num_rows, $fields_meta, $is_count, $is_export, $is_func, $is_analyse, $num_rows, $fields_cnt, $querytime, $pmaThemeImage, $text_dir, $is_maint, $is_explain, $is_show, $showtable, $printview, $url_query, $editable); } if ($num_rows == 0) { continue; } // With multiple results, operations are limied $disp_mode = 'nnnn000000'; $is_limited_display = true; // Collect the tables $table_html .= $displayResultsObject->getTable($result, $disp_mode, $analyzed_sql, $is_limited_display); // Free the result to save the memory PMA_DBI_free_result($result); $sql_no++; } while (PMA_DBI_more_results() && PMA_DBI_next_result()); return $table_html; }
} } } /** * Displays the links */ require './server_links.inc.php'; /** * Displays the sub-page heading */ echo '<h2>' . "\n" . ($GLOBALS['cfg']['MainPageIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_db.png" width="16"' . ' height="16" alt="" />' : '') . ($dbstats ? $strDatabasesStats : $strDatabases) . "\n" . '</h2>' . "\n"; /** * Gets the databases list */ if ($server > 0) { $databases = PMA_DBI_get_databases_full(NULL, $dbstats); } else { $databases = array(); } /** * Displays the page */ if (count($databases) > 0) { // sorts the array usort($databases, 'PMA_dbCmp'); // table col order // there is no db specific collation or charset prior 4.1.0 if (PMA_MYSQL_INT_VERSION >= 40100) { $column_order['DEFAULT_COLLATION_NAME'] = array('disp_name' => $strCollation, 'description_function' => 'PMA_getCollationDescr', 'format' => 'string', 'footer' => PMA_getServerCollation()); } $column_order['SCHEMA_TABLES'] = array('disp_name' => $strNumTables, 'format' => 'number', 'footer' => 0);