The branch, master has been updated
via 79f746198eeea63e17a85bddacbddb3c48663e7b (commit)
via 8f1aca48180621de54a24472a6c10af412fdd947 (commit)
via 4e4456e9b87720ea9e1c426e9efc381356b68c3d (commit)
via 39b0f4d34bff1815ff37241ea4c47698e6d4f935 (commit)
from f2842a22bf179b93a7eeebd034ed9302fb781e97 (commit)
- Log -----------------------------------------------------------------
commit 79f746198eeea63e17a85bddacbddb3c48663e7b
Merge: 8f1aca4 f2842a2
Author: Rouslan Placella <[email protected]>
Date: Tue Aug 16 14:02:40 2011 +0100
Merge remote-tracking branch 'origin/master'
commit 8f1aca48180621de54a24472a6c10af412fdd947
Author: Rouslan Placella <[email protected]>
Date: Tue Aug 16 14:02:16 2011 +0100
MySQL allows a function and a procedure with the same name in the same db.
This case was unhandled.
commit 4e4456e9b87720ea9e1c426e9efc381356b68c3d
Author: Rouslan Placella <[email protected]>
Date: Tue Aug 16 12:36:38 2011 +0100
Fixed wrong permission check for "Drop Routine" action
commit 39b0f4d34bff1815ff37241ea4c47698e6d4f935
Author: Rouslan Placella <[email protected]>
Date: Tue Aug 16 12:35:43 2011 +0100
Fixed wrong destination page on "Drop Routine" action
-----------------------------------------------------------------------
Summary of changes:
libraries/rte/rte_export.lib.php | 21 +++++++++++----------
libraries/rte/rte_list.lib.php | 10 +++++++---
libraries/rte/rte_routines.lib.php | 20 +++++++++++++-------
3 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/libraries/rte/rte_export.lib.php b/libraries/rte/rte_export.lib.php
index d4d8f99..8cac214 100644
--- a/libraries/rte/rte_export.lib.php
+++ b/libraries/rte/rte_export.lib.php
@@ -70,16 +70,17 @@ function PMA_RTN_handleExport()
{
global $_GET, $db;
- if (! empty($_GET['export_item']) && ! empty($_GET['item_name'])) {
- $item_name = $_GET['item_name'];
- $type = PMA_DBI_fetch_value(
- "SELECT ROUTINE_TYPE " .
- "FROM INFORMATION_SCHEMA.ROUTINES " .
- "WHERE ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' " .
- "AND SPECIFIC_NAME='" . PMA_sqlAddSlashes($item_name) . "';"
- );
- $export_data = PMA_DBI_get_definition($db, $type, $item_name);
- PMA_RTE_handleExport($item_name, $export_data);
+ if ( ! empty($_GET['export_item'])
+ && ! empty($_GET['item_name'])
+ && ! empty($_GET['item_type'])
+ ) {
+ if ($_GET['item_type'] == 'FUNCTION' || $_GET['item_type'] ==
'PROCEDURE') {
+ $export_data = PMA_DBI_get_definition(
+ $db,
+ $_GET['item_type'],
+ $_GET['item_name']);
+ PMA_RTE_handleExport($_GET['item_name'], $export_data);
+ }
}
} // end PMA_RTN_handleExport()
diff --git a/libraries/rte/rte_list.lib.php b/libraries/rte/rte_list.lib.php
index 3b6177d..19e8e64 100644
--- a/libraries/rte/rte_list.lib.php
+++ b/libraries/rte/rte_list.lib.php
@@ -117,7 +117,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
$sql_drop = sprintf('DROP %s IF EXISTS %s',
$routine['ROUTINE_TYPE'],
PMA_backquote($routine['SPECIFIC_NAME']));
-
+ $type_link = "item_type={$routine['ROUTINE_TYPE']}";
$retval = " <tr class='noclick $rowclass'>\n";
$retval .= " <td>\n";
@@ -136,6 +136,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
. $url_query
. '&edit_item=1'
. '&item_name=' .
urlencode($routine['SPECIFIC_NAME'])
+ . '&' . $type_link
. '">' . $titles['Edit'] . "</a>\n";
} else {
$retval .= " {$titles['NoEdit']}\n";
@@ -150,6 +151,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
// otherwise we can execute it directly.
$routine_details = PMA_RTN_getDataFromName(
$routine['SPECIFIC_NAME'],
+ $routine['ROUTINE_TYPE'],
false
);
if ($routine !== false) {
@@ -168,6 +170,7 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
. $url_query
. '&' . $execute_action . '=1'
. '&item_name=' .
urlencode($routine['SPECIFIC_NAME'])
+ . '&' . $type_link
. '">' . $titles['Execute'] .
"</a>\n";
}
} else {
@@ -180,15 +183,16 @@ function PMA_RTN_getRowForList($routine, $rowclass = '')
. $url_query
. '&export_item=1'
. '&item_name=' .
urlencode($routine['SPECIFIC_NAME'])
+ . '&' . $type_link
. '">' . $titles['Export'] . "</a>\n";
$retval .= " </td>\n";
$retval .= " <td>\n";
- if (PMA_currentUserHasPrivilege('EVENT', $db)) {
+ if (PMA_currentUserHasPrivilege('ALTER ROUTINE', $db)) {
$retval .= ' <a ' . $ajax_class['drop']
. ' href="sql.php?'
. $url_query
. '&sql_query=' .
urlencode($sql_drop)
- . '&goto=db_events.php' .
urlencode("?db={$db}")
+ . '&goto=db_routines.php' .
urlencode("?db={$db}")
. '" >' . $titles['Drop'] . "</a>\n";
} else {
$retval .= " {$titles['NoDrop']}\n";
diff --git a/libraries/rte/rte_routines.lib.php
b/libraries/rte/rte_routines.lib.php
index 3e63603..8cd0529 100644
--- a/libraries/rte/rte_routines.lib.php
+++ b/libraries/rte/rte_routines.lib.php
@@ -304,7 +304,9 @@ function PMA_RTN_handleEditor()
$extra_data = array();
if ($message->isSuccess()) {
$columns = "`SPECIFIC_NAME`, `ROUTINE_NAME`, `ROUTINE_TYPE`,
`DTD_IDENTIFIER`, `ROUTINE_DEFINITION`";
- $where = "ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "'
AND ROUTINE_NAME='" . PMA_sqlAddSlashes($_REQUEST['item_name']) . "'";
+ $where = "ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' "
+ . "AND ROUTINE_NAME='" .
PMA_sqlAddSlashes($_REQUEST['item_name']) . "'"
+ . "AND ROUTINE_TYPE='" .
PMA_sqlAddSlashes($_REQUEST['item_type']) . "'";
$routine = PMA_DBI_fetch_single_row("SELECT $columns FROM
`INFORMATION_SCHEMA`.`ROUTINES` WHERE $where;");
$extra_data['name'] =
htmlspecialchars(strtoupper($_REQUEST['item_name']));
$extra_data['new_row'] = PMA_RTN_getRowForList($routine);
@@ -343,7 +345,7 @@ function PMA_RTN_handleEditor()
} else if (! empty($_REQUEST['edit_item'])) {
$title = __("Edit routine");
if (! $operation && ! empty($_REQUEST['item_name']) &&
empty($_REQUEST['editor_process_edit'])) {
- $routine = PMA_RTN_getDataFromName($_REQUEST['item_name']);
+ $routine = PMA_RTN_getDataFromName($_REQUEST['item_name'],
$_REQUEST['item_type']);
if ($routine !== false) {
$routine['item_original_name'] = $routine['item_name'];
$routine['item_original_type'] = $routine['item_type'];
@@ -501,12 +503,13 @@ function PMA_RTN_getDataFromRequest()
* the "Edit routine" form given the name of a routine.
*
* @param string $name The name of the routine.
+ * @param string $type Type of routine (ROUTINE|PROCEDURE)
* @param bool $all Whether to return all data or just
* the info about parameters.
*
* @return array Data necessary to create the routine editor.
*/
-function PMA_RTN_getDataFromName($name, $all = true)
+function PMA_RTN_getDataFromName($name, $type, $all = true)
{
global $param_directions, $param_sqldataaccess, $db;
@@ -517,7 +520,8 @@ function PMA_RTN_getDataFromName($name, $all = true)
. "ROUTINE_DEFINITION, IS_DETERMINISTIC, SQL_DATA_ACCESS, "
. "ROUTINE_COMMENT, SECURITY_TYPE";
$where = "ROUTINE_SCHEMA='" . PMA_sqlAddSlashes($db) . "' "
- . "AND SPECIFIC_NAME='" . PMA_sqlAddSlashes($name) . "'";
+ . "AND SPECIFIC_NAME='" . PMA_sqlAddSlashes($name) . "'"
+ . "AND ROUTINE_TYPE='" . PMA_sqlAddSlashes($type) . "'";
$query = "SELECT $fields FROM INFORMATION_SCHEMA.ROUTINES WHERE $where;";
$routine = PMA_DBI_fetch_single_row($query);
@@ -1002,7 +1006,7 @@ function PMA_RTN_getQueryFromRequest()
$warned_about_dir = false;
$warned_about_name = false;
$warned_about_length = false;
- if (! empty($_REQUEST['item_param_name'])
+ if ( ! empty($_REQUEST['item_param_name'])
&& ! empty($_REQUEST['item_param_type'])
&& ! empty($_REQUEST['item_param_length'])
&& is_array($_REQUEST['item_param_name'])
@@ -1124,7 +1128,7 @@ function PMA_RTN_handleExecute()
*/
if (! empty($_REQUEST['execute_routine']) && !
empty($_REQUEST['item_name'])) {
// Build the queries
- $routine = PMA_RTN_getDataFromName($_REQUEST['item_name'], false);
+ $routine = PMA_RTN_getDataFromName($_REQUEST['item_name'],
$_REQUEST['item_type'], false);
if ($routine !== false) {
$queries = array();
$end_query = array();
@@ -1279,7 +1283,7 @@ function PMA_RTN_handleExecute()
/**
* Display the execute form for a routine.
*/
- $routine = PMA_RTN_getDataFromName($_GET['item_name'], false);
+ $routine = PMA_RTN_getDataFromName($_GET['item_name'],
$_GET['item_type'], true);
if ($routine !== false) {
$form = PMA_RTN_getExecuteForm($routine);
if ($GLOBALS['is_ajax_request'] == true) {
@@ -1336,6 +1340,8 @@ function PMA_RTN_getExecuteForm($routine)
$retval .= "<form action='db_routines.php' method='post'
class='rte_form'>\n";
$retval .= "<input type='hidden' name='item_name'\n";
$retval .= " value='{$routine['item_name']}' />\n";
+ $retval .= "<input type='hidden' name='item_type'\n";
+ $retval .= " value='{$routine['item_type']}' />\n";
$retval .= PMA_generate_common_hidden_inputs($db) . "\n";
$retval .= "<fieldset>\n";
if ($GLOBALS['is_ajax_request'] != true) {
hooks/post-receive
--
phpMyAdmin
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git