[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_7-10086-g77b6fb1

Dieter Adriaenssens ruleant at users.sourceforge.net
Fri Sep 10 17:35:59 CEST 2010


The branch, master has been updated
       via  77b6fb172d3099c54335e05e12859b5d8ca42950 (commit)
       via  194e357a996310225364d311e6c27ed41db002bb (commit)
      from  7f598f4f4f562b392fe4a83d3e9fd9bf00379e37 (commit)


- Log -----------------------------------------------------------------
commit 77b6fb172d3099c54335e05e12859b5d8ca42950
Merge: 7f598f4f4f562b392fe4a83d3e9fd9bf00379e37 194e357a996310225364d311e6c27ed41db002bb
Author: Dieter Adriaenssens <ruleant at users.sourceforge.net>
Date:   Fri Sep 10 17:34:52 2010 +0200

    Merge branch 'QA_3_3'
    
    Conflicts:
    
    	ChangeLog

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

Summary of changes:
 ChangeLog                |    3 ++
 libraries/import.lib.php |   68 +++++++++++++++++++++++++++-------------------
 2 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad54bee..d15366e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,9 @@
 - bug #3056610 [interface] Removed modification options for information_schema 
 + patch #3055886 [config] Add Left frame table filter visibility config option, thanks to eesau
 
+3.3.8.0 (not yet released)
+- bug #3059311 [import] BIGINT field type added to table analysis
+
 3.3.7.0 (2010-09-07)
 - patch #3050492 [PDF scratchboard] Cannot drag table box to the edge after
   a page size increase, thanks to Martin Schönberger - mad05
diff --git a/libraries/import.lib.php b/libraries/import.lib.php
index 8ef38f6..bacc6a4 100644
--- a/libraries/import.lib.php
+++ b/libraries/import.lib.php
@@ -408,6 +408,7 @@ define("NONE",      0);
 define("VARCHAR",   1);
 define("INT",       2);
 define("DECIMAL",   3);
+define("BIGINT",    4);
 
 /* Decimal size defs */
 define("M",         0);
@@ -489,6 +490,7 @@ function PMA_getDecimalSize(&$cell) {
  * @uses    FULL
  * @uses    VARCHAR
  * @uses    DECIMAL
+ * @uses    BIGINT
  * @uses    INT
  * @uses    NONE
  * @uses    strcmp()
@@ -497,8 +499,8 @@ function PMA_getDecimalSize(&$cell) {
  * @uses    PMA_getD()
  * @uses    PMA_getDecimalSize()
  * @param   string $last_cumulative_size    Last cumulative column size
- * @param   int    $last_cumulative_type    Last cumulative column type  (NONE or VARCHAR or DECIMAL or INT)
- * @param   int    $curr_type               Type of the current cell     (NONE or VARCHAR or DECIMAL or INT)
+ * @param   int    $last_cumulative_type    Last cumulative column type  (NONE or VARCHAR or DECIMAL or INT or BIGINT)
+ * @param   int    $curr_type               Type of the current cell     (NONE or VARCHAR or DECIMAL or INT or BIGINT)
  * @param   string &$cell                   The current cell
  * @return  string                          Size of the given cell in the type-appropriate format
  */
@@ -516,7 +518,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
      */
 	elseif ($curr_type == VARCHAR) {
         /**
-         * The last cumlative type was VARCHAR
+         * The last cumulative type was VARCHAR
          */
 		if ($last_cumulative_type == VARCHAR) {
 			if ($curr_size >= $last_cumulative_size) {
@@ -526,7 +528,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
             }
 		}
         /**
-         * The last cumlative type was DECIMAL
+         * The last cumulative type was DECIMAL
          */
         elseif ($last_cumulative_type == DECIMAL) {
             $oldM = PMA_getM($last_cumulative_size);
@@ -538,9 +540,9 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
             }
 		}
         /**
-         * The last cumlative type was INT
+         * The last cumulative type was BIGINT or INT
          */
-        elseif ($last_cumulative_type == INT) {
+        elseif ($last_cumulative_type == BIGINT || $last_cumulative_type == INT) {
             if ($curr_size >= $last_cumulative_size) {
                 return $curr_size;
             } else {
@@ -569,7 +571,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
      */
     elseif ($curr_type == DECIMAL) {
         /**
-         * The last cumlative type was VARCHAR
+         * The last cumulative type was VARCHAR
          */
 		if ($last_cumulative_type == VARCHAR) {
             /* Convert $last_cumulative_size from varchar to decimal format */
@@ -582,7 +584,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
             }
 		}
         /**
-         * The last cumlative type was DECIMAL
+         * The last cumulative type was DECIMAL
          */
         elseif ($last_cumulative_type == DECIMAL) {
 		    $size = PMA_getDecimalSize($cell);
@@ -599,9 +601,9 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
             }
 		}
         /**
-         * The last cumlative type was INT
+         * The last cumulative type was BIGINT or INT
          */
-        elseif ($last_cumulative_type == INT) {
+        elseif ($last_cumulative_type == BIGINT || $last_cumulative_type == INT) {
 		    /* Convert $last_cumulative_size from int to decimal format */
 		    $size = PMA_getDecimalSize($cell);
 		    
@@ -632,11 +634,11 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
         }
 	}
     /**
-     * What to do if the current cell is of type INT
+     * What to do if the current cell is of type BIGINT or INT
      */
-    elseif ($curr_type == INT) {
+    elseif ($curr_type == BIGINT || $curr_type == INT) {
         /**
-         * The last cumlative type was VARCHAR
+         * The last cumulative type was VARCHAR
          */
 		if ($last_cumulative_type == VARCHAR) {
 		    if ($curr_size >= $last_cumulative_size) {
@@ -646,7 +648,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
             }
 		}
         /**
-         * The last cumlative type was DECIMAL
+         * The last cumulative type was DECIMAL
          */
         elseif ($last_cumulative_type == DECIMAL) {
             $oldM = PMA_getM($last_cumulative_size);
@@ -664,9 +666,9 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
             }
 	    }
         /**
-         * The last cumlative type was INT
+         * The last cumulative type was BIGINT or INT
          */
-        elseif ($last_cumulative_type == INT) {
+        elseif ($last_cumulative_type == BIGINT || $last_cumulative_type == INT) {
 		    if ($curr_size >= $last_cumulative_size) {
 		        return $curr_size;
             } else {
@@ -709,6 +711,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
  * @access  public
  *
  * @uses    DECIMAL
+ * @uses    BIGINT
  * @uses    INT
  * @uses    VARCHAR
  * @uses    NONE
@@ -716,13 +719,13 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
  * @uses    strcmp()
  * @uses    strpos()
  * @uses    substr_count()
- * @param   int    $last_cumulative_type  Last cumulative column type  (VARCHAR or INT or DECIMAL or NONE)
+ * @param   int    $last_cumulative_type  Last cumulative column type  (VARCHAR or INT or BIGINT or DECIMAL or NONE)
  * @param   string &$cell                 String representation of the cell for which a best-fit type is to be determined
- * @return  int                           The MySQL type representation (VARCHAR or INT or DECIMAL or NONE)
+ * @return  int                           The MySQL type representation (VARCHAR or INT or BIGINT or DECIMAL or NONE)
  */
 function PMA_detectType($last_cumulative_type, &$cell) {
     /**
-     * If numeric, determine if decimal or int
+     * If numeric, determine if decimal, int or bigint
      * Else, we call it varchar for simplicity
      */
     
@@ -736,7 +739,11 @@ function PMA_detectType($last_cumulative_type, &$cell) {
         if ($cell == (string)(float)$cell && strpos($cell, ".") !== false && substr_count($cell, ".") == 1) {
             return DECIMAL;
         } else {
-            return INT;
+		if ($cell > 2147483647) {
+			return BIGINT;
+		} else {
+			return INT;
+		}
         }
     } else {
         return VARCHAR;
@@ -758,6 +765,7 @@ function PMA_detectType($last_cumulative_type, &$cell) {
  * @uses    ROWS
  * @uses    VARCHAR
  * @uses    DECIMAL
+ * @uses    BIGINT
  * @uses    INT
  * @uses    NONE
  * @uses    count()
@@ -802,21 +810,25 @@ function PMA_analyzeTable(&$table) {
 				$sizes[$i] = PMA_detectSize($sizes[$i], $types[$i], $curr_type, $table[ROWS][$j][$i]);
 				
 				/**
-                 * If a type for this column has alreday been delcared,
+				 * If a type for this column has already been declared,
 				 * only alter it if it was a number and a varchar was found
-                 */
-                if ($curr_type != NONE) {
+				 */
+				if ($curr_type != NONE) {
 					if ($curr_type == VARCHAR) {
 						$types[$i] = VARCHAR;
 					} else if ($curr_type == DECIMAL) {
 						if ($types[$i] != VARCHAR) {
 							$types[$i] = DECIMAL;
 						}
+					} else if ($curr_type == BIGINT) {
+						if ($types[$i] != VARCHAR && $types[$i] != DECIMAL) {
+							$types[$i] = BIGINT;
+						}
 					} else if ($curr_type == INT) {
-                        if ($types[$i] != VARCHAR && $types[$i] != DECIMAL) {
-                            $types[$i] = INT;
-                        }
-                    }
+						if ($types[$i] != VARCHAR && $types[$i] != DECIMAL && $types[$i] != BIGINT) {
+							$types[$i] = INT;
+						}
+					}
 				}
 			}
 		}
@@ -945,7 +957,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = NULL, &$additional_sql =
     }
 
     if ($analyses != NULL) {
-        $type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal");
+        $type_array = array(NONE => "NULL", VARCHAR => "varchar", INT => "int", DECIMAL => "decimal", BIGINT => "bigint");
         
         /* TODO: Do more checking here to make sure they really are matched */
         if (count($tables) != count($analyses)) {


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list