code optimizations

This commit is contained in:
Marcel Tschopp
2004-04-08 13:27:02 +00:00
parent 74cc95fe29
commit cd22812a2e
2 changed files with 17 additions and 115 deletions

View File

@@ -11,6 +11,7 @@ $Source$
libraries/dbi/mysqli.dbi.lib.php, libraries/export/*.php: libraries/dbi/mysqli.dbi.lib.php, libraries/export/*.php:
phpMyAdmin should now be fully compatible with the new mysqli phpMyAdmin should now be fully compatible with the new mysqli
extension. All extension specific functions are wrapped now. extension. All extension specific functions are wrapped now.
* libraries/dbi/mysqli.dbi.lib.php: code optimizations
2004-04-07 Marcel Tschopp <marcel.tschopp@gmx.net> 2004-04-07 Marcel Tschopp <marcel.tschopp@gmx.net>
* multi_submits.inc.php, lang/german: bug 930714, wrong spelling and * multi_submits.inc.php, lang/german: bug 930714, wrong spelling and

View File

@@ -227,7 +227,7 @@ function PMA_DBI_affected_rows($link) {
} }
function PMA_DBI_get_fields_meta($result) { function PMA_DBI_get_fields_meta($result) {
// Build an associative array for a type look up
$typeAr[MYSQLI_TYPE_DECIMAL] = 'real'; $typeAr[MYSQLI_TYPE_DECIMAL] = 'real';
$typeAr[MYSQLI_TYPE_TINY] = 'int'; $typeAr[MYSQLI_TYPE_TINY] = 'int';
$typeAr[MYSQLI_TYPE_SHORT] = 'int'; $typeAr[MYSQLI_TYPE_SHORT] = 'int';
@@ -257,93 +257,7 @@ function PMA_DBI_get_fields_meta($result) {
$fields = mysqli_fetch_fields($result); $fields = mysqli_fetch_fields($result);
foreach($fields as $k => $field) { foreach($fields as $k => $field) {
$fields[$k]->type = $typeAr[$field->type]; $fields[$k]->type = $typeAr[$field->type];
$f = $field->flags; $fields[$k]->flags = PMA_DBI_field_flags($result, $k);
$flags = '';
while ($f > 0) {
if (floor($f / 65536)) {
$flags .= 'unique ';
$f -= 65536;
continue;
}
if (floor($f / 32768)) {
$flags .= 'num ';
$fields[$k]->numeric = 1;
$f -= 32768;
continue;
}
if (floor($f / 16384)) {
$flags .= 'part_key ';
$f -= 16384;
continue;
}
if (floor($f / 2048)) {
$flags .= 'set ';
$f -= 2048;
continue;
}
if (floor($f / 1024)) {
$flags .= 'timestamp ';
$f -= 1024;
continue;
}if (floor($f / 512)) {
$flags .= 'auto_increment ';
$f -= 512;
continue;
}
if (floor($f / 256)) {
$flags .= 'enum ';
$f -= 256;
continue;
}
if (floor($f / 128)) {
$flags .= 'binary ';
$f -= 128;
continue;
}
if (floor($f / 64)) {
$flags .= 'zerofill ';
$fields[$k]->zerofill = 1;
$f -= 64;
continue;
}
if (floor($f / 32)) {
$flags .= 'unsigned ';
$fields[$k]->unsigned = 1;
$f -= 32;
continue;
}
if (floor($f / 16)) {
$flags .= 'blob ';
$fields[$k]->blob = 1;
$f -= 16;
continue;
}
if (floor($f / 8)) {
$flags .= 'multiple_key ';
$fields[$k]->multiple_key = 1;
$f -= 8;
continue;
}
if (floor($f / 4)) {
$flags .= 'unique_key ';
$fields[$k]->unique_key = 1;
$f -= 4;
continue;
}
if (floor($f / 2)) {
$flags .= 'primary_key ';
$fields[$k]->primary_key = 1;
$f -= 2;
continue;
}
if (floor($f / 1)) {
$flags .= 'not_null ';
$fields[$k]->not_null = 1;
$f -= 1;
continue;
}
}
$fields[$k]->flags = trim($flags);
} }
return $fields; return $fields;
} }
@@ -371,72 +285,59 @@ function PMA_DBI_field_flags($result, $i) {
$flags .= 'unique '; $flags .= 'unique ';
$f -= 65536; $f -= 65536;
continue; continue;
} } elseif (floor($f / 32768)) {
if (floor($f / 32768)) {
$flags .= 'num '; $flags .= 'num ';
$f -= 32768; $f -= 32768;
continue; continue;
} } elseif (floor($f / 16384)) {
if (floor($f / 16384)) {
$flags .= 'part_key '; $flags .= 'part_key ';
$f -= 16384; $f -= 16384;
continue; continue;
} } elseif (floor($f / 2048)) {
if (floor($f / 2048)) {
$flags .= 'set '; $flags .= 'set ';
$f -= 2048; $f -= 2048;
continue; continue;
} } elseif (floor($f / 1024)) {
if (floor($f / 1024)) {
$flags .= 'timestamp '; $flags .= 'timestamp ';
$f -= 1024; $f -= 1024;
continue; continue;
}if (floor($f / 512)) { } elseif (floor($f / 512)) {
$flags .= 'auto_increment '; $flags .= 'auto_increment ';
$f -= 512; $f -= 512;
continue; continue;
} } elseif (floor($f / 256)) {
if (floor($f / 256)) {
$flags .= 'enum '; $flags .= 'enum ';
$f -= 256; $f -= 256;
continue; continue;
} } elseif (floor($f / 128)) {
if (floor($f / 128)) {
$flags .= 'binary '; $flags .= 'binary ';
$f -= 128; $f -= 128;
continue; continue;
} } elseif (floor($f / 64)) {
if (floor($f / 64)) {
$flags .= 'zerofill '; $flags .= 'zerofill ';
$f -= 64; $f -= 64;
continue; continue;
} } elseif (floor($f / 32)) {
if (floor($f / 32)) {
$flags .= 'unsigned '; $flags .= 'unsigned ';
$f -= 32; $f -= 32;
continue; continue;
} } elseif (floor($f / 16)) {
if (floor($f / 16)) {
$flags .= 'blob '; $flags .= 'blob ';
$f -= 16; $f -= 16;
continue; continue;
} } elseif (floor($f / 8)) {
if (floor($f / 8)) {
$flags .= 'multiple_key '; $flags .= 'multiple_key ';
$f -= 8; $f -= 8;
continue; continue;
} } elseif (floor($f / 4)) {
if (floor($f / 4)) {
$flags .= 'unique_key '; $flags .= 'unique_key ';
$f -= 4; $f -= 4;
continue; continue;
} } elseif (floor($f / 2)) {
if (floor($f / 2)) {
$flags .= 'primary_key '; $flags .= 'primary_key ';
$f -= 2; $f -= 2;
continue; continue;
} } elseif (floor($f / 1)) {
if (floor($f / 1)) {
$flags .= 'not_null '; $flags .= 'not_null ';
$f -= 1; $f -= 1;
continue; continue;