bugs 1767759, 1216521 Duplicate entry error Browse feature: this minor feature removed due to its complexity
This commit is contained in:
parent
206f234c22
commit
cf60210471
@ -15,6 +15,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
||||
thanks to Mario Rohkrämer
|
||||
- Do not display "Your MySQL library..." if only the Z part of X.Y.Z version
|
||||
is different
|
||||
- bugs #1767759, 1216521 [data] Duplicate entry error Browse feature: this minor
|
||||
feature removed due to its complexity
|
||||
|
||||
2.11.0.0 (2007-08-21)
|
||||
|
||||
|
||||
@ -542,62 +542,6 @@ function PMA_mysqlDie($error_message = '', $the_query = '',
|
||||
echo '<code>' . "\n"
|
||||
. $error_message . "\n"
|
||||
. '</code><br />' . "\n";
|
||||
|
||||
// feature request #1036254:
|
||||
// Add a link by MySQL-Error #1062 - Duplicate entry
|
||||
// 2004-10-20 by mkkeck
|
||||
// 2005-01-17 modified by mkkeck bugfix
|
||||
if (substr($error_message, 1, 4) == '1062') {
|
||||
// get the duplicate entry
|
||||
|
||||
// get table name
|
||||
/**
|
||||
* @todo what would be the best delimiter, while avoiding special
|
||||
* characters that can become high-ascii after editing, depending
|
||||
* upon which editor is used by the developer?
|
||||
*/
|
||||
$error_table = array();
|
||||
if (preg_match('@ALTER\s*TABLE\s*\`([^\`]+)\`@iu', $the_query, $error_table)) {
|
||||
$error_table = $error_table[1];
|
||||
} elseif (preg_match('@INSERT\s*INTO\s*\`([^\`]+)\`@iu', $the_query, $error_table)) {
|
||||
$error_table = $error_table[1];
|
||||
} elseif (preg_match('@UPDATE\s*\`([^\`]+)\`@iu', $the_query, $error_table)) {
|
||||
$error_table = $error_table[1];
|
||||
} elseif (preg_match('@INSERT\s*\`([^\`]+)\`@iu', $the_query, $error_table)) {
|
||||
$error_table = $error_table[1];
|
||||
}
|
||||
|
||||
// get fields
|
||||
$error_fields = array();
|
||||
if (preg_match('@\(([^\)]+)\)@i', $the_query, $error_fields)) {
|
||||
$error_fields = explode(',', $error_fields[1]);
|
||||
} elseif (preg_match('@(`[^`]+`)\s*=@i', $the_query, $error_fields)) {
|
||||
$error_fields = explode(',', $error_fields[1]);
|
||||
}
|
||||
if (is_array($error_table) || is_array($error_fields)) {
|
||||
|
||||
// duplicate value
|
||||
$duplicate_value = array();
|
||||
preg_match('@\'([^\']+)\'@i', $tmp_mysql_error, $duplicate_value);
|
||||
$duplicate_value = $duplicate_value[1];
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM ' . PMA_backquote($error_table) . '
|
||||
WHERE CONCAT_WS("-", ' . implode(', ', $error_fields) . ')
|
||||
= "' . PMA_sqlAddslashes($duplicate_value) . '"
|
||||
ORDER BY ' . implode(', ', $error_fields);
|
||||
unset($error_table, $error_fields, $duplicate_value);
|
||||
|
||||
echo ' <form method="post" action="import.php" style="padding: 0; margin: 0">' ."\n"
|
||||
.' <input type="hidden" name="sql_query" value="' . htmlspecialchars($sql) . '" />' . "\n"
|
||||
.' ' . PMA_generate_common_hidden_inputs($db, $table) . "\n"
|
||||
.' <input type="submit" name="submit" value="' . $GLOBALS['strBrowse'] . '" />' . "\n"
|
||||
.' </form>' . "\n";
|
||||
unset($sql);
|
||||
}
|
||||
} // end of show duplicate entry
|
||||
|
||||
echo '</div>';
|
||||
echo '<fieldset class="tblFooters">';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user