From e8c15e7e85e6334babbc45291e627f2913e1eaed Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 6 Apr 2008 12:52:53 +0000 Subject: [PATCH] bug 1926357, last part of the fix --- ChangeLog | 2 +- libraries/dbi/mysqli.dbi.lib.php | 1 + libraries/export/sql.php | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f3b6a302a..66dffbf9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -66,7 +66,7 @@ danbarry thanks to Tony Marston - tonymarston - bug #1918531 [compatibility] Navigation isn't w3.org valid thanks to Michael Keck - mkkeck -- bug #1926357 [data] BIT defaults displayed incorrectly (todo: export?) +- bug #1926357 [data] BIT defaults displayed incorrectly - patch #1930057 [auth] colon in password prevents HTTP login on CGI/IIS, thanks to Jürgen Wind - windkiel - patch #1929553 [lang] Don't output BOM character in Swedish language file, diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index aeef0b275..622a2f067 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -499,6 +499,7 @@ function PMA_DBI_get_fields_meta($result) // https://sf.net/tracker/?func=detail&aid=1532111&group_id=23067&atid=377408 //$typeAr[MYSQLI_TYPE_CHAR] = 'string'; $typeAr[MYSQLI_TYPE_GEOMETRY] = 'unknown'; + $typeAr[MYSQLI_TYPE_BIT] = 'bit'; $fields = mysqli_fetch_fields($result); diff --git a/libraries/export/sql.php b/libraries/export/sql.php index 5706979c9..1a66178a4 100644 --- a/libraries/export/sql.php +++ b/libraries/export/sql.php @@ -488,6 +488,10 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $show_dates = false) // results below. Nonetheless, we got 2 user reports about this // (see bug 1562533) so I remove the unbuffered mode. //$result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table), null, PMA_DBI_QUERY_UNBUFFERED); + // + // Note: SHOW CREATE TABLE, at least in MySQL 5.1.23, does not + // produce a displayable result for the default value of a BIT + // field, nor does the mysqldump command. See MySQL bug 35796 $result = PMA_DBI_query('SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table)); if ($result != FALSE && ($row = PMA_DBI_fetch_row($result))) { $create_query = $row[1]; @@ -900,6 +904,9 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) } else { $values[] = '0x' . bin2hex($row[$j]); } + // detection of 'bit' works only on mysqli extension + } elseif ($fields_meta[$j]->type == 'bit') { + $values[] = "b'" . PMA_sqlAddslashes(PMA_printable_bit_value($row[$j], $fields_meta[$j]->length)) . "'"; // something else -> treat as a string } else { $values[] = '\'' . str_replace($search, $replace, PMA_sqlAddslashes($row[$j])) . '\'';