From 3da49e34183b972724f76b7a7ec7ce2ad4dd4f57 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 21 Apr 2012 14:48:30 -0400 Subject: [PATCH] Clarify variable name --- db_datadict.php | 8 ++--- libraries/common.lib.php | 32 +++++++++---------- libraries/export/htmlword.php | 8 ++--- libraries/export/latex.php | 4 +-- libraries/export/odt.php | 8 ++--- libraries/export/texytext.php | 8 ++--- .../schema/Pdf_Relation_Schema.class.php | 6 ++-- libraries/tbl_properties.inc.php | 12 +++---- tbl_change.php | 10 +++--- tbl_printview.php | 6 ++-- tbl_structure.php | 14 ++++---- tbl_tracking.php | 4 +-- 12 files changed, 60 insertions(+), 60 deletions(-) diff --git a/db_datadict.php b/db_datadict.php index 65afabbd94..578242fa13 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -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'] = 'NULL'; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index f0867fb379..0190521fd2 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -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)) { diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php index 6febd98eb7..1c4c685fa4 100644 --- a/libraries/export/htmlword.php +++ b/libraries/export/htmlword.php @@ -202,8 +202,8 @@ if (isset($plugin_list)) { foreach ($columns as $column) { $schema_insert .= ''; - $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 = ' '; } @@ -333,8 +333,8 @@ if (isset($plugin_list)) { $schema_insert .= ''; - $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 = ' '; } diff --git a/libraries/export/latex.php b/libraries/export/latex.php index d21f63efb9..3cac1e5a7b 100644 --- a/libraries/export/latex.php +++ b/libraries/export/latex.php @@ -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 = ' '; } diff --git a/libraries/export/odt.php b/libraries/export/odt.php index a40dde4280..6005312d6f 100644 --- a/libraries/export/odt.php +++ b/libraries/export/odt.php @@ -277,8 +277,8 @@ if (isset($plugin_list)) { . '' . htmlspecialchars($field_name) . '' . ''; - $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 = ' '; } @@ -422,8 +422,8 @@ if (isset($plugin_list)) { . '' . htmlspecialchars($field_name) . '' . ''; - $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 = ' '; } diff --git a/libraries/export/texytext.php b/libraries/export/texytext.php index f0677483b8..9b5fbcc075 100644 --- a/libraries/export/texytext.php +++ b/libraries/export/texytext.php @@ -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 = ' '; } @@ -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 = ' '; } diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php index 2c704c3270..6fcc2a0f0e 100644 --- a/libraries/schema/Pdf_Relation_Schema.class.php +++ b/libraries/schema/Pdf_Relation_Schema.class.php @@ -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'; diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 344c3d6558..fd9bda5efe 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -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') { diff --git a/tbl_change.php b/tbl_change.php index 1cddf4cf3e..aa71791995 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -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 diff --git a/tbl_printview.php b/tbl_printview.php index 1a64f3ea5a..60fc66f292 100644 --- a/tbl_printview.php +++ b/tbl_printview.php @@ -152,9 +152,9 @@ foreach ($the_tables as $key => $table) { - > + > ' . $field_charset . ''); ?>