if ($field['True_Type'] == 'bit') { $special_chars = PMA_convertBitDefaultValue($field['Default']); } else { $special_chars = htmlspecialchars($field['Default']); } $backup_field = ''; $special_chars_encoded = PMA_duplicateFirstNewline($special_chars); // this will select the UNHEX function while inserting if (($field['is_binary'] || $field['is_blob'] && !$cfg['ProtectBinary']) && (isset($_SESSION['tmp_user_values']['display_binary_as_hex']) && $_SESSION['tmp_user_values']['display_binary_as_hex']) && $cfg['ShowFunctionFields']) { $field['display_binary_as_hex'] = true; } } $idindex = $o_rows * $fields_cnt + $i + 1; $tabindex = $idindex; // Get a list of data types that are not yet supported. $no_support_types = PMA_unsupportedDatatypes(); // The function column // ------------------- // We don't want binary data to be destroyed // Note: from the MySQL manual: "BINARY doesn't affect how the column is // stored or retrieved" so it does not mean that the contents is // binary if ($cfg['ShowFunctionFields']) { if ($cfg['ProtectBinary'] && $field['is_blob'] && !$is_upload || $cfg['ProtectBinary'] == 'all' && $field['is_binary'] || $cfg['ProtectBinary'] == 'noblob' && !$field['is_blob']) { echo ' <td class="center">' . __('Binary') . '</td>' . "\n"; } elseif (strstr($field['True_Type'], 'enum') || strstr($field['True_Type'], 'set') || in_array($field['pma_type'], $no_support_types)) { echo ' <td class="center">--</td>' . "\n"; } else { ?> <td> <select name="funcs<?php
/** * Creates the HTML code that shows the routine execution dialog. * * @param array $routine Data for the routine returned by * PMA_RTN_getDataFromName() * * @return string HTML code for the routine execution dialog. */ function PMA_RTN_getExecuteForm($routine) { global $db, $cfg; // Escape special characters $routine['item_name'] = htmlentities($routine['item_name'], ENT_QUOTES); for ($i = 0; $i < $routine['item_num_params']; $i++) { $routine['item_param_name'][$i] = htmlentities($routine['item_param_name'][$i], ENT_QUOTES); } // Create the output $retval = ""; $retval .= "<!-- START ROUTINE EXECUTE FORM -->\n\n"; $retval .= "<form action='db_routines.php' method='post' class='rte_form'>\n"; $retval .= "<input type='hidden' name='item_name'\n"; $retval .= " value='{$routine['item_name']}' />\n"; $retval .= "<input type='hidden' name='item_type'\n"; $retval .= " value='{$routine['item_type']}' />\n"; $retval .= PMA_generate_common_hidden_inputs($db) . "\n"; $retval .= "<fieldset>\n"; if ($GLOBALS['is_ajax_request'] != true) { $retval .= "<legend>{$routine['item_name']}</legend>\n"; $retval .= "<table class='rte_table'>\n"; $retval .= "<caption class='tblHeaders'>\n"; $retval .= __('Routine parameters'); $retval .= "</caption>\n"; } else { $retval .= "<legend>" . __('Routine parameters') . "</legend>\n"; $retval .= "<table class='rte_table' style='width: 100%;'>\n"; } $retval .= "<tr>\n"; $retval .= "<th>" . __('Name') . "</th>\n"; $retval .= "<th>" . __('Type') . "</th>\n"; if ($cfg['ShowFunctionFields']) { $retval .= "<th>" . __('Function') . "</th>\n"; } $retval .= "<th>" . __('Value') . "</th>\n"; $retval .= "</tr>\n"; // Get a list of data types that are not yet supported. $no_support_types = PMA_unsupportedDatatypes(); for ($i = 0; $i < $routine['item_num_params']; $i++) { // Each parameter if ($routine['item_type'] == 'PROCEDURE' && $routine['item_param_dir'][$i] == 'OUT') { continue; } $rowclass = $i % 2 == 0 ? 'even' : 'odd'; $retval .= "\n<tr class='{$rowclass}'>\n"; $retval .= "<td>{$routine['item_param_name'][$i]}</td>\n"; $retval .= "<td>{$routine['item_param_type'][$i]}</td>\n"; if ($cfg['ShowFunctionFields']) { $retval .= "<td>\n"; if (stristr($routine['item_param_type'][$i], 'enum') || stristr($routine['item_param_type'][$i], 'set') || in_array(strtolower($routine['item_param_type'][$i]), $no_support_types)) { $retval .= "--\n"; } else { $field = array('True_Type' => strtolower($routine['item_param_type'][$i]), 'Type' => '', 'Key' => '', 'Field' => '', 'Default' => '', 'first_timestamp' => false); $retval .= "<select name='funcs[{$routine['item_param_name'][$i]}]'>"; $retval .= PMA_getFunctionsForField($field, false); $retval .= "</select>"; } $retval .= "</td>\n"; } // Append a class to date/time fields so that // jQuery can attach a datepicker to them $class = ''; if ($routine['item_param_type'][$i] == 'DATETIME' || $routine['item_param_type'][$i] == 'TIMESTAMP') { $class = 'datetimefield'; } else { if ($routine['item_param_type'][$i] == 'DATE') { $class = 'datefield'; } } $retval .= "<td class='nowrap'>\n"; if (in_array($routine['item_param_type'][$i], array('ENUM', 'SET'))) { $tokens = PMA_SQP_parse($routine['item_param_length'][$i]); if ($routine['item_param_type'][$i] == 'ENUM') { $input_type = 'radio'; } else { $input_type = 'checkbox'; } for ($j = 0; $j < $tokens['len']; $j++) { if ($tokens[$j]['type'] != 'punct_listsep') { $tokens[$j]['data'] = htmlentities(PMA_unquote($tokens[$j]['data']), ENT_QUOTES); $retval .= "<input name='params[{$routine['item_param_name'][$i]}][]' " . "value='{$tokens[$j]['data']}' type='{$input_type}' />" . "{$tokens[$j]['data']}<br />\n"; } } } else { if (in_array(strtolower($routine['item_param_type'][$i]), $no_support_types)) { $retval .= "\n"; } else { $retval .= "<input class='{$class}' type='text' name='params[{$routine['item_param_name'][$i]}]' />\n"; } } $retval .= "</td>\n"; $retval .= "</tr>\n"; } $retval .= "\n</table>\n"; if ($GLOBALS['is_ajax_request'] != true) { $retval .= "</fieldset>\n\n"; $retval .= "<fieldset class='tblFooters'>\n"; $retval .= " <input type='submit' name='execute_routine'\n"; $retval .= " value='" . __('Go') . "' />\n"; $retval .= "</fieldset>\n"; } else { $retval .= "<input type='hidden' name='execute_routine' value='true' />"; $retval .= "<input type='hidden' name='ajax_request' value='true' />"; } $retval .= "</form>\n\n"; $retval .= "<!-- END ROUTINE EXECUTE FORM -->\n\n"; return $retval; }
function testNotSupportedDataTypes() { $no_support_types = array(); $this->assertEquals($no_support_types, PMA_unsupportedDatatypes()); }