2004-03-23 Olivier Mueller <om@omnis.ch>
* libraries/mysql_wrappers.lib.php: added mysqli support to the
PMA_mysql_field_flags function because mysqli does not know the function
mysqli_field_flags (submitted by Marcel Tschopp - aka 'ne0x').
* libraries/dbi/mysqli.dbi.lib.php: changed default query mode from
MYSQLI_USE_RESULT to MYSQLI_STORE_RESULT in the
PMA_DBI_try_query function (ne0x)
* libraries/dbi/mysql.dbi.lib.php, libraries/dbi/mysqli.dbi.lib.php:
Added wrapping function PMA_DBI_fetch_array() (ne0x)
* libraries/display_tbl.lib.php: PMA_displayTableBody() function now uses
the new PMA_DBI_fetch_array() function instead of
PMA_mysql_fetch_array() (ne0x)
This commit is contained in:
parent
cd65e1f844
commit
4d1dc6192e
13
ChangeLog
13
ChangeLog
@ -5,6 +5,19 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2004-03-23 Olivier Mueller <om@omnis.ch>
|
||||
* libraries/mysql_wrappers.lib.php: added mysqli support to the
|
||||
PMA_mysql_field_flags function because mysqli does not know the function
|
||||
mysqli_field_flags (submitted by Marcel Tschopp - aka 'ne0x' on SF).
|
||||
* libraries/dbi/mysqli.dbi.lib.php: changed default query mode from
|
||||
MYSQLI_USE_RESULT to MYSQLI_STORE_RESULT in the
|
||||
PMA_DBI_try_query function (ne0x)
|
||||
* libraries/dbi/mysql.dbi.lib.php, libraries/dbi/mysqli.dbi.lib.php:
|
||||
Added wrapping function PMA_DBI_fetch_array() (ne0x)
|
||||
* libraries/display_tbl.lib.php: PMA_displayTableBody() function now uses
|
||||
the new PMA_DBI_fetch_array() function instead of
|
||||
PMA_mysql_fetch_array() (ne0x)
|
||||
|
||||
2004-03-22 Michal Cihar <michal@cihar.com>
|
||||
* libraries/auth/config.auth.lib.php: Set correct variable to avoid
|
||||
attempting sending headers twice.
|
||||
|
||||
@ -172,6 +172,10 @@ function PMA_mysql_fetch_array($result, $type = FALSE) {
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_DBI_fetch_array($result) {
|
||||
return PMA_mysql_fetch_array($result);
|
||||
}
|
||||
|
||||
function PMA_DBI_fetch_assoc($result) {
|
||||
return PMA_mysql_fetch_array($result, MYSQL_ASSOC);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ function PMA_DBI_try_query($query, $link = NULL, $options = 0) {
|
||||
} elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) {
|
||||
$method = MYSQLI_USE_RESULT;
|
||||
} else {
|
||||
$method = MYSQLI_USE_RESULT;
|
||||
$method = MYSQLI_STORE_RESULT;
|
||||
}
|
||||
|
||||
if (empty($link)) {
|
||||
@ -156,6 +156,10 @@ function PMA_mysqli_fetch_array($result, $type = FALSE) {
|
||||
}
|
||||
}
|
||||
|
||||
function PMA_DBI_fetch_array($result) {
|
||||
return PMA_mysqli_fetch_array($result, MYSQLI_BOTH);
|
||||
}
|
||||
|
||||
function PMA_DBI_fetch_assoc($result) {
|
||||
return PMA_mysqli_fetch_array($result, MYSQLI_ASSOC);
|
||||
}
|
||||
@ -223,7 +227,117 @@ function PMA_DBI_affected_rows($link) {
|
||||
}
|
||||
|
||||
function PMA_DBI_get_fields_meta($result) {
|
||||
return mysqli_fetch_fields($result);
|
||||
|
||||
$typeAr[MYSQLI_TYPE_DECIMAL] = 'real';
|
||||
$typeAr[MYSQLI_TYPE_TINY] = 'int';
|
||||
$typeAr[MYSQLI_TYPE_SHORT] = 'int';
|
||||
$typeAr[MYSQLI_TYPE_LONG] = 'int';
|
||||
$typeAr[MYSQLI_TYPE_FLOAT] = 'real';
|
||||
$typeAr[MYSQLI_TYPE_DOUBLE] = 'real';
|
||||
$typeAr[MYSQLI_TYPE_NULL] = 'null';
|
||||
$typeAr[MYSQLI_TYPE_TIMESTAMP] = 'timestamp';
|
||||
$typeAr[MYSQLI_TYPE_LONGLONG] = 'int';
|
||||
$typeAr[MYSQLI_TYPE_INT24] = 'int';
|
||||
$typeAr[MYSQLI_TYPE_DATE] = 'date';
|
||||
$typeAr[MYSQLI_TYPE_TIME] = 'time';
|
||||
$typeAr[MYSQLI_TYPE_DATETIME] = 'datetime';
|
||||
$typeAr[MYSQLI_TYPE_YEAR] = 'year';
|
||||
$typeAr[MYSQLI_TYPE_NEWDATE] = 'date';
|
||||
$typeAr[MYSQLI_TYPE_ENUM] = 'unknown';
|
||||
$typeAr[MYSQLI_TYPE_SET] = 'unknown';
|
||||
$typeAr[MYSQLI_TYPE_TINY_BLOB] = 'blob';
|
||||
$typeAr[MYSQLI_TYPE_MEDIUM_BLOB] = 'blob';
|
||||
$typeAr[MYSQLI_TYPE_LONG_BLOB] = 'blob';
|
||||
$typeAr[MYSQLI_TYPE_BLOB] = 'blob';
|
||||
$typeAr[MYSQLI_TYPE_VAR_STRING] = 'string';
|
||||
$typeAr[MYSQLI_TYPE_STRING] = 'string';
|
||||
$typeAr[MYSQLI_TYPE_CHAR] = 'string';
|
||||
$typeAr[MYSQLI_TYPE_GEOMETRY] = 'unknown';
|
||||
|
||||
$fields = mysqli_fetch_fields($result);
|
||||
foreach($fields as $k => $field) {
|
||||
$fields[$k]->type = $typeAr[$field->type];
|
||||
$f = $field->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;
|
||||
}
|
||||
}
|
||||
$fields[$k]->flags = trim($flags);
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
function PMA_DBI_num_fields($result) {
|
||||
|
||||
@ -977,7 +977,10 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
// rabus: This function needs a little rework.
|
||||
// Using MYSQL_BOTH just pollutes the memory!
|
||||
|
||||
while ($row = PMA_mysql_fetch_array($dt_result)) { // !UNWRAPPED FUNCTION!
|
||||
// ne0x: Use function PMA_DBI_fetch_array() due to mysqli
|
||||
// compatibility. Now this function is wrapped.
|
||||
|
||||
while ($row = PMA_DBI_fetch_array($dt_result)) {
|
||||
|
||||
// lem9: "vertical display" mode stuff
|
||||
if (($row_no != 0) && ($repeat_cells != 0) && !($row_no % $repeat_cells) && ($disp_direction == 'horizontal' || $disp_direction == 'horizontalflipped')) {
|
||||
@ -1034,7 +1037,6 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql)
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
$field_flags = PMA_mysql_field_flags($dt_result, $i); // !UNWRAPPED FUNCTION!
|
||||
$meta = $fields_meta[$i];
|
||||
|
||||
// do not use an alias in a condition
|
||||
$column_for_condition = $meta->name;
|
||||
if (isset($analyzed_sql[0]['select_expr']) && is_array($analyzed_sql[0]['select_expr'])) {
|
||||
|
||||
@ -46,7 +46,100 @@ function PMA_mysql_fetch_row($result) {
|
||||
}
|
||||
|
||||
function PMA_mysql_field_flags($result, $field_offset) {
|
||||
return PMA_convert_display_charset(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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user