[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-8289-g9ca378d

Rouslan Placella roccivic at users.sourceforge.net
Thu Jul 14 13:58:31 CEST 2011


The branch, master has been updated
       via  9ca378d79454c5a021bfdd9f231c399cfe8355fc (commit)
       via  0e622faed642b3814ec140b287ad5ad7ad1655c7 (commit)
       via  d3fa11c19b27d3c7debfb70edbe1bc046a8e37bb (commit)
      from  ad87dcf884efa277fc9ed546e1986e511ae7928a (commit)


- Log -----------------------------------------------------------------
commit 9ca378d79454c5a021bfdd9f231c399cfe8355fc
Merge: ad87dcf884efa277fc9ed546e1986e511ae7928a 0e622faed642b3814ec140b287ad5ad7ad1655c7
Author: Rouslan Placella <rouslan at placella.com>
Date:   Thu Jul 14 12:57:31 2011 +0100

    Merge branch 'rte'

commit 0e622faed642b3814ec140b287ad5ad7ad1655c7
Author: Rouslan Placella <rouslan at placella.com>
Date:   Thu Jul 14 12:46:23 2011 +0100

    Removed redundant code from rte_routines.lib.php

commit d3fa11c19b27d3c7debfb70edbe1bc046a8e37bb
Author: Rouslan Placella <rouslan at placella.com>
Date:   Wed Jul 13 18:42:10 2011 +0100

    Move declarations of globals into functions, so that unit tests are possible

-----------------------------------------------------------------------

Summary of changes:
 libraries/rte/rte_events.lib.php   |   35 ++++++++++++++++++++++++++++
 libraries/rte/rte_main.inc.php     |   45 ------------------------------------
 libraries/rte/rte_routines.lib.php |   37 ++++++++++++++++------------
 libraries/rte/rte_triggers.lib.php |   16 ++++++++++++
 4 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/libraries/rte/rte_events.lib.php b/libraries/rte/rte_events.lib.php
index 070dc20..d7ffbc5 100644
--- a/libraries/rte/rte_events.lib.php
+++ b/libraries/rte/rte_events.lib.php
@@ -10,6 +10,40 @@ if (! defined('PHPMYADMIN')) {
 }
 
 /**
+ * Sets required globals
+ */
+function PMA_EVN_setGlobals()
+{
+    global $event_status, $event_type, $event_interval;
+
+    $event_status        = array(
+                               'query'   => array('ENABLE',
+                                                  'DISABLE',
+                                                  'DISABLE ON SLAVE'),
+                               'display' => array('ENABLED',
+                                                  'DISABLED',
+                                                  'SLAVESIDE_DISABLED')
+                           );
+    $event_type          = array('RECURRING',
+                                 'ONE TIME');
+    $event_interval      = array('YEAR',
+                                 'QUARTER',
+                                 'MONTH',
+                                 'DAY',
+                                 'HOUR',
+                                 'MINUTE',
+                                 'WEEK',
+                                 'SECOND',
+                                 'YEAR_MONTH',
+                                 'DAY_HOUR',
+                                 'DAY_MINUTE',
+                                 'DAY_SECOND',
+                                 'HOUR_MINUTE',
+                                 'HOUR_SECOND',
+                                 'MINUTE_SECOND');
+}
+
+/**
  * This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
  * rte_events.lib.php. It is used to retreive some language strings that are
  * used in functionalities that are common to routines, triggers and events.
@@ -40,6 +74,7 @@ function PMA_RTE_main()
 {
     global $db;
 
+    PMA_EVN_setGlobals();
     /**
      * Process all requests
      */
diff --git a/libraries/rte/rte_main.inc.php b/libraries/rte/rte_main.inc.php
index deae1d2..dd3e4c0 100644
--- a/libraries/rte/rte_main.inc.php
+++ b/libraries/rte/rte_main.inc.php
@@ -71,51 +71,6 @@ $titles = PMA_buildActionTitles();
  */
 $errors = array();
 
-// Some definitions for triggers
-$action_timings      = array('BEFORE',
-                             'AFTER');
-$event_manipulations = array('INSERT',
-                             'UPDATE',
-                             'DELETE');
-
-// Some definitions for routines
-$param_directions    = array('IN',
-                             'OUT',
-                             'INOUT');
-$param_opts_num      = array('UNSIGNED',
-                             'ZEROFILL',
-                             'UNSIGNED ZEROFILL');
-$param_sqldataaccess = array('NO SQL',
-                             'CONTAINS SQL',
-                             'READS SQL DATA',
-                             'MODIFIES SQL DATA');
-
-// Some definitions for events
-$event_status        = array(
-                           'query'   => array('ENABLE',
-                                              'DISABLE',
-                                              'DISABLE ON SLAVE'),
-                           'display' => array('ENABLED',
-                                              'DISABLED',
-                                              'SLAVESIDE_DISABLED')
-                       );
-$event_type          = array('RECURRING',
-                             'ONE TIME');
-$event_interval      = array('YEAR',
-                             'QUARTER',
-                             'MONTH',
-                             'DAY',
-                             'HOUR',
-                             'MINUTE',
-                             'WEEK',
-                             'SECOND',
-                             'YEAR_MONTH',
-                             'DAY_HOUR',
-                             'DAY_MINUTE',
-                             'DAY_SECOND',
-                             'HOUR_MINUTE',
-                             'HOUR_SECOND',
-                             'MINUTE_SECOND');
 /**
  * The below function is defined in rte_routines.lib.php,
  * rte_triggers.lib.php and rte_events.lib.php
diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php
index a5a136f..4172208 100644
--- a/libraries/rte/rte_routines.lib.php
+++ b/libraries/rte/rte_routines.lib.php
@@ -10,6 +10,25 @@ if (! defined('PHPMYADMIN')) {
 }
 
 /**
+ * Sets required globals
+ */
+function PMA_RTN_setGlobals()
+{
+    global $param_directions, $param_opts_num, $param_sqldataaccess;
+
+    $param_directions    = array('IN',
+                                 'OUT',
+                                 'INOUT');
+    $param_opts_num      = array('UNSIGNED',
+                                 'ZEROFILL',
+                                 'UNSIGNED ZEROFILL');
+    $param_sqldataaccess = array('NO SQL',
+                                 'CONTAINS SQL',
+                                 'READS SQL DATA',
+                                 'MODIFIES SQL DATA');
+}
+
+/**
  * This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
  * rte_events.lib.php. It is used to retreive some language strings that are
  * used in functionalities that are common to routines, triggers and events.
@@ -40,6 +59,7 @@ function PMA_RTE_main()
 {
     global $db;
 
+    PMA_RTN_setGlobals();
     /**
      * Process all requests
      */
@@ -1100,22 +1120,7 @@ function PMA_RTN_getQueryFromRequest()
     }
     $query .= " (" . $params . ") ";
     if ($_REQUEST['item_type'] == 'FUNCTION') {
-        // Make a flat array with column types
-        $columnTypes = array();
-        foreach ($cfg['ColumnTypes'] as $key => $value) {
-            if (is_array($value)) {
-                $columnTypes = array_merge($value, $columnTypes);
-            } else {
-                $columnTypes[] = $value;
-            }
-        }
-        foreach ($columnTypes as $key => $type) {
-            if ($type == '-') {
-                unset($columnTypes[$key]);
-            }
-        }
-        // Search the flat array for the supplied return type
-        if (! empty($_REQUEST['item_returntype']) && in_array($_REQUEST['item_returntype'], $columnTypes)) {
+        if (! empty($_REQUEST['item_returntype']) && in_array($_REQUEST['item_returntype'], PMA_getSupportedDatatypes())) {
             $query .= "RETURNS {$_REQUEST['item_returntype']}";
         } else {
             $errors[] = __('You must provide a valid return type for the routine.');
diff --git a/libraries/rte/rte_triggers.lib.php b/libraries/rte/rte_triggers.lib.php
index a80fca0..61b9943 100644
--- a/libraries/rte/rte_triggers.lib.php
+++ b/libraries/rte/rte_triggers.lib.php
@@ -10,6 +10,21 @@ if (! defined('PHPMYADMIN')) {
 }
 
 /**
+ * Sets required globals
+ */
+function PMA_TRI_setGlobals()
+{
+    global $action_timings, $event_manipulations;
+
+    // Some definitions for triggers
+    $action_timings      = array('BEFORE',
+                                 'AFTER');
+    $event_manipulations = array('INSERT',
+                                 'UPDATE',
+                                 'DELETE');
+}
+
+/**
  * This function is defined in: rte_routines.lib.php, rte_triggers.lib.php and
  * rte_events.lib.php. It is used to retreive some language strings that are
  * used in functionalities that are common to routines, triggers and events.
@@ -40,6 +55,7 @@ function PMA_RTE_main()
 {
     global $db, $table;
 
+    PMA_TRI_setGlobals();
     /**
      * Process all requests
      */


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list