[Phpmyadmin-git] [SCM] phpMyAdmin branch, QA_3_3, updated. RELEASE_3_3_7-7-g194e357
Dieter Adriaenssens
ruleant at users.sourceforge.net
Fri Sep 10 17:35:50 CEST 2010
The branch, QA_3_3 has been updated
via 194e357a996310225364d311e6c27ed41db002bb (commit)
from 5d136abd8bf9f85336f52332470acf9e52448b20 (commit)
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
libraries/import.lib.php | 68 +++++++++++++++++++++++++++-------------------
2 files changed, 41 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 523f015..42030ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ $Id$
$HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyAdmin/ChangeLog $
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
diff --git a/libraries/import.lib.php b/libraries/import.lib.php
index 6c039bd..278028b 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);
@@ -493,6 +494,7 @@ function PMA_getDecimalSize(&$cell) {
* @uses FULL
* @uses VARCHAR
* @uses DECIMAL
+ * @uses BIGINT
* @uses INT
* @uses NONE
* @uses strcmp()
@@ -501,8 +503,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
*/
@@ -520,7 +522,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) {
@@ -530,7 +532,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);
@@ -542,9 +544,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 {
@@ -573,7 +575,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 */
@@ -586,7 +588,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);
@@ -603,9 +605,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);
@@ -636,11 +638,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) {
@@ -650,7 +652,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);
@@ -668,9 +670,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 {
@@ -714,6 +716,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, $curr_type
* @access public
*
* @uses DECIMAL
+ * @uses BIGINT
* @uses INT
* @uses VARCHAR
* @uses NONE
@@ -721,13 +724,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
*/
@@ -741,7 +744,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;
@@ -764,6 +771,7 @@ function PMA_detectType($last_cumulative_type, &$cell) {
* @uses ROWS
* @uses VARCHAR
* @uses DECIMAL
+ * @uses BIGINT
* @uses INT
* @uses NONE
* @uses count()
@@ -808,21 +816,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;
+ }
+ }
}
}
}
@@ -952,7 +964,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