removed MySQL < 5 code

This commit is contained in:
Sebastian Mendel
2007-10-02 09:11:40 +00:00
parent 27492912a2
commit 1f6d6d419b
2 changed files with 61 additions and 67 deletions

View File

@@ -9,7 +9,6 @@
* *
* staybyte: speedup view on locked tables - 11 June 2001 * staybyte: speedup view on locked tables - 11 June 2001
* *
* @uses PMA_MYSQL_INT_VERSION
* @uses $cfg['ShowStats'] * @uses $cfg['ShowStats']
* @uses $cfg['ShowTooltip'] * @uses $cfg['ShowTooltip']
* @uses $cfg['ShowTooltipAliasTB'] * @uses $cfg['ShowTooltipAliasTB']
@@ -108,7 +107,7 @@ $is_show_stats = $cfg['ShowStats'];
*/ */
$db_is_information_schema = false; $db_is_information_schema = false;
if (PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema') { if ($db == 'information_schema') {
$is_show_stats = false; $is_show_stats = false;
$db_is_information_schema = true; $db_is_information_schema = true;
} }
@@ -207,7 +206,7 @@ if (! isset($sot_ready)) {
$total_num_tables = count($tables); $total_num_tables = count($tables);
if (isset($sub_part) && $sub_part == '_export') { if (isset($sub_part) && $sub_part == '_export') {
// (don't fetch only a subset if we are coming from db_export.php, // (don't fetch only a subset if we are coming from db_export.php,
// because I think it's too risky to display only a subset of the // because I think it's too risky to display only a subset of the
// table names when exporting a db) // table names when exporting a db)
/** /**
* *

View File

@@ -2,10 +2,6 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */ /* vim: set expandtab sw=4 ts=4 sts=4: */
/** /**
* *
* @version $Id$
*/
/**
* @todo Support seeing the "results" of the called procedure or * @todo Support seeing the "results" of the called procedure or
* function. This needs further reseach because a procedure * function. This needs further reseach because a procedure
* does not necessarily contain a SELECT statement that * does not necessarily contain a SELECT statement that
@@ -16,73 +12,72 @@
* our current sql.php. * our current sql.php.
* Of course the interface would need a way to pass calling parameters. * Of course the interface would need a way to pass calling parameters.
* Also, support DEFINER (like we do in export). * Also, support DEFINER (like we do in export).
* @version $Id$
*/ */
if (PMA_MYSQL_INT_VERSION >= 50002) { $url_query .= '&amp;goto=db_structure.php';
$url_query .= '&amp;goto=db_structure.php';
$routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';'); $routines = PMA_DBI_fetch_result('SELECT SPECIFIC_NAME,ROUTINE_NAME,ROUTINE_TYPE,DTD_IDENTIFIER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA= \'' . PMA_sqlAddslashes($db,true) . '\';');
if ($routines) { if ($routines) {
echo '<fieldset>' . "\n"; echo '<fieldset>' . "\n";
echo ' <legend>' . $strRoutines . '</legend>' . "\n"; echo ' <legend>' . $strRoutines . '</legend>' . "\n";
echo '<table border="0">'; echo '<table border="0">';
echo sprintf('<tr> echo sprintf('<tr>
<th>%s</th> <th>%s</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>%s</th> <th>%s</th>
<th>%s</th> <th>%s</th>
</tr>', </tr>',
$strName, $strName,
$strType, $strType,
$strRoutineReturnType); $strRoutineReturnType);
$ct=0; $ct=0;
$delimiter = '//'; $delimiter = '//';
foreach ($routines as $routine) { foreach ($routines as $routine) {
// information_schema (at least in MySQL 5.0.45) // information_schema (at least in MySQL 5.0.45)
// does not return the routine parameters // does not return the routine parameters
// so we rely on PMA_DBI_get_procedure_or_function_def() which // so we rely on PMA_DBI_get_procedure_or_function_def() which
// uses SHOW CREATE // uses SHOW CREATE
$definition = 'DROP ' . $routine['ROUTINE_TYPE'] . ' ' . PMA_backquote($routine['SPECIFIC_NAME']) . $delimiter . "\n" $definition = 'DROP ' . $routine['ROUTINE_TYPE'] . ' ' . PMA_backquote($routine['SPECIFIC_NAME']) . $delimiter . "\n"
. PMA_DBI_get_procedure_or_function_def($db, $routine['ROUTINE_TYPE'], $routine['SPECIFIC_NAME']) . PMA_DBI_get_procedure_or_function_def($db, $routine['ROUTINE_TYPE'], $routine['SPECIFIC_NAME'])
. "\n"; . "\n";
//if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') { //if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') {
// $sqlUseProc = 'CALL ' . $routine['SPECIFIC_NAME'] . '()'; // $sqlUseProc = 'CALL ' . $routine['SPECIFIC_NAME'] . '()';
//} else { //} else {
// $sqlUseProc = 'SELECT ' . $routine['SPECIFIC_NAME'] . '()'; // $sqlUseProc = 'SELECT ' . $routine['SPECIFIC_NAME'] . '()';
/* this won't get us far: to really use the function /* this won't get us far: to really use the function
i'd need to know how many parameters the function needs and then create i'd need to know how many parameters the function needs and then create
something to ask for them. As i don't see this directly in something to ask for them. As i don't see this directly in
the table i am afraid that requires parsing the ROUTINE_DEFINITION the table i am afraid that requires parsing the ROUTINE_DEFINITION
and i don't really need that now so i simply don't offer and i don't really need that now so i simply don't offer
a method for running the function*/ a method for running the function*/
//} //}
if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') { if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') {
$sqlDropProc = 'DROP PROCEDURE ' . PMA_backquote($routine['SPECIFIC_NAME']); $sqlDropProc = 'DROP PROCEDURE ' . PMA_backquote($routine['SPECIFIC_NAME']);
} else { } else {
$sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']); $sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']);
}
echo sprintf('<tr class="%s">
<td><b>%s</b></td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>',
($ct%2 == 0) ? 'even' : 'odd',
$routine['ROUTINE_NAME'],
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($definition) . '&amp;show_query=1&amp;delimiter=' . urlencode($delimiter), $titles['Structure']) : '&nbsp;',
//$routine['ROUTINE_TYPE'] == 'PROCEDURE' ? '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlUseProc) . '">' . $titles['Browse'] . '</a>' : '&nbsp;',
'<a href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDropProc) . '" onclick="return confirmLink(this, \'' . PMA_jsFormat($sqlDropProc, false) . '\')">' . $titles['Drop'] . '</a>',
$routine['ROUTINE_TYPE'],
$routine['DTD_IDENTIFIER']);
$ct++;
} }
echo '</table>'; echo sprintf('<tr class="%s">
echo '</fieldset>' . "\n"; <td><b>%s</b></td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
</tr>',
($ct%2 == 0) ? 'even' : 'odd',
$routine['ROUTINE_NAME'],
! empty($definition) ? PMA_linkOrButton('db_sql.php?' . $url_query . '&amp;sql_query=' . urlencode($definition) . '&amp;show_query=1&amp;delimiter=' . urlencode($delimiter), $titles['Structure']) : '&nbsp;',
//$routine['ROUTINE_TYPE'] == 'PROCEDURE' ? '<a href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlUseProc) . '">' . $titles['Browse'] . '</a>' : '&nbsp;',
'<a href="sql.php?' . $url_query . '&sql_query=' . urlencode($sqlDropProc) . '" onclick="return confirmLink(this, \'' . PMA_jsFormat($sqlDropProc, false) . '\')">' . $titles['Drop'] . '</a>',
$routine['ROUTINE_TYPE'],
$routine['DTD_IDENTIFIER']);
$ct++;
} }
echo '</table>';
echo '</fieldset>' . "\n";
} }
?> ?>