From a1417f09f04e08d75a1d10c8814233067a3a6ce8 Mon Sep 17 00:00:00 2001 From: Marcel Tschopp Date: Thu, 8 Apr 2004 14:19:31 +0000 Subject: [PATCH] bug 926986, code optimizations --- ChangeLog | 2 + libraries/dbi/mysqli.dbi.lib.php | 63 +++++++++++++++++++------------- tbl_replace.php | 2 +- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef9b6df79..988714adf 100755 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ $Source$ phpMyAdmin should now be fully compatible with the new mysqli extension. All extension specific functions are wrapped now. * libraries/dbi/mysqli.dbi.lib.php: code optimizations + * tbl_replace.php: bug 926986, "multi-edit: updates completely ignored", + thanks to Wandering Zombie (wanderingzombie). 2004-04-07 Marcel Tschopp * multi_submits.inc.php, lang/german: bug 930714, wrong spelling and diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index b9c4bd15c..f29cb9c96 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -228,36 +228,49 @@ function PMA_DBI_affected_rows($link) { function PMA_DBI_get_fields_meta($result) { // Build an associative array for a type look up - $typeAr[MYSQLI_TYPE_DECIMAL] = 'real'; - $typeAr[MYSQLI_TYPE_TINY] = 'int'; - $typeAr[MYSQLI_TYPE_SHORT] = 'int'; - $typeAr[MYSQLI_TYPE_LONG] = 'int'; - $typeAr[MYSQLI_TYPE_FLOAT] = 'real'; - $typeAr[MYSQLI_TYPE_DOUBLE] = 'real'; - $typeAr[MYSQLI_TYPE_NULL] = 'null'; - $typeAr[MYSQLI_TYPE_TIMESTAMP] = 'timestamp'; - $typeAr[MYSQLI_TYPE_LONGLONG] = 'int'; - $typeAr[MYSQLI_TYPE_INT24] = 'int'; - $typeAr[MYSQLI_TYPE_DATE] = 'date'; - $typeAr[MYSQLI_TYPE_TIME] = 'time'; - $typeAr[MYSQLI_TYPE_DATETIME] = 'datetime'; - $typeAr[MYSQLI_TYPE_YEAR] = 'year'; - $typeAr[MYSQLI_TYPE_NEWDATE] = 'date'; - $typeAr[MYSQLI_TYPE_ENUM] = 'unknown'; - $typeAr[MYSQLI_TYPE_SET] = 'unknown'; - $typeAr[MYSQLI_TYPE_TINY_BLOB] = 'blob'; + $typeAr = Array(); + $typeAr[MYSQLI_TYPE_DECIMAL] = 'real'; + $typeAr[MYSQLI_TYPE_TINY] = 'int'; + $typeAr[MYSQLI_TYPE_SHORT] = 'int'; + $typeAr[MYSQLI_TYPE_LONG] = 'int'; + $typeAr[MYSQLI_TYPE_FLOAT] = 'real'; + $typeAr[MYSQLI_TYPE_DOUBLE] = 'real'; + $typeAr[MYSQLI_TYPE_NULL] = 'null'; + $typeAr[MYSQLI_TYPE_TIMESTAMP] = 'timestamp'; + $typeAr[MYSQLI_TYPE_LONGLONG] = 'int'; + $typeAr[MYSQLI_TYPE_INT24] = 'int'; + $typeAr[MYSQLI_TYPE_DATE] = 'date'; + $typeAr[MYSQLI_TYPE_TIME] = 'time'; + $typeAr[MYSQLI_TYPE_DATETIME] = 'datetime'; + $typeAr[MYSQLI_TYPE_YEAR] = 'year'; + $typeAr[MYSQLI_TYPE_NEWDATE] = 'date'; + $typeAr[MYSQLI_TYPE_ENUM] = 'unknown'; + $typeAr[MYSQLI_TYPE_SET] = 'unknown'; + $typeAr[MYSQLI_TYPE_TINY_BLOB] = 'blob'; $typeAr[MYSQLI_TYPE_MEDIUM_BLOB] = 'blob'; - $typeAr[MYSQLI_TYPE_LONG_BLOB] = 'blob'; - $typeAr[MYSQLI_TYPE_BLOB] = 'blob'; - $typeAr[MYSQLI_TYPE_VAR_STRING] = 'string'; - $typeAr[MYSQLI_TYPE_STRING] = 'string'; - $typeAr[MYSQLI_TYPE_CHAR] = 'string'; - $typeAr[MYSQLI_TYPE_GEOMETRY] = 'unknown'; + $typeAr[MYSQLI_TYPE_LONG_BLOB] = 'blob'; + $typeAr[MYSQLI_TYPE_BLOB] = 'blob'; + $typeAr[MYSQLI_TYPE_VAR_STRING] = 'string'; + $typeAr[MYSQLI_TYPE_STRING] = 'string'; + $typeAr[MYSQLI_TYPE_CHAR] = 'string'; + $typeAr[MYSQLI_TYPE_GEOMETRY] = 'unknown'; $fields = mysqli_fetch_fields($result); foreach($fields as $k => $field) { - $fields[$k]->type = $typeAr[$field->type]; + $fields[$k]->type = $typeAr[$fields[$k]->type]; $fields[$k]->flags = PMA_DBI_field_flags($result, $k); + + // Enhance the field objects for mysql-extension compatibilty + $flags = explode(' ', $fields[$k]->flags); + array_unshift($flags, 'dummy'); + $fields[$k]->multiple_key = (int)(array_search('multiple_key', $flags, true) > 0); + $fields[$k]->primary_key = (int)(array_search('primary_key', $flags, true) > 0); + $fields[$k]->unique_key = (int)(array_search('unique_key', $flags, true) > 0); + $fields[$k]->not_null = (int)(array_search('not_null', $flags, true) > 0); + $fields[$k]->unsigned = (int)(array_search('unsigned', $flags, true) > 0); + $fields[$k]->zerofill = (int)(array_search('zerofill', $flags, true) > 0); + $fields[$k]->numeric = (int)(array_search('num', $flags, true) > 0); + $fields[$k]->blob = (int)(array_search('blob', $flags, true) > 0); } return $fields; } diff --git a/tbl_replace.php b/tbl_replace.php index aa95fb8ae..063c6a673 100644 --- a/tbl_replace.php +++ b/tbl_replace.php @@ -143,7 +143,7 @@ if (isset($primary_key) && ($submit_type != $strInsertAsNewRow)) { } } - if (empty($valuelist)) { + if (empty($valuelist) && empty($query)) { // No change -> move back to the calling script $message = $strNoModification; if ($is_gotofile) {