phpMyAdmin should now be fully compatible with the new mysqli extension.
This commit is contained in:
@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2004-04-08 Marcel Tschopp <marcel.tschopp@gmx.net>
|
||||
* phpinfo.php, tbl_relation.php, libraries/display_tbl.lib.php
|
||||
libraries/mysql_wrappers.lib.php, libraries/dbi/mysql.dbi.lib.php
|
||||
libraries/dbi/mysqli.dbi.lib.php, libraries/export/*.php:
|
||||
phpMyAdmin should now be fully compatible with the new mysqli
|
||||
extension. All extension specific functions are wrapped now.
|
||||
|
||||
2004-04-07 Marcel Tschopp <marcel.tschopp@gmx.net>
|
||||
* multi_submits.inc.php, lang/german: bug 930714, wrong spelling and
|
||||
query display. Thanks to Daniel Marschall (blackdrake)
|
||||
|
@@ -259,4 +259,12 @@ function PMA_DBI_field_len($result, $i) {
|
||||
return mysql_field_len($result, $i);
|
||||
}
|
||||
|
||||
function PMA_DBI_field_name($result, $i) {
|
||||
return mysql_field_name($result, $field_index);
|
||||
}
|
||||
|
||||
function PMA_DBI_field_flags($result, $i) {
|
||||
return PMA_mysql_field_flags($result, $i);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -357,4 +357,93 @@ function PMA_DBI_field_len($result, $i) {
|
||||
return $info->length;
|
||||
}
|
||||
|
||||
function PMA_DBI_field_name($result, $i) {
|
||||
$info = mysqli_fetch_field_direct($result, $i);
|
||||
return $info->name;
|
||||
}
|
||||
|
||||
function PMA_DBI_field_flags($result, $i) {
|
||||
$f = mysqli_fetch_field_direct($result, $i);
|
||||
$f = $f->flags;
|
||||
$flags = '';
|
||||
while ($f > 0) {
|
||||
if (floor($f / 65536)) {
|
||||
$flags .= 'unique ';
|
||||
$f -= 65536;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 32768)) {
|
||||
$flags .= 'num ';
|
||||
$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 ';
|
||||
$f -= 64;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 32)) {
|
||||
$flags .= 'unsigned ';
|
||||
$f -= 32;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 16)) {
|
||||
$flags .= 'blob ';
|
||||
$f -= 16;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 8)) {
|
||||
$flags .= 'multiple_key ';
|
||||
$f -= 8;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 4)) {
|
||||
$flags .= 'unique_key ';
|
||||
$f -= 4;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 2)) {
|
||||
$flags .= 'primary_key ';
|
||||
$f -= 2;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 1)) {
|
||||
$flags .= 'not_null ';
|
||||
$f -= 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return PMA_convert_display_charset(trim($flags));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -1035,7 +1035,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
// "primary" key to use in links
|
||||
if ($is_display['edit_lnk'] == 'ur' /* || $is_display['edit_lnk'] == 'dr' */) {
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$field_flags = PMA_mysql_field_flags($dt_result, $i); // !UNWRAPPED FUNCTION!
|
||||
$field_flags = PMA_DBI_field_flags($dt_result, $i);
|
||||
$meta = $fields_meta[$i];
|
||||
// do not use an alias in a condition
|
||||
$column_for_condition = $meta->name;
|
||||
@@ -1351,7 +1351,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
// TEXT fields type, however TEXT fields must be displayed
|
||||
// even if $cfg['ShowBlob'] is false -> get the true type
|
||||
// of the fields.
|
||||
$field_flags = PMA_mysql_field_flags($dt_result, $i); // !UNWRAPPED FUNCTION!
|
||||
$field_flags = PMA_DBI_field_flags($dt_result, $i);
|
||||
if (stristr($field_flags, 'BINARY')) {
|
||||
$blobtext = '[BLOB';
|
||||
if (isset($row[$pointer])) {
|
||||
@@ -1398,7 +1398,7 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
}
|
||||
|
||||
// loic1: displays special characters from binaries
|
||||
$field_flags = PMA_mysql_field_flags($dt_result, $i); // !UNWRAPPED FUNCTION!
|
||||
$field_flags = PMA_DBI_field_flags($dt_result, $i);
|
||||
if (stristr($field_flags, 'BINARY')) {
|
||||
$row[$pointer] = str_replace("\x00", '\0', $row[$pointer]);
|
||||
$row[$pointer] = str_replace("\x08", '\b', $row[$pointer]);
|
||||
|
@@ -121,10 +121,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$schema_insert = '';
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
if ($enclosed == '') {
|
||||
$schema_insert .= stripslashes(mysql_field_name($result, $i)); //! UNWRAPPED FUNCTION!
|
||||
$schema_insert .= stripslashes(PMA_DBI_field_name($result, $i));
|
||||
} else {
|
||||
$schema_insert .= $enclosed
|
||||
. str_replace($enclosed, $escaped . $enclosed, stripslashes(mysql_field_name($result, $i))) //! UNWRAPPED FUNCTION!
|
||||
. str_replace($enclosed, $escaped . $enclosed, stripslashes(PMA_DBI_field_name($result, $i)))
|
||||
. $enclosed;
|
||||
}
|
||||
$schema_insert .= $separator;
|
||||
|
@@ -118,11 +118,11 @@ function PMA_exportDBCreate($db) {
|
||||
* @access public
|
||||
*/
|
||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
$result = PMA_mysql_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
|
||||
$result = PMA_DBI_try_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = mysql_field_name($result, $i);
|
||||
$columns[$i] = PMA_DBI_field_name($result, $i);
|
||||
}
|
||||
unset($i);
|
||||
|
||||
|
@@ -434,7 +434,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
||||
if (isset($analyzed_sql[0]['select_expr'][$j]['column'])) {
|
||||
$field_set[$j] = PMA_backquote($analyzed_sql[0]['select_expr'][$j]['column'], $use_backquotes);
|
||||
} else {
|
||||
$field_set[$j] = PMA_backquote(PMA_mysql_field_name($result, $j), $use_backquotes); //! UNWRAPPED FUNCTION!
|
||||
$field_set[$j] = PMA_backquote(PMA_DBI_field_name($result, $j), $use_backquotes);
|
||||
}
|
||||
|
||||
$type = $field_types[$field_set[$j]];
|
||||
|
@@ -117,7 +117,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||
|
||||
$columns_cnt = PMA_DBI_num_fields($result);
|
||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||
$columns[$i] = stripslashes(mysql_field_name($result, $i)); //! UNWRAPPED FUNCTION!
|
||||
$columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
|
||||
}
|
||||
unset($i);
|
||||
|
||||
|
@@ -46,100 +46,7 @@ function PMA_mysql_fetch_row($result) {
|
||||
}
|
||||
|
||||
function PMA_mysql_field_flags($result, $field_offset) {
|
||||
/* ne0x/swix: added a switch for the mysqli extention because mysqli does not know
|
||||
the function mysqli_field_flags */
|
||||
|
||||
global $cfg;
|
||||
|
||||
switch ($cfg['Server']['extension']) {
|
||||
case "mysqli":
|
||||
$f = mysqli_fetch_field_direct($result, $field_offset);
|
||||
$f = $f->flags;
|
||||
$flags = '';
|
||||
while ($f > 0) {
|
||||
if (floor($f / 65536)) {
|
||||
$flags .= 'unique ';
|
||||
$f -= 65536;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 32768)) {
|
||||
$flags .= 'num ';
|
||||
$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 ';
|
||||
$f -= 64;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 32)) {
|
||||
$flags .= 'unsigned ';
|
||||
$f -= 32;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 16)) {
|
||||
$flags .= 'blob ';
|
||||
$f -= 16;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 8)) {
|
||||
$flags .= 'multiple_key ';
|
||||
$f -= 8;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 4)) {
|
||||
$flags .= 'unique_key ';
|
||||
$f -= 4;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 2)) {
|
||||
$flags .= 'primary_key ';
|
||||
$f -= 2;
|
||||
continue;
|
||||
}
|
||||
if (floor($f / 1)) {
|
||||
$flags .= 'not_null ';
|
||||
$f -= 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return PMA_convert_display_charset(trim($flags));
|
||||
|
||||
case "mysql":
|
||||
default:
|
||||
return PMA_convert_display_charset(mysql_field_flags($result, $field_offset));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_mysql_field_name($result, $field_index) {
|
||||
|
@@ -13,7 +13,7 @@ require_once('./libraries/common.lib.php');
|
||||
/**
|
||||
* Displays PHP information
|
||||
*/
|
||||
$is_superuser = @PMA_mysql_query('USE mysql', $userlink);
|
||||
$is_superuser = @PMA_DBI_try_query('USE mysql', $userlink);
|
||||
if ($is_superuser || $cfg['ShowPhpInfo']) {
|
||||
phpinfo();
|
||||
}
|
||||
|
@@ -337,7 +337,7 @@ if ($cfgRelation['relwork']) {
|
||||
|
||||
|
||||
// Now find out the columns of our $table
|
||||
$col_rs = PMA_mysql_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';');
|
||||
$col_rs = PMA_DBI_try_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';');
|
||||
|
||||
if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
||||
while ($row = PMA_DBI_fetch_assoc($col_rs)) {
|
||||
|
Reference in New Issue
Block a user