Permalink
Browse files

Added MySQLi library; Removed calls to old mysql_wrappers library.

  • Loading branch information...
derrabus committed Jan 22, 2004
1 parent 597dca0 commit 2915b5c3cea54b55d85f1b15029808480952b87d
Showing with 1,086 additions and 906 deletions.
  1. +29 −0 ChangeLog
  2. +5 −5 Documentation.html
  3. +6 −6 browse_foreigners.php
  4. +1 −1 db_create.php
  5. +10 −19 db_datadict.php
  6. +2 −2 db_details_common.php
  7. +9 −12 db_details_db_info.php
  8. +2 −2 db_details_links.php
  9. +14 −19 db_details_qbe.php
  10. +9 −6 db_details_structure.php
  11. +12 −13 db_printview.php
  12. +17 −33 db_search.php
  13. +18 −16 export.php
  14. +3 −3 ldi_table.php
  15. +11 −14 left.php
  16. +3 −3 libraries/auth/config.auth.lib.php
  17. +2 −2 libraries/auth/cookie.auth.lib.php
  18. +33 −44 libraries/bookmark.lib.php
  19. +26 −27 libraries/common.lib.php
  20. +57 −0 libraries/database_interface.lib.php
  21. +2 −2 libraries/db_table_exists.lib.php
  22. +48 −40 libraries/dbi/mysql.dbi.lib.php
  23. +216 −0 libraries/dbi/mysqli.dbi.lib.php
  24. +15 −13 libraries/display_tbl.lib.php
  25. +5 −5 libraries/export/csv.php
  26. +6 −6 libraries/export/latex.php
  27. +13 −13 libraries/export/sql.php
  28. +9 −9 libraries/export/xml.php
  29. +1 −1 libraries/get_foreign.lib.php
  30. +7 −9 libraries/mysql_charsets.lib.php
  31. +25 −33 libraries/relation.lib.php
  32. +2 −2 libraries/transformations.lib.php
  33. +6 −10 main.php
  34. +4 −4 mult_submits.inc.php
  35. +10 −9 pdf_pages.php
  36. +23 −28 pdf_schema.php
  37. +2 −2 querywindow.php
  38. +6 −7 read_dump.php
  39. +7 −2 server_common.inc.php
  40. +90 −106 server_privileges.php
  41. +3 −5 server_processlist.php
  42. +11 −14 server_status.php
  43. +12 −9 server_variables.php
  44. +23 −26 sql.php
  45. +8 −9 tbl_addfield.php
  46. +6 −8 tbl_alter.php
  47. +40 −42 tbl_change.php
  48. +6 −6 tbl_create.php
  49. +9 −10 tbl_indexes.php
  50. +18 −36 tbl_move_copy.php
  51. +8 −13 tbl_printview.php
  52. +2 −3 tbl_properties.inc.php
  53. +13 −13 tbl_properties_operations.php
  54. +4 −6 tbl_properties_structure.php
  55. +2 −3 tbl_properties_table_info.php
  56. +6 −12 tbl_query_box.php
  57. +15 −18 tbl_relation.php
  58. +3 −3 tbl_rename.php
  59. +24 −27 tbl_replace.php
  60. +99 −105 tbl_select.php
  61. +6 −8 transformation_wrapper.php
  62. +2 −2 user_password.php
View
@@ -5,6 +5,35 @@ phpMyAdmin - Changelog
$Id$
$Source$
+2004-01-22 Alexander M. Turek <innocenteyes@derrabus.de>
+ * libraries/dbi/mysqli.dbi.lib.php: Experimental new MySQLi library.
+ * browse_foreigners.php, db_create.php, db_datadict.php,
+ db_details_common.php, db_details_db_info.php, db_details_qbe.php,
+ db_details_structure.php, db_printview.php, export.php, ldi_table.php,
+ left.php, main.php, mult_submits.php, pdf_pages.php, pdf_schema.php,
+ querywindow.php, read_dump.php, server_common.inc.php,
+ server_privileges.php, server_processlist.php, server_status.php,
+ server_variables.php, sql.php, tbl_addfield.php, tbl_alter.php,
+ tbl_change.php, tbl_create.php, tbl_index.php, tbl_move_copy.php,
+ tbl_printview.php, tbl_properties.inc.php, tbl_properties_operations.php,
+ tbl_properties_table_info.php, tbl_query_box.php, tbl_relation.php,
+ tbl_rename.php, tbl_replace.php, tbl_select.php,
+ transformation_wrapper.php, user_password.php, libraries/bookmark.lib.php,
+ libraries/common.lib.php, libraries/db_table_exists.lib.php,
+ libraries/display_tbl:lib.php, libraries/get_foreign.lib.php,
+ libraries/mysql_charsets.lib.php, libraries/relation.lib.php,
+ libraries/transformations.lib.php, libraries/auth/config.auth.lib.php,
+ libraries/auth/cookie.auth.lib.php, libraries/export/*.php:
+ - Removed most remaining calls to old mysql_wrappers library;
+ - Small optimizations and XHTML fixes.
+ * libraries/database_interface.lib.php, libraries/dbi/mysql.dbi.lib.php:
+ - Moved PMA_DBI_get_dblist() definition to database_interface.lib;
+ - Fixed "undefined constant" warning (bug #881637);
+ - Added new functions: PMA_DBI_select_db(), PMA_DBI_get_fields(),
+ PMA_DBI_get_fields_meta();
+ - Bypassing charset conversion code for MySQL >= 4.1 experimentally.
+ * Documentation.html: Changed my email address.
+
2004-01-21 Michal Cihar <thesiswritten@cihar.com>
* lang/czech: Fixed unclear message.
View
@@ -2417,7 +2417,7 @@ <h4>
phpMyAdmin provides experimental support for MySQL&nbsp;4.1 and 5.0. That
means that although you can assign character sets to a table or field,
phpMyAdmin will not recode the data when inserting or extracting it.
- Instead, it will still use the character set you specified for the MySQL
+ Instead, it will still use the character set you specified for the MySQL
onnection.<br />
When compiling php, we strongly recommend that you manually link the MySQL
extension to a MySQL client library of at least the same version since the
@@ -3522,13 +3522,13 @@ <h4>
</p>
<h4>
[6.22] Bookmarks: Can I execute a default bookmark automatically
- when entering Browse mode for a table?
+ when entering Browse mode for a table?
</h4>
<p>
Yes. If a bookmark has the same label as a table name, it will be
- executed.
+ executed.
</p>
-
+
<a name="faqproject"></a><br />
<h3>[7. phpMyAdmin project]</h3>
@@ -3790,7 +3790,7 @@ <h2>Credits</h2>
* main author of the version 2.1.0.1
* bugfixes
-- Alexander M. Turek &lt;derrabus_at_gmx.de&gt;
+- Alexander M. Turek &lt;me_at_derrabus.de&gt;
* XML exports
* MySQL 4 related features
* various features and fixes
View
@@ -142,31 +142,31 @@ function formupdate(field, key) {
function dimsort($arrayA, $arrayB) {
$keyA = key($arrayA);
$keyB = key($arrayB);
-
+
if ($arrayA[$keyA] == $arrayB[$keyB]) {
return 0;
}
-
+
return ($arrayA[$keyA] < $arrayB[$keyB]) ? -1 : 1;
}
$mysql_key_relrow = array();
$mysql_val_relrow = array();
$count = 0;
- while ($relrow = @PMA_mysql_fetch_array($disp)) {
+ while ($relrow = @PMA_DBI_fetch_assoc($disp)) {
if ($foreign_display != FALSE) {
$val = $relrow[$foreign_display];
} else {
$val = '';
}
-
+
$mysql_key_relrow[$count] = array($relrow[$foreign_field] => $val);
$mysql_val_relrow[$count] = array($val => $relrow[$foreign_field]);
$count++;
}
-
+
usort($mysql_val_relrow, 'dimsort');
-
+
$hcount = 0;
for ($i = 0; $i < $count; $i++) {
$hcount++;
View
@@ -29,7 +29,7 @@
}
$sql_query .= ';';
-$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, FALSE, $err_url);
+$result = PMA_DBI_query($sql_query);
/**
View
@@ -52,15 +52,11 @@
/**
* Selects the database and gets tables names
*/
-PMA_mysql_select_db($db);
-$sql = 'SHOW TABLES FROM ' . PMA_backquote($db);
-$rowset = @PMA_mysql_query($sql);
+PMA_DBI_select_db($db);
+$rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
-if (!$rowset) {
- exit();
-}
$count = 0;
-while ($row = PMA_mysql_fetch_array($rowset)) {
+while ($row = PMA_DBI_fetch_assoc($rowset)) {
$myfieldname = 'Tables_in_' . htmlspecialchars($db);
$table = $row[$myfieldname];
if ($cfgRelation['commwork']) {
@@ -76,29 +72,25 @@
* Gets table informations
*/
// The 'show table' statement works correct since 3.23.03
- $local_query = 'SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'';
- $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
- $showtable = PMA_mysql_fetch_array($result);
+ $result = PMA_DBI_query('SHOW TABLE STATUS LIKE \'' . PMA_sqlAddslashes($table, TRUE) . '\'');
+ $showtable = PMA_DBI_fetch_assoc($result);
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
- if ($result) {
- PMA_DBI_free_result($result);
- }
+ PMA_DBI_free_result($result);
/**
* Gets table keys and retains them
*/
- $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
- $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
+ $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
$primary = '';
$indexes = array();
$lastIndex = '';
$indexes_info = array();
$indexes_data = array();
$pk_array = array(); // will be use to emphasis prim. keys in the table
// view
- while ($row = PMA_mysql_fetch_array($result)) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
// Backups the list of primary keys
if ($row['Key_name'] == 'PRIMARY') {
$primary .= $row['Column_name'] . ', ';
@@ -133,8 +125,7 @@
/**
* Gets fields properties
*/
- $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
- $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
+ $result = PMA_DBI_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ';');
$fields_cnt = PMA_DBI_num_rows($result);
// Check if we can use Relations (Mike Beck)
if (!empty($cfgRelation['relation'])) {
@@ -190,7 +181,7 @@
<?php
$i = 0;
- while ($row = PMA_mysql_fetch_array($result)) {
+ while ($row = PMA_DBI_fetch_assoc($result)) {
$bgcolor = ($i % 2) ?$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
$i++;
View
@@ -25,7 +25,7 @@
if (!isset($is_db) || !$is_db) {
// Not a valid db name -> back to the welcome page
if (!empty($db)) {
- $is_db = @PMA_mysql_select_db($db);
+ $is_db = PMA_DBI_select_db($db);
}
if (empty($db) || !$is_db) {
header('Location: ' . $cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
@@ -38,7 +38,7 @@
*/
if (isset($submitcharset) && PMA_MYSQL_INT_VERSION >= 40101) {
$sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT CHARACTER SET ' . $db_charset;
- $result = PMA_mysql_query($sql_query, $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), $sql_query, '', $err_url);
+ $result = PMA_DBI_query($sql_query);
$message = $strSuccess;
}
View
@@ -18,11 +18,10 @@
$tables = array();
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfg['SkipLockedTables'] == TRUE) {
- $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
- $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ $db_info_result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
// Blending out tables in use
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
- while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
+ while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
// if in use memorize tablename
if (preg_match('@in_use=[1-9]+@i', $tmp[1])) {
$sot_cache[$tmp[0]] = TRUE;
@@ -31,14 +30,12 @@
PMA_DBI_free_result($db_info_result);
if (isset($sot_cache)) {
- $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
- $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ $db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
- while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
+ while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
if (!isset($sot_cache[$tmp[0]])) {
- $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
- $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
- $sts_tmp = PMA_mysql_fetch_array($sts_result);
+ $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
+ $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
$tables[] = $sts_tmp;
} else { // table in use
$tables[] = array('Name' => $tmp[0]);
@@ -51,13 +48,13 @@
}
}
if (!isset($sot_ready)) {
- $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
- $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
+ $db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
- while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
+ while ($sts_tmp = PMA_DBI_fetch_assoc($db_info_result)) {
$tables[] = $sts_tmp;
}
PMA_DBI_free_result($db_info_result);
+ unset($db_info_result);
}
}
$num_tables = (isset($tables) ? count($tables) : 0);
View
@@ -37,8 +37,8 @@
// Drop link if allowed
if (!$cfg['AllowUserDropDatabase']) {
// Check if the user is a Superuser
- $links_result = @PMA_mysql_query('USE mysql');
- $cfg['AllowUserDropDatabase'] = (!PMA_mysql_error());
+ $cfg['AllowUserDropDatabase'] = PMA_DBI_select_db('mysql');
+ PMA_DBI_select_db($db);
}
if ($cfg['AllowUserDropDatabase']) {
$lnk5 = 'sql.php';
View
@@ -114,7 +114,7 @@
/**
* Prepares the form
*/
-$tbl_result = PMA_mysql_list_tables($db);
+$tbl_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';');
$tbl_result_cnt = PMA_DBI_num_rows($tbl_result);
$i = 0;
$k = 0;
@@ -129,8 +129,8 @@
// The tables list gets from MySQL
while ($i < $tbl_result_cnt) {
- $tbl = PMA_mysql_tablename($tbl_result, $i);
- $fld_results = @PMA_mysql_list_fields_alternate($db, $tbl) or PMA_mysqlDie(PMA_mysql_error(), 'PMA_mysql_list_fields_alternate(' . $db . ', ' . $tbl . ')', FALSE, $err_url);
+ list($tbl) = PMA_DBI_fetch_row($tbl_result);
+ $fld_results = PMA_DBI_get_fields($db, $tbl);
$fld_results_cnt = ($fld_results) ? count($fld_results) : 0;
$j = 0;
@@ -779,12 +779,11 @@
// ( When the control user is the same as the normal user
// because he is using one of his databases as pmadb,
// the last db selected is not always the one where we need to work)
- PMA_mysql_select_db($db);
+ PMA_DBI_select_db($db);
foreach($tab_all AS $tab) {
- $ind_qry = 'SHOW INDEX FROM ' . PMA_backquote($tab);
- $ind_rs = PMA_mysql_query($ind_qry);
- while ($ind = PMA_mysql_fetch_array($ind_rs)) {
+ $ind_rs = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($tab) . ';');
+ while ($ind = PMA_DBI_fetch_assoc($ind_rs)) {
$col1 = $tab . '.' . $ind['Column_name'];
if (isset($col_all[$col1])) {
if ($ind['non_unique'] == 0) {
@@ -853,10 +852,12 @@
if ($checked_tables[$tab] != 1 ) {
$rows_qry = 'SELECT COUNT(1) AS anz '
. 'FROM ' . PMA_backquote($tab);
- $rows_rs = PMA_mysql_query($rows_qry);
- while ($res = PMA_mysql_fetch_array($rows_rs)) {
+ $rows_rs = PMA_DBI_query($rows_qry);
+ while ($res = PMA_DBI_fetch_assoc($rows_rs)) {
$tsize[$tab] = $res['anz'];
}
+ PMA_DBI_free_result($rows_rs);
+ unset($rows_rs);
$checked_tables[$tab] = 1;
}
$csize[$tab] = $tsize[$tab];
@@ -928,16 +929,10 @@ function PMA_getRelatives($from) {
. ' AND ' . $to . '_db = \'' . PMA_sqlAddslashes($db) . '\''
. ' AND ' . $from . '_table IN ' . $in_know
. ' AND ' . $to . '_table IN ' . $in_left;
- if (isset($dbh)) {
- PMA_mysql_select_db($cfgRelation['db'], $dbh);
- $relations = @PMA_mysql_query($rel_query, $dbh) or PMA_mysqlDie(PMA_mysql_error($dbh), $rel_query, '', $err_url_0);
- PMA_mysql_select_db($db, $dbh);
- } else {
- PMA_mysql_select_db($cfgRelation['db']);
- $relations = @PMA_mysql_query($rel_query) or PMA_mysqlDie('', $rel_query, '', $err_url_0);
- PMA_mysql_select_db($db);
- }
- while ($row = PMA_mysql_fetch_array($relations)) {
+ PMA_DBI_select_db($cfgRelation['db'], $dbh);
+ $relations = @PMA_DBI_query($rel_query, $dbh);
+ PMA_DBI_select_db($db, $dbh);
+ while ($row = PMA_DBI_fetch_assoc($relations)) {
$found_table = $row[$to . '_table'];
if (isset($tab_left[$found_table])) {
$fromclause .= "\n" . ' LEFT JOIN '
View
@@ -156,8 +156,8 @@ function pma_TableHeader($alternate = FALSE) {
$tooltip_truename = array();
$tooltip_aliasname = array();
- $result = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db));
- while ($tmp = PMA_mysql_fetch_array($result)) {
+ $result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
+ while ($tmp = PMA_DBI_fetch_assoc($result)) {
$tooltip_truename[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
$tooltip_aliasname[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''));
if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
@@ -345,9 +345,10 @@ function pma_TableHeader($alternate = FALSE) {
$local_query = 'SELECT COUNT(*) AS count FROM '
. PMA_backquote($db) . '.'
. PMA_backquote($table);
- $table_info_result = PMA_mysql_query($local_query)
- or PMA_mysqlDie('', $local_query, '', $err_url_0);
- $row_count = PMA_mysql_result($table_info_result, 0, 'count');
+ $table_info_result = PMA_DBI_query($local_query);
+ list($row_count) = PMA_DBI_fetch_row($table_info_result);
+ PMA_DBI_free_result($table_info_result);
+ unset($table_info_result);
$sum_entries += $row_count;
} else {
$row_count = $sts_data['Rows'];
@@ -660,10 +661,12 @@ function pma_TableHeader($alternate = FALSE) {
<?php echo $strPageNumber; ?>&nbsp;
<select name="pdf_page_number">
<?php
- while ($pages = @PMA_mysql_fetch_array($test_rs)) {
+ while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
echo "\n" . ' '
. '<option value="' . $pages['page_nr'] . '">' . $pages['page_nr'] . ': ' . $pages['page_descr'] . '</option>';
} // end while
+ PMA_DBI_free_result($test_rs);
+ unset($test_rs);
echo "\n";
?>
</select><br />
Oops, something went wrong.

0 comments on commit 2915b5c

Please sign in to comment.