bug #1766975 Parameters lost when editing stored routine

This commit is contained in:
Marc Delisle
2007-08-09 17:43:40 +00:00
parent fe30b1f13b
commit bc6e992d1c
2 changed files with 11 additions and 10 deletions

View File

@@ -96,6 +96,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ [lang] Spanish update, thanks to Daniel Hinostroza + [lang] Spanish update, thanks to Daniel Hinostroza
. [export] Do not obey $cfg['MaxTableList'] on database export . [export] Do not obey $cfg['MaxTableList'] on database export
- [doc] UploadDir and the Import tab, thanks to Juergen Wind - [doc] UploadDir and the Import tab, thanks to Juergen Wind
- bug #1766975 Parameters lost when editing stored routine
2.10.3.0 (2007-07-20) 2.10.3.0 (2007-07-20)

View File

@@ -5,7 +5,6 @@
* @version $Id$ * @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
@@ -40,14 +39,15 @@ if (PMA_MYSQL_INT_VERSION >= 50002) {
$ct=0; $ct=0;
$delimiter = '//'; $delimiter = '//';
foreach ($routines as $routine) { foreach ($routines as $routine) {
$drop_and_create = '\'DROP ' . $routine['ROUTINE_TYPE'] . ' ' . PMA_backquote($routine['SPECIFIC_NAME']) . $delimiter . "\n"
. 'CREATE ' . $routine['ROUTINE_TYPE'] . ' ' . PMA_backquote($routine['SPECIFIC_NAME']) . '()' . "\n" . '\'';
$sql = sprintf('SELECT CONCAT(' . $drop_and_create . ',ROUTINE_DEFINITION,\'\n//\') AS DEFINITION // information_schema (at least in MySQL 5.0.45)
FROM information_schema.ROUTINES // does not return the routine parameters
WHERE SPECIFIC_NAME=\'%s\'', // so we rely on PMA_DBI_get_procedure_or_function_def() which
$routine['SPECIFIC_NAME']); // uses SHOW CREATE
$definition = PMA_DBI_fetch_value($sql);
$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'])
. "\n";
//if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') { //if ($routine['ROUTINE_TYPE'] == 'PROCEDURE') {
// $sqlUseProc = 'CALL ' . $routine['SPECIFIC_NAME'] . '()'; // $sqlUseProc = 'CALL ' . $routine['SPECIFIC_NAME'] . '()';
@@ -61,9 +61,9 @@ if (PMA_MYSQL_INT_VERSION >= 50002) {
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 ' . $routine['SPECIFIC_NAME']; $sqlDropProc = 'DROP PROCEDURE ' . PMA_backquote($routine['SPECIFIC_NAME']);
} else { } else {
$sqlDropProc = 'DROP FUNCTION ' . $routine['SPECIFIC_NAME']; $sqlDropProc = 'DROP FUNCTION ' . PMA_backquote($routine['SPECIFIC_NAME']);
} }
echo sprintf('<tr class="%s"> echo sprintf('<tr class="%s">
<td><b>%s</b></td> <td><b>%s</b></td>