[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3-6487-g6d88345

Piotr Przybylski crackpl at users.sourceforge.net
Sat Jul 2 00:48:54 CEST 2011


The branch, master has been updated
       via  6d883454046623718bd777e0f6044eb57a65a55e (commit)
       via  e6b1d479cff08bbbc70539e98dfc060f19261b95 (commit)
       via  5021bae02fbba6ef7fa232670f0a134cc6b1ce8c (commit)
       via  b23294197674816d7e575d67b4306f7cbfa3cf51 (commit)
      from  d5dd8a2d37f0fab931df449d4c6a744821a78afb (commit)


- Log -----------------------------------------------------------------
commit 6d883454046623718bd777e0f6044eb57a65a55e
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Sat Jul 2 00:48:14 2011 +0200

    Remove DBI from moved functions' names

commit e6b1d479cff08bbbc70539e98dfc060f19261b95
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Sat Jul 2 00:45:08 2011 +0200

    Move PMA_DBI_get_column_values and PMA_DBI_get_table_indexes to server_synchronize.lib.php
    They are used only there, no need to parse 1,5 KB of code on every page load

commit 5021bae02fbba6ef7fa232670f0a134cc6b1ce8c
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Sat Jul 2 00:34:25 2011 +0200

    Remove unused PMA_DBI_get_table_data

commit b23294197674816d7e575d67b4306f7cbfa3cf51
Author: Piotr Przybylski <piotrprz at gmail.com>
Date:   Sat Jul 2 00:30:09 2011 +0200

    Whitespace and comments

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

Summary of changes:
 libraries/config.default.php         |   70 ++++++++++++++++++++------------
 libraries/database_interface.lib.php |   73 ----------------------------------
 libraries/server_synchronize.lib.php |   64 +++++++++++++++++++++++++++---
 3 files changed, 101 insertions(+), 106 deletions(-)

diff --git a/libraries/config.default.php b/libraries/config.default.php
index 0e0b9c8..b355c02 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -1117,6 +1117,7 @@ $cfg['DefaultTabDatabase'] = 'db_structure.php';
  */
 $cfg['DefaultTabTable'] = 'sql.php';
 
+
 /*******************************************************************************
  * Export defaults
  */
@@ -1824,6 +1825,7 @@ $cfg['Export']['xml_export_contents'] = true;
  */
 $cfg['Export']['yaml_structure_or_data'] = 'data';
 
+
 /*******************************************************************************
  * Import defaults
  */
@@ -2411,6 +2413,7 @@ $cfg['UserprefsDisallow'] = array();
  */
 $cfg['UserprefsDeveloperTab'] = false;
 
+
 /*******************************************************************************
  * Window title settings
  */
@@ -2521,7 +2524,9 @@ $cfg['DefaultQueryDatabase'] = '';
 /*******************************************************************************
  * SQL Query box settings
  * These are the links display in all of the SQL Query boxes
- *
+ */
+
+/**
  * @global array $cfg['SQLQuery']
  */
 $cfg['SQLQuery'] = array();
@@ -2593,7 +2598,7 @@ $cfg['SaveDir'] = '';
 $cfg['TempDir'] = '';
 
 
-/**
+/*******************************************************************************
  * Misc. settings
  */
 
@@ -2635,7 +2640,12 @@ $cfg['LinkLengthLimit'] = 2000;
  */
 $cfg['DisableMultiTableMaintenance'] = false;
 
+
 /*******************************************************************************
+ * SQL Parser
+ */
+
+/**
  * SQL Parser Settings
  *
  * @global array $cfg['SQP']
@@ -2665,6 +2675,10 @@ $cfg['SQP']['fmtIndUnit'] = 'em';
 
 
 /*******************************************************************************
+ * SQL Validator
+ */
+
+/**
  * If you wish to use the SQL Validator service, you should be aware of the
  * following:
  * All SQL statements are stored anonymously for statistical purposes.
@@ -2699,6 +2713,10 @@ $cfg['SQLValidator']['password'] = '';
 
 /*******************************************************************************
  * Developers ONLY!
+ */
+
+/**
+ * Debugging settings
  *
  * @global array $cfg['DBG']
  */
@@ -2934,29 +2952,29 @@ if ($cfg['ShowFunctionFields']) {
         'TIME'      => 'FUNC_DATE',
         'YEAR'      => 'FUNC_DATE',
 
-        'CHAR'          => 'FUNC_CHAR',
-        'VARCHAR'       => 'FUNC_CHAR',
-        'TINYTEXT'      => 'FUNC_CHAR',
-        'TEXT'          => 'FUNC_CHAR',
-        'MEDIUMTEXT'    => 'FUNC_CHAR',
-        'LONGTEXT'      => 'FUNC_CHAR',
-        'BINARY'        => 'FUNC_CHAR',
-        'VARBINARY'     => 'FUNC_CHAR',
-        'TINYBLOB'      => 'FUNC_CHAR',
-        'MEDIUMBLOB'    => 'FUNC_CHAR',
-        'BLOB'          => 'FUNC_CHAR',
-        'LONGBLOB'      => 'FUNC_CHAR',
-        'ENUM'          => '',
-        'SET'           => '',
-
-        'GEOMETRY'              => 'FUNC_SPATIAL',
-        'POINT'                 => 'FUNC_SPATIAL',
-        'LINESTRING'            => 'FUNC_SPATIAL',
-        'POLYGON'               => 'FUNC_SPATIAL',
-        'MULTIPOINT'            => 'FUNC_SPATIAL',
-        'MULTILINESTRING'       => 'FUNC_SPATIAL',
-        'MULTIPOLYGON'          => 'FUNC_SPATIAL',
-        'GEOMETRYCOLLECTION'    => 'FUNC_SPATIAL',
+        'CHAR'       => 'FUNC_CHAR',
+        'VARCHAR'    => 'FUNC_CHAR',
+        'TINYTEXT'   => 'FUNC_CHAR',
+        'TEXT'       => 'FUNC_CHAR',
+        'MEDIUMTEXT' => 'FUNC_CHAR',
+        'LONGTEXT'   => 'FUNC_CHAR',
+        'BINARY'     => 'FUNC_CHAR',
+        'VARBINARY'  => 'FUNC_CHAR',
+        'TINYBLOB'   => 'FUNC_CHAR',
+        'MEDIUMBLOB' => 'FUNC_CHAR',
+        'BLOB'       => 'FUNC_CHAR',
+        'LONGBLOB'   => 'FUNC_CHAR',
+        'ENUM'       => '',
+        'SET'        => '',
+
+        'GEOMETRY'           => 'FUNC_SPATIAL',
+        'POINT'              => 'FUNC_SPATIAL',
+        'LINESTRING'         => 'FUNC_SPATIAL',
+        'POLYGON'            => 'FUNC_SPATIAL',
+        'MULTIPOINT'         => 'FUNC_SPATIAL',
+        'MULTILINESTRING'    => 'FUNC_SPATIAL',
+        'MULTIPOLYGON'       => 'FUNC_SPATIAL',
+        'GEOMETRYCOLLECTION' => 'FUNC_SPATIAL',
 
     );
 
@@ -3103,8 +3121,6 @@ if ($cfg['ShowFunctionFields']) {
         'first_timestamp' => 'NOW',
         'pk_char36' => 'UUID',
     );
-
-
 } // end if
 
 /**
diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php
index bcafbb1..e6d4094 100644
--- a/libraries/database_interface.lib.php
+++ b/libraries/database_interface.lib.php
@@ -843,79 +843,6 @@ function PMA_DBI_get_columns($database, $table, $full = false, $link = null)
     return $fields;
 }
 
-/**
- * array PMA_DBI_get_column_values (string $database, string $table, string $column , mysql db link $link = null)
- *
- * @param   string  $database   name of database
- * @param   string  $table      name of table to retrieve columns from
- * @param   string  $column     name of the column to retrieve data from
- * @param   mixed   $link       mysql link resource
- * @return  array   $field_values
- */
-
-function PMA_DBI_get_column_values($database, $table, $column, $link = null)
-{
-    $query = 'SELECT ';
-    for($i=0; $i< sizeof($column); $i++)
-    {
-        $query.= PMA_backquote($column[$i]);
-        if($i < (sizeof($column)-1))
-        {
-            $query.= ', ';
-        }
-    }
-    $query.= ' FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table);
-    $field_values = PMA_DBI_fetch_result($query, null, null, $link);
-
-    if (! is_array($field_values) || count($field_values) < 1) {
-        return false;
-    }
-    return $field_values;
-}
-/**
- * array PMA_DBI_get_table_data (string $database, string $table, mysql db link $link = null)
- *
- * @param   string  $database   name of database
- * @param   string  $table      name of table to retrieve columns from
- * @param   mixed   $link       mysql link resource
- * @return  array   $result
- */
-
- function PMA_DBI_get_table_data($database, $table, $link = null)
- {
-
-    $result = PMA_DBI_fetch_result(
-        'SELECT * FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table),
-        null,null, $link);
-
-    if (! is_array($result) || count($result) < 1) {
-        return false;
-    }
-    return $result;
- }
-
-/**
-* array  PMA_DBI_get_table_indexes($database, $table, $link = null)
-*
-* @param    string  $database   name of database
-* @param    string  $table      name of the table whose indexes are to be retreived
-* @param    mixed   $link       mysql link resource
-* @return   array   $indexes
-*/
-
-function PMA_DBI_get_table_indexes($database, $table, $link = null)
-{
-
-    $indexes = PMA_DBI_fetch_result(
-              'SHOW INDEXES FROM ' .PMA_backquote($database) . '.' . PMA_backquote($table),
-               null, null, $link);
-
-    if (! is_array($indexes) || count($indexes) < 1) {
-        return false;
-    }
-    return $indexes;
-}
-
  /**
  * returns value of given mysql server variable
  *
diff --git a/libraries/server_synchronize.lib.php b/libraries/server_synchronize.lib.php
index 8f276be..1d8aaa5 100644
--- a/libraries/server_synchronize.lib.php
+++ b/libraries/server_synchronize.lib.php
@@ -107,7 +107,7 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching
         $fields_num[$matching_table_index] = sizeof($fld);
         $matching_tables_keys[$matching_table_index] = $is_key;
         
-        $source_result_set = PMA_DBI_get_column_values($src_db, $matching_table[$matching_table_index], $is_key, $src_link);      
+        $source_result_set = PMA_get_column_values($src_db, $matching_table[$matching_table_index], $is_key, $src_link);      
         $source_size = sizeof($source_result_set);
         
         $trg_fld_results = PMA_DBI_get_columns($trg_db, $matching_table[$matching_table_index], true, $trg_link);
@@ -309,11 +309,11 @@ function PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link, &$matching
 function PMA_findDeleteRowsFromTargetTables(&$delete_array, $matching_table, $matching_table_index, $trg_keys, $src_keys, $trg_db, $trg_link,$src_db, $src_link)
 {
     if (isset($trg_keys[$matching_table_index])) {
-        $target_key_values = PMA_DBI_get_column_values($trg_db, $matching_table[$matching_table_index], $trg_keys[$matching_table_index], $trg_link);      
+        $target_key_values = PMA_get_column_values($trg_db, $matching_table[$matching_table_index], $trg_keys[$matching_table_index], $trg_link);      
         $target_row_size = sizeof($target_key_values);        
     }
     if (isset($src_keys[$matching_table_index])) {
-        $source_key_values = PMA_DBI_get_column_values($src_db, $matching_table[$matching_table_index], $src_keys[$matching_table_index], $src_link);      
+        $source_key_values = PMA_get_column_values($src_db, $matching_table[$matching_table_index], $src_keys[$matching_table_index], $src_link);      
         $source_size = sizeof($source_key_values);        
     }
     $all_keys_match = 1;
@@ -1115,7 +1115,7 @@ function PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
 *  indexes to be altered in $alter_indexes_array and indexes to be removed from target table in $remove_indexes_array.
 *  Only keyname and uniqueness characteristic of the indexes are altered.
 *  @uses  sizeof()
-*  @uses  PMA_DBI_get_table_indexes()
+*  @uses  PMA_get_table_indexes()
 * 
 * @param   $src_db                 name of source database 
 * @param   $trg_db                 name of target database
@@ -1133,8 +1133,8 @@ function PMA_indexesDiffInTables($src_db, $trg_db, $src_link, $trg_link, $matchi
  &$alter_indexes_array, &$remove_indexes_array, $table_counter)
 {
     //Gets indexes information for source and target table
-    $source_indexes[$table_counter] = PMA_DBI_get_table_indexes($src_db, $matching_tables[$table_counter],$src_link);
-    $target_indexes[$table_counter] = PMA_DBI_get_table_indexes($trg_db, $matching_tables[$table_counter],$trg_link); 
+    $source_indexes[$table_counter] = PMA_get_table_indexes($src_db, $matching_tables[$table_counter],$src_link);
+    $target_indexes[$table_counter] = PMA_get_table_indexes($trg_db, $matching_tables[$table_counter],$trg_link); 
     for ($a = 0; $a < sizeof($source_indexes[$table_counter]); $a++) {
         $found = false;
         $z = 0;
@@ -1338,4 +1338,56 @@ function PMA_syncDisplayBeginTableRow($odd_row) {
     echo '">';
     return $odd_row;
 }
+
+/**
+ * array PMA_get_column_values (string $database, string $table, string $column , mysql db link $link = null)
+ *
+ * @param   string  $database   name of database
+ * @param   string  $table      name of table to retrieve columns from
+ * @param   string  $column     name of the column to retrieve data from
+ * @param   mixed   $link       mysql link resource
+ * @return  array   $field_values
+ */
+
+function PMA_get_column_values($database, $table, $column, $link = null)
+{
+    $query = 'SELECT ';
+    for($i=0; $i< sizeof($column); $i++)
+    {
+        $query.= PMA_backquote($column[$i]);
+        if($i < (sizeof($column)-1))
+        {
+            $query.= ', ';
+        }
+    }
+    $query.= ' FROM ' . PMA_backquote($database) . '.' . PMA_backquote($table);
+    $field_values = PMA_DBI_fetch_result($query, null, null, $link);
+
+    if (! is_array($field_values) || count($field_values) < 1) {
+        return false;
+    }
+    return $field_values;
+}
+
+/**
+* array  PMA_get_table_indexes($database, $table, $link = null)
+*
+* @param    string  $database   name of database
+* @param    string  $table      name of the table whose indexes are to be retreived
+* @param    mixed   $link       mysql link resource
+* @return   array   $indexes
+*/
+
+function PMA_get_table_indexes($database, $table, $link = null)
+{
+
+    $indexes = PMA_DBI_fetch_result(
+              'SHOW INDEXES FROM ' .PMA_backquote($database) . '.' . PMA_backquote($table),
+               null, null, $link);
+
+    if (! is_array($indexes) || count($indexes) < 1) {
+        return false;
+    }
+    return $indexes;
+}
 ?>


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list