Clarify variable name

This commit is contained in:
Marc Delisle 2012-04-21 14:48:30 -04:00
parent 1c58314c53
commit 3da49e3418
12 changed files with 60 additions and 60 deletions

View File

@ -183,17 +183,17 @@ foreach ($tables as $table) {
if ($row['Null'] == '') {
$row['Null'] = 'NO';
}
$extracted_fieldspec = PMA_extractColumnSpec($row['Type']);
$extracted_columnspec = PMA_extractColumnSpec($row['Type']);
// reformat mysql query output
// set or enum types: slashes single quotes inside options
if ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type']) {
if ('set' == $extracted_columnspec['type'] || 'enum' == $extracted_columnspec['type']) {
$type_nowrap = '';
} else {
$type_nowrap = ' class="nowrap"';
}
$type = htmlspecialchars($extracted_fieldspec['print_type']);
$attribute = $extracted_fieldspec['attribute'];
$type = htmlspecialchars($extracted_columnspec['print_type']);
$attribute = $extracted_columnspec['attribute'];
if (! isset($row['Default'])) {
if ($row['Null'] != 'NO') {
$row['Default'] = '<i>NULL</i>';

View File

@ -2908,28 +2908,28 @@ function PMA_convert_bit_default_value($bit_default_value)
}
/**
* Extracts the various parts from a field type spec
* Extracts the various parts from a column spec
*
* @param string $fieldspec Field specification
* @param string $columnspec Column specification
*
* @return array associative array containing type, spec_in_brackets
* and possibly enum_set_values (another array)
*/
function PMA_extractColumnSpec($fieldspec)
function PMA_extractColumnSpec($columnspec)
{
$first_bracket_pos = strpos($fieldspec, '(');
$first_bracket_pos = strpos($columnspec, '(');
if ($first_bracket_pos) {
$spec_in_brackets = chop(
substr(
$fieldspec,
$columnspec,
$first_bracket_pos + 1,
(strrpos($fieldspec, ')') - $first_bracket_pos - 1)
(strrpos($columnspec, ')') - $first_bracket_pos - 1)
)
);
// convert to lowercase just to be sure
$type = strtolower(chop(substr($fieldspec, 0, $first_bracket_pos)));
$type = strtolower(chop(substr($columnspec, 0, $first_bracket_pos)));
} else {
$type = strtolower($fieldspec);
$type = strtolower($columnspec);
$spec_in_brackets = '';
}
@ -2941,9 +2941,9 @@ function PMA_extractColumnSpec($fieldspec)
$index = 0;
// While there is another character to process
while (isset($fieldspec[$index])) {
while (isset($columnspec[$index])) {
// Grab the char to look at
$char = $fieldspec[$index];
$char = $columnspec[$index];
// If it is a single quote, needs to be handled specially
if ($char == "'") {
@ -2955,8 +2955,8 @@ function PMA_extractColumnSpec($fieldspec)
// Otherwise, it may be either an end of a string,
// or a 'double quote' which can be handled as-is
// Check out the next character (if possible)
$has_next = isset($fieldspec[$index + 1]);
$next = $has_next ? $fieldspec[$index + 1] : null;
$has_next = isset($columnspec[$index + 1]);
$next = $has_next ? $columnspec[$index + 1] : null;
//If we have reached the end of our 'working' string (because
//there are no more chars,or the next char is not another quote)
@ -2973,8 +2973,8 @@ function PMA_extractColumnSpec($fieldspec)
}
}
} elseif ('\\' == $char
&& isset($fieldspec[$index + 1])
&& "'" == $fieldspec[$index + 1]
&& isset($columnspec[$index + 1])
&& "'" == $columnspec[$index + 1]
) {
// escaping of a quote?
$working .= "'";
@ -2994,10 +2994,10 @@ function PMA_extractColumnSpec($fieldspec)
$enum_set_values = array();
/* Create printable type name */
$printtype = strtolower($fieldspec);
$printtype = strtolower($columnspec);
// Strip the "BINARY" attribute, except if we find "BINARY(" because
// this would be a BINARY or VARBINARY field type;
// this would be a BINARY or VARBINARY column type;
// by the way, a BLOB should not show the BINARY attribute
// because this is not accepted in MySQL syntax.
if (preg_match('@binary@', $printtype) && ! preg_match('@binary[\(]@', $printtype)) {

View File

@ -202,8 +202,8 @@ if (isset($plugin_list)) {
foreach ($columns as $column) {
$schema_insert .= '<tr class="print-category">';
$extracted_fieldspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_fieldspec['print_type']);
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
if (empty($type)) {
$type = '&nbsp;';
}
@ -333,8 +333,8 @@ if (isset($plugin_list)) {
$schema_insert .= '<tr class="print-category">';
$extracted_fieldspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_fieldspec['print_type']);
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
if (empty($type)) {
$type = '&nbsp;';
}

View File

@ -442,8 +442,8 @@ if (isset($plugin_list)) {
$fields = PMA_DBI_get_columns($db, $table);
foreach ($fields as $row) {
$extracted_fieldspec = PMA_extractColumnSpec($row['Type']);
$type = $extracted_fieldspec['print_type'];
$extracted_columnspec = PMA_extractColumnSpec($row['Type']);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = ' ';
}

View File

@ -277,8 +277,8 @@ if (isset($plugin_list)) {
. '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
. '</table:table-cell>';
$extracted_fieldspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_fieldspec['print_type']);
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
if (empty($type)) {
$type = '&nbsp;';
}
@ -422,8 +422,8 @@ if (isset($plugin_list)) {
. '<text:p>' . htmlspecialchars($field_name) . '</text:p>'
. '</table:table-cell>';
$extracted_fieldspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_fieldspec['print_type']);
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
if (empty($type)) {
$type = '&nbsp;';
}

View File

@ -201,8 +201,8 @@ if (isset($plugin_list)) {
$columns = PMA_DBI_get_columns($db, $table);
foreach ($columns as $column) {
$extracted_fieldspec = PMA_extractColumnSpec($column['Type']);
$type = $extracted_fieldspec['print_type'];
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = '&nbsp;';
}
@ -330,8 +330,8 @@ if (isset($plugin_list)) {
$columns = PMA_DBI_get_columns($db, $table);
foreach ($columns as $column) {
$extracted_fieldspec = PMA_extractColumnSpec($column['Type']);
$type = $extracted_fieldspec['print_type'];
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = '&nbsp;';
}

View File

@ -1340,9 +1340,9 @@ class PMA_Pdf_Relation_Schema extends PMA_Export_Relation_Schema
$pdf->SetFont($this->_ff, '');
foreach ($columns as $row) {
$extracted_fieldspec = PMA_extractColumnSpec($row['Type']);
$type = $extracted_fieldspec['print_type'];
$attribute = $extracted_fieldspec['attribute'];
$extracted_columnspec = PMA_extractColumnSpec($row['Type']);
$type = $extracted_columnspec['print_type'];
$attribute = $extracted_columnspec['attribute'];
if (! isset($row['Default'])) {
if ($row['Null'] != '' && $row['Null'] != 'NO') {
$row['Default'] = 'NULL';

View File

@ -241,8 +241,8 @@ for ($i = 0; $i < $num_fields; $i++) {
}
if (isset($row['Type'])) {
$extracted_fieldspec = PMA_extractColumnSpec($row['Type']);
if ($extracted_fieldspec['type'] == 'bit') {
$extracted_columnspec = PMA_extractColumnSpec($row['Type']);
if ($extracted_columnspec['type'] == 'bit') {
$row['Default'] = PMA_convert_bit_default_value($row['Default']);
}
}
@ -283,8 +283,8 @@ for ($i = 0; $i < $num_fields; $i++) {
$type = '';
$length = '';
} else {
$type = $extracted_fieldspec['type'];
$length = $extracted_fieldspec['spec_in_brackets'];
$type = $extracted_columnspec['type'];
$length = $extracted_columnspec['spec_in_brackets'];
}
// some types, for example longtext, are reported as
@ -395,8 +395,8 @@ for ($i = 0; $i < $num_fields; $i++) {
. ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
$attribute = '';
if (isset($extracted_fieldspec)) {
$attribute = $extracted_fieldspec['attribute'];
if (isset($extracted_columnspec)) {
$attribute = $extracted_columnspec['attribute'];
}
if (isset($row['Extra']) && $row['Extra'] == 'on update CURRENT_TIMESTAMP') {

View File

@ -484,7 +484,7 @@ foreach ($rows as $row_id => $vrow) {
}
}
$field = $table_fields[$i];
$extracted_fieldspec = PMA_extractColumnSpec($field['Type']);
$extracted_columnspec = PMA_extractColumnSpec($field['Type']);
if (-1 === $field['len']) {
$field['len'] = PMA_DBI_field_len($vresult, $i);
@ -537,7 +537,7 @@ foreach ($rows as $row_id => $vrow) {
$data = $vrow[$field['Field']];
} elseif ($field['True_Type'] == 'bit') {
$special_chars = PMA_printable_bit_value(
$vrow[$field['Field']], $extracted_fieldspec['spec_in_brackets']
$vrow[$field['Field']], $extracted_columnspec['spec_in_brackets']
);
} elseif (in_array($field['True_Type'], $gis_data_types)) {
// Convert gis data to Well Know Text format
@ -757,7 +757,7 @@ foreach ($rows as $row_id => $vrow) {
} elseif ($field['pma_type'] == 'enum') {
if (! isset($table_fields[$i]['values'])) {
$table_fields[$i]['values'] = array();
foreach ($extracted_fieldspec['enum_set_values'] as $val) {
foreach ($extracted_columnspec['enum_set_values'] as $val) {
// Removes automatic MySQL escape format
$val = str_replace('\'\'', '\'', str_replace('\\\\', '\\', $val));
$table_fields[$i]['values'][] = array(
@ -828,7 +828,7 @@ foreach ($rows as $row_id => $vrow) {
} elseif ($field['pma_type'] == 'set') {
if (! isset($table_fields[$i]['values'])) {
$table_fields[$i]['values'] = array();
foreach ($extracted_fieldspec['enum_set_values'] as $val) {
foreach ($extracted_columnspec['enum_set_values'] as $val) {
$table_fields[$i]['values'][] = array(
'plain' => $val,
'html' => htmlspecialchars($val),
@ -954,7 +954,7 @@ foreach ($rows as $row_id => $vrow) {
} elseif (! in_array($field['pma_type'], $no_support_types)) {
// ignore this column to avoid changing it
if ($field['is_char']) {
$fieldsize = $extracted_fieldspec['spec_in_brackets'];
$fieldsize = $extracted_columnspec['spec_in_brackets'];
if ($fieldsize > $cfg['MaxSizeForInputField']) {
/**
* This case happens for CHAR or VARCHAR columns which have

View File

@ -152,9 +152,9 @@ foreach ($the_tables as $key => $table) {
<tbody>
<?php
foreach ($columns as $row) {
$extracted_fieldspec = PMA_extractColumnSpec($row['Type']);
$type = $extracted_fieldspec['print_type'];
$attribute = $extracted_fieldspec['attribute'];
$extracted_columnspec = PMA_extractColumnSpec($row['Type']);
$type = $extracted_columnspec['print_type'];
$attribute = $extracted_columnspec['attribute'];
if (! isset($row['Default'])) {
if ($row['Null'] != '' && $row['Null'] != 'NO') {

View File

@ -256,20 +256,20 @@ foreach ($fields as $row) {
$aryFields[] = $row['Field'];
$type = $row['Type'];
$extracted_fieldspec = PMA_extractColumnSpec($row['Type']);
$extracted_columnspec = PMA_extractColumnSpec($row['Type']);
if ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type']) {
if ('set' == $extracted_columnspec['type'] || 'enum' == $extracted_columnspec['type']) {
$type_nowrap = '';
} else {
$type_nowrap = ' class="nowrap"';
}
$type = $extracted_fieldspec['print_type'];
$type = $extracted_columnspec['print_type'];
if (empty($type)) {
$type = ' ';
}
$field_charset = '';
if ($extracted_fieldspec['can_contain_collation'] && ! empty($row['Collation'])) {
if ($extracted_columnspec['can_contain_collation'] && ! empty($row['Collation'])) {
$field_charset = $row['Collation'];
}
@ -280,7 +280,7 @@ foreach ($fields as $row) {
$type_mime = '';
}
$attribute = $extracted_fieldspec['attribute'];
$attribute = $extracted_columnspec['attribute'];
// MySQL 4.1.2+ TIMESTAMP options
// (if on_update_current_timestamp is set, then it's TRUE)
@ -327,13 +327,13 @@ foreach ($fields as $row) {
<?php echo $rownum; ?>
</td>
<th class="nowrap"><label for="checkbox_row_<?php echo $rownum; ?>"><?php echo $displayed_field_name; ?></label></th>
<td<?php echo $type_nowrap; ?>><bdo dir="ltr" lang="en"><?php echo $extracted_fieldspec['displayed_type']; echo $type_mime; ?></bdo></td>
<td<?php echo $type_nowrap; ?>><bdo dir="ltr" lang="en"><?php echo $extracted_columnspec['displayed_type']; echo $type_mime; ?></bdo></td>
<td><?php echo (empty($field_charset) ? '' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>'); ?></td>
<td class="column_attribute nowrap"><?php echo $attribute; ?></td>
<td><?php echo (($row['Null'] == 'YES') ? __('Yes') : __('No')); ?></td>
<td class="nowrap"><?php
if (isset($row['Default'])) {
if ($extracted_fieldspec['type'] == 'bit') {
if ($extracted_columnspec['type'] == 'bit') {
// here, $row['Default'] contains something like b'010'
echo PMA_convert_bit_default_value($row['Default']);
} else {

View File

@ -300,8 +300,8 @@ if (isset($_REQUEST['snapshot'])) {
<td><?php echo (($field['Null'] == 'YES') ? __('Yes') : __('No')); ?></td>
<td><?php
if (isset($field['Default'])) {
$extracted_fieldspec = PMA_extractColumnSpec($field['Type']);
if ($extracted_fieldspec['type'] == 'bit') {
$extracted_columnspec = PMA_extractColumnSpec($field['Type']);
if ($extracted_columnspec['type'] == 'bit') {
// here, $field['Default'] contains something like b'010'
echo PMA_convert_bit_default_value($field['Default']);
} else {