From f4f72557f35404e663760f2b39afd0c3f431c130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Thu, 6 Sep 2001 18:34:41 +0000 Subject: [PATCH] optimized a bit (mainly added some 'mysql_free_result') --- db_printview.php3 | 1 + main.php3 | 1 + tbl_printview.php3 | 4 ++++ tbl_properties.inc.php3 | 8 +++++--- tbl_qbe.php3 | 20 ++++++++++++-------- tbl_select.php3 | 5 ++--- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/db_printview.php3 b/db_printview.php3 index 2576443e3..6c57c83ef 100755 --- a/db_printview.php3 +++ b/db_printview.php3 @@ -61,6 +61,7 @@ else { 0 break; } } + mysql_free_result($tables); } // The user is allowed to create a db if ($create) { diff --git a/tbl_printview.php3 b/tbl_printview.php3 index 9ad55b5c8..4fd62c0ca 100755 --- a/tbl_printview.php3 +++ b/tbl_printview.php3 @@ -30,6 +30,7 @@ if (MYSQL_INT_VERSION >= 32300) { if (!empty($row['Comment'])) { echo $strTableComments . ' : ' . $row['Comment']; } + mysql_free_result($result); } // end display comments @@ -108,6 +109,8 @@ while ($row = mysql_fetch_array($result)) { @@ -148,6 +151,7 @@ if (mysql_num_rows($result) > 0) { = 32300) { } break; } // end switch - } - } - } + } // end if + } // end while + } // end if + mysql_free_result($tables); + echo "\n"; ?>   diff --git a/tbl_qbe.php3 b/tbl_qbe.php3 index 56f0b0e7a..98d9ccd87 100755 --- a/tbl_qbe.php3 +++ b/tbl_qbe.php3 @@ -102,9 +102,10 @@ if ($row < 0) { /** * Prepares the form */ -$tbl_result = mysql_list_tables($db); -$i = 0; -$k = 0; +$tbl_result = mysql_list_tables($db); +$tbl_result_cnt = mysql_num_rows($tbl_result); +$i = 0; +$k = 0; // The tables list sent by a previously submitted form if (!empty($TableList)) { @@ -114,10 +115,11 @@ if (!empty($TableList)) { } // end if // The tables list gets from MySQL -while ($i < mysql_num_rows($tbl_result)) { - $tbl = mysql_tablename($tbl_result, $i); - $fld_results = mysql_list_fields($db, $tbl); - $j = 0; +while ($i < $tbl_result_cnt) { + $tbl = mysql_tablename($tbl_result, $i); + $fld_results = mysql_list_fields($db, $tbl); + $fld_results_cnt = mysql_num_fields($fld_results); + $j = 0; if (empty($tbl_names[$tbl]) && !empty($TableList)) { $tbl_names[$tbl] = ''; @@ -128,16 +130,18 @@ while ($i < mysql_num_rows($tbl_result)) { // The fields list per selected tables if ($tbl_names[$tbl] == ' selected="selected"') { $fld[$k++] = backquote($tbl) . '.*'; - while ($j < mysql_num_fields($fld_results)) { + while ($j < $fld_results_cnt) { $fld[$k] = mysql_field_name($fld_results, $j); $fld[$k] = backquote($tbl) . '.' . backquote($fld[$k]); $k++; $j++; } // end while } // end if + mysql_free_result($fld_results); $i++; } // end if +mysql_free_result($tbl_result); /** diff --git a/tbl_select.php3 b/tbl_select.php3 index cd9661265..323c8882c 100755 --- a/tbl_select.php3 +++ b/tbl_select.php3 @@ -93,10 +93,9 @@ if (!isset($param) || $param[0] == '') { ' . htmlspecialchars($field) . '' . "\n"; + echo '' . "\n"; } // end for ?>