Get rid of mysql_data_seek(). Use pre-cached PHP array for mysqli

compatibility and bandwidth saving.

Memory issues by caching should not arise, as the used cache will (in our
previously used cases) only cache index fields and max. 200 relation rows.

I tested performance on my machine: By fetching 400kb of data twice via
mysql_fetch_row() -> mysql_data_seek() -> mysql_fetch_row() this was
performed in 0.25 seconds. By fetching it once and caching in a PHP array
via mysql_fetch_row -> foreach this is performed in 0.32 seconds.

With usual data as used in PMA (10kb) I could only detect a performance
change of 0.009 seconds, which is respectable I think.

By not using mysql_data_seek we are later able to use global mysqli
USE_RESULT options to fetch rows singly. I discussed that yesterday with
Rabus, and if there are any objections we can surely discuss that further on
the list.
This commit is contained in:
Garvin Hicking
2004-01-28 11:23:38 +00:00
parent 2f4da69965
commit b8df10e41e
9 changed files with 36 additions and 15 deletions

View File

@@ -109,16 +109,18 @@ if (defined('PMA_IDX_INCLUDED')) {
// Get fields and stores their name/type
// fields had already been grabbed in "tbl_properties.php"
if (defined('PMA_IDX_INCLUDED')) {
mysql_data_seek($fields_rs, 0); // !UNWRAPPED FUNCTION!
} else {
if (!defined('PMA_IDX_INCLUDED')) {
$fields_rs = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
$fields_cnt = PMA_DBI_num_rows($fields_rs);
$save_row = array();
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
$save_row[] = $row;
}
}
$fields_names = array();
$fields_types = array();
while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
foreach($save_row AS $saved_row_key => $row) {
$fields_names[] = $row['Field'];
// loic1: set or enum types: slashes single quotes inside options
if (preg_match('@^(set|enum)\((.+)\)$@i', $row['Type'], $tmp)) {