[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-15227-g8c4530e

Piotr Przybylski crackpl at users.sourceforge.net
Tue Aug 16 22:20:09 CEST 2011


The branch, master has been updated
       via  8c4530e338ba81851cc5f0e2c9b3708293efa4ec (commit)
       via  6694352f0c5ae67f8b80df29ee319ea538874b39 (commit)
       via  726594645ccd3906e39c6d8be973b2ac2d4bffd2 (commit)
       via  701c957f40696a17c1ee5d3804ffb21d6674090e (commit)
      from  71184688b507f04bc3b5e521cb8d710de682b633 (commit)


- Log -----------------------------------------------------------------
commit 8c4530e338ba81851cc5f0e2c9b3708293efa4ec
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Tue Aug 16 22:19:41 2011 +0200

    Simplify code

commit 6694352f0c5ae67f8b80df29ee319ea538874b39
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Tue Aug 16 22:18:08 2011 +0200

    Only PMA_DBI_fetch_assoc is needed here

commit 726594645ccd3906e39c6d8be973b2ac2d4bffd2
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Tue Aug 16 22:17:23 2011 +0200

    Optimize tracking query, only the first row is needed

commit 701c957f40696a17c1ee5d3804ffb21d6674090e
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Tue Aug 16 20:23:15 2011 +0200

    Inline three one-line methods

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

Summary of changes:
 libraries/Tracker.class.php |   53 ++++++------------------------------------
 1 files changed, 8 insertions(+), 45 deletions(-)

diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php
index 8a622aa..de216ab 100644
--- a/libraries/Tracker.class.php
+++ b/libraries/Tracker.class.php
@@ -131,39 +131,6 @@ class PMA_Tracker
     }
 
     /**
-     * Returns a simple DROP TABLE statement.
-     *
-     * @param string $tablename
-     * @return string
-     */
-    static public function getStatementDropTable($tablename)
-    {
-        return 'DROP TABLE IF EXISTS ' . $tablename;
-    }
-
-    /**
-     * Returns a simple DROP VIEW statement.
-     *
-     * @param string $viewname
-     * @return string
-     */
-    static public function getStatementDropView($viewname)
-    {
-        return 'DROP VIEW IF EXISTS ' . $viewname;
-    }
-
-    /**
-     * Returns a simple DROP DATABASE statement.
-     *
-     * @param string $dbname
-     * @return string
-     */
-    static public function getStatementDropDatabase($dbname)
-    {
-        return 'DROP DATABASE IF EXISTS ' . $dbname;
-    }
-
-    /**
      * Parses the name of a table from a SQL statement substring.
      *
      * @static
@@ -303,13 +270,13 @@ class PMA_Tracker
 
         if (self::$add_drop_table == true && $is_view == false) {
             $create_sql .= self::getLogComment() .
-                           self::getStatementDropTable(PMA_backquote($tablename)) . ";\n";
+                           'DROP TABLE IF EXISTS ' . PMA_backquote($tablename) . ";\n";
 
         }
 
         if (self::$add_drop_view == true && $is_view == true) {
             $create_sql .= self::getLogComment() .
-                           self::getStatementDropView(PMA_backquote($tablename)) . ";\n";
+                           'DROP VIEW IF EXISTS ' . PMA_backquote($tablename) . ";\n";
         }
 
         $create_sql .= self::getLogComment() .
@@ -399,7 +366,7 @@ class PMA_Tracker
 
         if (self::$add_drop_database == true) {
             $create_sql .= self::getLogComment() .
-                           self::getStatementDropDatabase(PMA_backquote($dbname)) . ";\n";
+                           'DROP DATABASE IF EXISTS ' . PMA_backquote($dbname) . ";\n";
         }
 
         $create_sql .= self::getLogComment() . $query;
@@ -564,13 +531,9 @@ class PMA_Tracker
             $sql_query .= " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ;
         }
         $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
-        if (isset($row[0])) {
-            $version = $row[0];
-        }
-        if (! isset($version)) {
-            $version = -1;
-        }
-        return $version;
+        return isset($row[0])
+            ? $row[0]
+            : -1;
     }
 
 
@@ -596,9 +559,9 @@ class PMA_Tracker
             $sql_query .= " AND `table_name` = '" . PMA_sqlAddSlashes($tablename) ."' ";
         }
         $sql_query .= " AND `version` = '" . PMA_sqlAddSlashes($version) ."' ".
-                     " ORDER BY `version` DESC ";
+                     " ORDER BY `version` DESC LIMIT 1";
 
-        $mixed = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
+        $mixed = PMA_DBI_fetch_assoc(PMA_query_as_controluser($sql_query));
 
         // Parse log
         $log_schema_entries = explode('# log ',  $mixed['schema_sql']);


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list