diff --git a/ChangeLog b/ChangeLog index 198301554..375945c51 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-08-28 Marc Delisle + * tbl_properties_structure.php, tbl_properties.inc.php, + libraries/sqlparser.data.php, /database_interface.lib.php: + support for VARBINARY and BINARY field types + 2004-08-27 Marc Delisle * tbl_relation.php, libraries/display_tbl.lib.php: bug 1016997, wrong db name generated in SHOW KEYS diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index f965d4a86..4073c6089 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -155,6 +155,11 @@ function PMA_DBI_postConnect($link) { PMA_DBI_query('SET collation_connection = \'' . $collation_connection . '\';', $link, PMA_DBI_QUERY_STORE); } $collation_connection = PMA_DBI_get_variable('collation_connection', PMA_DBI_GETVAR_SESSION, $link); + + // Add some field types to the list + $GLOBALS['cfg']['ColumnTypes'][] = 'BINARY'; + $GLOBALS['cfg']['ColumnTypes'][] = 'VARBINARY'; + } else { require_once('./libraries/charset_conversion.lib.php'); } diff --git a/libraries/sqlparser.data.php b/libraries/sqlparser.data.php index 56d799645..7f1be0697 100644 --- a/libraries/sqlparser.data.php +++ b/libraries/sqlparser.data.php @@ -461,6 +461,7 @@ $PMA_SQPdata_reserved_word_cnt = 261; $PMA_SQPdata_column_type = array ( 'BIGINT', + 'BINARY', 'BIT', 'BLOB', 'BOOL', @@ -505,6 +506,6 @@ $PMA_SQPdata_column_type = array ( 'YEAR' ); //$PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type); -$PMA_SQPdata_column_type_cnt = 43; +$PMA_SQPdata_column_type_cnt = 44; ?> diff --git a/tbl_properties.inc.php b/tbl_properties.inc.php index 0065cd85e..a4a742209 100644 --- a/tbl_properties.inc.php +++ b/tbl_properties.inc.php @@ -226,7 +226,9 @@ for ($i = 0 ; $i < $num_fields; $i++) { $type = $tmp[1]; $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); } else { - $type = preg_replace('@BINARY@i', '', $type); + // strip the "BINARY" attribute, except if we find "BINARY(" because + // this would be a BINARY or VARBINARY field type + $type = preg_replace('@BINARY([^\(])@i', '', $type); $type = preg_replace('@ZEROFILL@i', '', $type); $type = preg_replace('@UNSIGNED@i', '', $type); @@ -278,7 +280,11 @@ for ($i = 0 ; $i < $num_fields; $i++) { $unsigned = 0; $zerofill = 0; } else { - $binary = stristr($row['Type'], 'binary'); + if (!preg_match('@BINARY[\(]@i', $row['Type'])) { + $binary = stristr($row['Type'], 'binary'); + } else { + $binary = FALSE; + } $unsigned = stristr($row['Type'], 'unsigned'); $zerofill = stristr($row['Type'], 'zerofill'); } diff --git a/tbl_properties_structure.php b/tbl_properties_structure.php index b2ed968f9..550e4140d 100644 --- a/tbl_properties_structure.php +++ b/tbl_properties_structure.php @@ -144,14 +144,23 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { $zerofill = 0; } else { $type_nowrap = ' nowrap="nowrap"'; - $type = preg_replace('@BINARY@i', '', $type); + // strip the "BINARY" attribute, except if we find "BINARY(" because + // this would be a BINARY or VARBINARY field type + if (!preg_match('@BINARY[\(]@i', $type)) { + $type = preg_replace('@BINARY@i', '', $type); + } $type = preg_replace('@ZEROFILL@i', '', $type); $type = preg_replace('@UNSIGNED@i', '', $type); if (empty($type)) { $type = ' '; } - $binary = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary'); + if (!preg_match('@BINARY[\(]@i', $row['Type'])) { + $binary = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary'); + } else { + $binary = FALSE; + } + $unsigned = stristr($row['Type'], 'unsigned'); $zerofill = stristr($row['Type'], 'zerofill'); }