diff --git a/libraries/Types.class.php b/libraries/Types.class.php index 4f3ba320c9..ec14814dc5 100644 --- a/libraries/Types.class.php +++ b/libraries/Types.class.php @@ -413,11 +413,9 @@ class PMA_Types_MySQL extends PMA_Types case 'MEDIUMBLOB': case 'BLOB': case 'LONGBLOB': - return 'CHAR'; - case 'ENUM': case 'SET': - return ''; + return 'CHAR'; case 'GEOMETRY': case 'POINT': @@ -766,13 +764,11 @@ class PMA_Types_Drizzle extends PMA_Types case 'TEXT': case 'VARBINARY': case 'BLOB': + case 'ENUM': return 'CHAR'; case 'UUID': return 'UUID'; - - case 'ENUM': - return ''; } return ''; } diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 28c8055f58..f532d770d6 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -3655,7 +3655,7 @@ function PMA_getGISFunctions($geom_type = null, $binary = true, $display = false } /** - * Creates a dropdown box with MySQL functions for a particular column. + * Returns default function for a particular column. * * @param array $field Data about the column for which * to generate the dropdown @@ -3669,16 +3669,12 @@ function PMA_getGISFunctions($geom_type = null, $binary = true, $display = false * @return string An HTML snippet of a dropdown list with function * names appropriate for the requested column. */ -function PMA_getFunctionsForField($field, $insert_mode) +function PMA_getDefaultFunctionForField($field, $insert_mode) { global $cfg, $analyzed_sql, $data; - $selected = ''; - $dropdown = array(); $default_function = ''; - $dropdown = $GLOBALS['PMA_Types']->getFunctions($field['True_Type']); - // Can we get field class based values? $current_class = $GLOBALS['PMA_Types']->getTypeClass($field['True_Type']); if (! empty($current_class)) { @@ -3686,8 +3682,6 @@ function PMA_getFunctionsForField($field, $insert_mode) $default_function = $cfg['DefaultFunctions']['FUNC_' . $current_class]; } } - $dropdown_built = array(); - $op_spacing_needed = false; // what function defined as default? // for the first timestamp we don't set the default function // if there is a default value for the timestamp @@ -3702,6 +3696,10 @@ function PMA_getFunctionsForField($field, $insert_mode) ) { $default_function = $cfg['DefaultFunctions']['first_timestamp']; } + // Default for first timestamp field + if ($field['first_timestamp']) { + $default_function = $cfg['DefaultFunctions']['first_timestamp']; + } // For primary keys of type char(36) or varchar(36) UUID if the default // function // Only applies to insert mode, as it would silently trash data on updates. @@ -3716,44 +3714,57 @@ function PMA_getFunctionsForField($field, $insert_mode) $default_function = 'UNHEX'; } + return $default_function; +} + +/** + * Creates a dropdown box with MySQL functions for a particular column. + * + * @param array $field Data about the column for which + * to generate the dropdown + * @param bool $insert_mode Whether the operation is 'insert' + * + * @return string An HTML snippet of a dropdown list with function + * names appropriate for the requested column. + */ +function PMA_getFunctionsForField($field, $insert_mode) +{ + $default_function = PMA_getDefaultFunctionForField($field, $insert_mode); + $dropdown_built = array(); + // Create the output - $retval = ' ' . "\n"; + $retval = '' . "\n"; // loop on the dropdown array and print all available options for that // field. - foreach ($dropdown as $each_dropdown) { - $retval .= ' '; + $functions = $GLOBALS['PMA_Types']->getFunctions($field['True_Type']); + foreach ($functions as $function) { $retval .= '' . "\n"; - $dropdown_built[$each_dropdown] = 'true'; - $op_spacing_needed = true; + $retval .= '>' . $function . '' . "\n"; + $dropdown_built[$function] = true; } + + // Create separator before all functions list + if (count($functions) > 0) { + $retval .= '' . "\n"; + } + // For compatibility's sake, do not let out all other functions. Instead // print a separator (blank) and then show ALL functions which weren't // shown yet. $functions = $GLOBALS['PMA_Types']->getAllFunctions(); - $cnt_functions = count($functions); - for ($j = 0; $j < $cnt_functions; $j++) { - if (! isset($dropdown_built[$functions[$j]]) - || $dropdown_built[$functions[$j]] != 'true' - ) { - // Is current function defined as default? - $selected = ($field['first_timestamp'] && $functions[$j] == $cfg['DefaultFunctions']['first_timestamp']) - || (! $field['first_timestamp'] && $functions[$j] == $default_function) - ? ' selected="selected"' - : ''; - if ($op_spacing_needed == true) { - $retval .= ' '; - $retval .= '' . "\n"; - $op_spacing_needed = false; - } - - $retval .= ' '; - $retval .= '' . $functions[$j] - . '' . "\n"; + foreach ($functions as $function) { + // Skip already included functions + if (isset($dropdown_built[$function])) { + continue; } + $retval .= '' . "\n"; } // end for return $retval; diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index f6b324ed39..07e10e87f9 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -987,7 +987,6 @@ function PMA_RTN_getQueryFromRequest() global $_REQUEST, $errors, $param_sqldataaccess, $param_directions; $_REQUEST['item_type'] = isset($_REQUEST['item_type']) ? $_REQUEST['item_type'] : ''; - $column_types = $GLOBALS['PMA_Types']->getColumns(); $query = 'CREATE '; if (! empty($_REQUEST['item_definer'])) { @@ -1053,12 +1052,12 @@ function PMA_RTN_getQueryFromRequest() } } if (! empty($_REQUEST['item_param_opts_text'][$i])) { - if (in_array($_REQUEST['item_param_type'][$i], $column_types['STRING'])) { + if ($GLOBALS['PMA_Types']->getTypeClass($_REQUEST['item_param_type'][$i]) == 'CHAR') { $params .= ' CHARSET ' . strtolower($_REQUEST['item_param_opts_text'][$i]); } } if (! empty($_REQUEST['item_param_opts_num'][$i])) { - if (in_array($_REQUEST['item_param_type'][$i], $column_types['NUMERIC'])) { + if ($GLOBALS['PMA_Types']->getTypeClass($_REQUEST['item_param_type'][$i]) == 'NUMBER') { $params .= ' ' . strtoupper($_REQUEST['item_param_opts_num'][$i]); } } @@ -1093,12 +1092,12 @@ function PMA_RTN_getQueryFromRequest() } } if (! empty($_REQUEST['item_returnopts_text'])) { - if (in_array($_REQUEST['item_returntype'], $column_types['STRING'])) { + if ($GLOBALS['PMA_Types']->getTypeClass($_REQUEST['item_returntype']) == 'CHAR') { $query .= ' CHARSET ' . strtolower($_REQUEST['item_returnopts_text']); } } if (! empty($_REQUEST['item_returnopts_num'])) { - if (in_array($_REQUEST['item_returntype'], $column_types['NUMERIC'])) { + if ($GLOBALS['PMA_Types']->getTypeClass($_REQUEST['item_returntype']) == 'NUMBER') { $query .= ' ' . strtoupper($_REQUEST['item_returnopts_num']); } } diff --git a/po/cs.po b/po/cs.po index 2412585b4f..e3fdd129b5 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-05-09 13:14+0200\n" -"PO-Revision-Date: 2012-05-09 13:01+0200\n" +"PO-Revision-Date: 2012-05-09 13:27+0200\n" "Last-Translator: Michal Čihař \n" "Language-Team: czech \n" "Language: cs\n" @@ -2961,7 +2961,7 @@ msgstr "" #: libraries/Types.class.php:349 msgid "A single value chosen from a set of up to 64 members" -msgstr "" +msgstr "Jedna hodnota vybraná z množiny až 64 možností" #: libraries/Types.class.php:351 msgid "A type that can store a geometry of any type" @@ -2996,32 +2996,28 @@ msgid "A collection of geometry objects of any type" msgstr "" #: libraries/Types.class.php:619 libraries/Types.class.php:971 -#, fuzzy #| msgid "Numeric" msgctxt "numeric types" msgid "Numeric" msgstr "Čísla" #: libraries/Types.class.php:638 libraries/Types.class.php:974 -#, fuzzy #| msgid "Date and time" msgctxt "date and time types" msgid "Date and time" msgstr "Datum a čas" #: libraries/Types.class.php:647 libraries/Types.class.php:977 -#, fuzzy #| msgid "String" msgctxt "string types" msgid "String" msgstr "Řetězce" #: libraries/Types.class.php:668 -#, fuzzy #| msgid "Spatial" msgctxt "spatial types" msgid "Spatial" -msgstr "Prostorový" +msgstr "Prostorové" #: libraries/Types.class.php:703 msgid "A 4-byte integer, range is -2,147,483,648 to 2,147,483,647" @@ -3043,7 +3039,7 @@ msgstr "True nebo false" #: libraries/Types.class.php:713 msgid "An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE" -msgstr "" +msgstr "Zkratka pro BIGINT NOT NULL AUTO_INCREMENT UNIQUE" #: libraries/Types.class.php:715 msgid "Stores a Universally Unique Identifier (UUID)" diff --git a/po/tr.po b/po/tr.po index 02e6e9eb62..d8b5c6d538 100644 --- a/po/tr.po +++ b/po/tr.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: phpMyAdmin 4.0.0-dev\n" "Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\n" "POT-Creation-Date: 2012-05-09 13:14+0200\n" -"PO-Revision-Date: 2012-05-04 06:54+0200\n" +"PO-Revision-Date: 2012-05-09 14:48+0200\n" "Last-Translator: Burak Yavuz \n" "Language-Team: turkish \n" "Language: tr\n" @@ -3046,24 +3046,21 @@ msgstr "Herhangi bir türün geometri nesneleri topluluğu" #: libraries/Types.class.php:619 libraries/Types.class.php:971 msgctxt "numeric types" msgid "Numeric" -msgstr "" +msgstr "Sayısal" #: libraries/Types.class.php:638 libraries/Types.class.php:974 -#, fuzzy #| msgid "Both date and time." msgctxt "date and time types" msgid "Date and time" -msgstr "Her iki tarih ve saat de." +msgstr "Tarih ve saat" #: libraries/Types.class.php:647 libraries/Types.class.php:977 -#, fuzzy #| msgid "Linestring" msgctxt "string types" msgid "String" -msgstr "Satır dizgisi" +msgstr "Dizgi" #: libraries/Types.class.php:668 -#, fuzzy #| msgid "Spatial" msgctxt "spatial types" msgid "Spatial" @@ -7344,7 +7341,7 @@ msgstr "ESRI Şekil Dosyası" #: libraries/import/shp.php:199 #, php-format msgid "Geometry type '%s' is not supported by MySQL." -msgstr "" +msgstr "Geometri türü '%s' MySQL tarafından desteklenmiyor." #: libraries/import/shp.php:360 #, php-format