diff --git a/ChangeLog b/ChangeLog index 8d3427e0f..eaf455c45 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ $Source$ no display field has been defined; bug 1004546, sort error in dropdown list of foreign values; incorrect result was freed * libraries/relation.lib.php: use natural order sort according to config + * db_details_structure.php, pdf_pages.php, pdf_schema.php: make it work + with mysqli extension 2004-08-08 Michal Čihař * calendar.php: Include correct stylesheet (bug #1005421). diff --git a/db_details_structure.php b/db_details_structure.php index a3c55b6d5..7736b1dcb 100644 --- a/db_details_structure.php +++ b/db_details_structure.php @@ -803,7 +803,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) { $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; - $test_rs = PMA_query_as_cu($test_query); + $test_rs = PMA_query_as_cu($test_query, NULL, PMA_DBI_QUERY_STORE); if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { echo "\n"; ?> diff --git a/pdf_pages.php b/pdf_pages.php index f4fba87c1..0e05762cf 100644 --- a/pdf_pages.php +++ b/pdf_pages.php @@ -2,7 +2,6 @@ /* $Id$ */ // vim: expandtab sw=4 ts=4 sts=4: - /** * Gets some core libraries */ @@ -17,6 +16,10 @@ require_once('./db_details_common.php'); require_once('./libraries/relation.lib.php'); $cfgRelation = PMA_getRelationsParam(); +// This is to avoid "Command out of sync" errors. Before switching this to +// a value of 0 (for MYSQLI_USE_RESULT), please check the logic +// to free results wherever needed. +$query_default_option = PMA_DBI_QUERY_STORE; /** * Now in ./libraries/relation.lib.php we check for all tables @@ -58,12 +61,12 @@ if ($cfgRelation['pdfwork']) { $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND pdf_page_number = ' . $chpage; - PMA_query_as_cu($ch_query); + PMA_query_as_cu($ch_query, FALSE, $query_default_option); $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND page_nr = ' . $chpage; - PMA_query_as_cu($ch_query); + PMA_query_as_cu($ch_query, FALSE, $query_default_option); unset($chpage); } @@ -75,9 +78,11 @@ if ($cfgRelation['pdfwork']) { $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages']) . ' (db_name, page_descr)' . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')'; - PMA_query_as_cu($ins_query); + PMA_query_as_cu($ins_query, FALSE, $query_default_option); // A u t o m a t i c l a y o u t + // + // TODO: support InnoDB if (isset($autolayout)) { // save the page number @@ -90,7 +95,7 @@ if ($cfgRelation['pdfwork']) { . ' WHERE master_db = \'' . $db . '\'' . ' GROUP BY master_table' . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC '; - $master_tables_rs = PMA_query_as_cu($master_tables); + $master_tables_rs = PMA_query_as_cu($master_tables, FALSE, $query_default_option); if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) { // first put all the master tables at beginning // of the list, so they are near the center of @@ -135,8 +140,7 @@ if ($cfgRelation['pdfwork']) { $insert_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' ' . '(db_name, table_name, pdf_page_number, x, y) ' . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')'; - PMA_query_as_cu($insert_query); - + PMA_query_as_cu($insert_query, FALSE, $query_default_option); // compute for the next table switch ($direction) { @@ -184,7 +188,7 @@ if ($cfgRelation['pdfwork']) { . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\'' . ' AND pdf_page_number = ' . $chpage; - $test_rs = PMA_query_as_cu($test_query); + $test_rs = PMA_query_as_cu($test_query, FALSE, $query_default_option); if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') { $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords']) @@ -203,7 +207,7 @@ if ($cfgRelation['pdfwork']) { . '(db_name, table_name, pdf_page_number, x, y) ' . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')'; } - PMA_query_as_cu($ch_query); + PMA_query_as_cu($ch_query, FALSE, $query_default_option); } // end if } // end for break; @@ -213,7 +217,7 @@ if ($cfgRelation['pdfwork']) { . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n" . ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n" . ' AND pdf_page_number = ' . $chpage; - PMA_query_as_cu($d_query); + PMA_query_as_cu($d_query, FALSE, $query_default_option); } break; } // end switch @@ -226,11 +230,11 @@ if ($cfgRelation['pdfwork']) { $selectboxall[] = $val[0]; } - // Now first show some possibility to choose a page for the pdf $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''; - $page_rs = PMA_query_as_cu($page_query); + $page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option); + if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) { ?>
@@ -286,7 +290,7 @@ if ($cfgRelation['pdfwork']) { $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND pdf_page_number = ' . $chpage; -$page_rs = PMA_query_as_cu($page_query); +$page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option); $array_sh_page = array(); $draginit = ''; $reset_draginit = ''; diff --git a/pdf_schema.php b/pdf_schema.php index e5f66f43f..76ec5e042 100644 --- a/pdf_schema.php +++ b/pdf_schema.php @@ -2,7 +2,6 @@ /* $Id$ */ // vim: expandtab sw=4 ts=4 sts=4: - /** * Contributed by Maxime Delorme and merged by lem9 */ @@ -683,7 +682,7 @@ class PMA_RT_Table $this->table_name = $table_name; $sql = 'DESCRIBE ' . PMA_backquote($table_name); - $result = PMA_DBI_try_query($sql); + $result = PMA_DBI_try_query($sql, NULL, PMA_DBI_QUERY_STORE); if (!$result || !PMA_DBI_num_rows($result)) { $pdf->PMA_PDF_die(sprintf($GLOBALS['strPdfInvalidTblName'], $table_name)); } @@ -705,7 +704,7 @@ class PMA_RT_Table . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND table_name = \'' . PMA_sqlAddslashes($table_name) . '\'' . ' AND pdf_page_number = ' . $pdf_page_number; - $result = PMA_query_as_cu($sql); + $result = PMA_query_as_cu($sql, FALSE, PMA_DBI_QUERY_STORE); if (!$result || !PMA_DBI_num_rows($result)) { $pdf->PMA_PDF_die(sprintf($GLOBALS['strConfigureTableCoord'], $table_name)); @@ -717,7 +716,7 @@ class PMA_RT_Table $this->displayfield = PMA_getDisplayField($db, $table_name); // index - $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table_name) . ';'); + $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table_name) . ';', NULL, PMA_DBI_QUERY_STORE); if (PMA_DBI_num_rows($result) > 0) { while ($row = PMA_DBI_fetch_assoc($result)) { if ($row['Key_name'] == 'PRIMARY') { @@ -1106,7 +1105,7 @@ class PMA_RT $tab_sql = 'SELECT table_name FROM ' . PMA_backquote($cfgRelation['table_coords']) . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . ' AND pdf_page_number = ' . $which_rel; - $tab_rs = PMA_query_as_cu($tab_sql); + $tab_rs = PMA_query_as_cu($tab_sql, NULL, PMA_DBI_QUERY_STORE); if (!$tab_rs || !PMA_DBI_num_rows($tab_rs) > 0) { $pdf->PMA_PDF_die($GLOBALS['strPdfNoTables']); // die('No tables'); @@ -1272,7 +1271,7 @@ function PMA_RT_DOC($alltables ){ /** * Gets table informations */ - $result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';'); + $result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\';', NULL, PMA_DBI_QUERY_STORE); $showtable = PMA_DBI_fetch_assoc($result); $num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0); $show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : ''); @@ -1329,7 +1328,7 @@ function PMA_RT_DOC($alltables ){ /** * Gets fields properties */ - $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';'); + $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE); $fields_cnt = PMA_DBI_num_rows($result);