bug #1339184, MySQL 5 strict mode, errors inserting auto-increment fields

This commit is contained in:
Marc Delisle
2005-11-03 18:24:15 +00:00
parent fb923f851a
commit 91870dadbe
4 changed files with 17 additions and 3 deletions

View File

@@ -114,7 +114,7 @@ if (!$check_stop) {
if (isset($me_fields_type[$encoded_key])) $type = $me_fields_type[$encoded_key];
else $type = '';
$f = 'field_' . md5($key);
$t_fval = (isset($$f) ? $$f : null);
@@ -191,7 +191,12 @@ if (!$check_stop) {
break;
default:
$val = "'" . PMA_sqlAddslashes($val) . "'";
// best way to avoid problems in strict mode (works also in non-strict mode)
if (isset($me_auto_increment) && isset($me_auto_increment[$encoded_key])) {
$val = 'NULL';
} else {
$val = "'" . PMA_sqlAddslashes($val) . "'";
}
break;
}
break;