support of BINARY and VARBINARY field types

This commit is contained in:
Marc Delisle
2004-08-28 14:14:14 +00:00
parent a16d97912f
commit c5b3b01641
5 changed files with 31 additions and 5 deletions

View File

@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
$Id$
$Source$
2004-08-28 Marc Delisle <lem9@users.sourceforge.net>
* 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 <lem9@users.sourceforge.net>
* tbl_relation.php, libraries/display_tbl.lib.php: bug 1016997,
wrong db name generated in SHOW KEYS

View File

@@ -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');
}

View File

@@ -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;
?>

View File

@@ -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 {
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');
}

View File

@@ -144,14 +144,23 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
$zerofill = 0;
} else {
$type_nowrap = ' nowrap="nowrap"';
// 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 = '&nbsp;';
}
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');
}