当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_Util::convertBitDefaultValue方法代码示例

本文整理汇总了PHP中PMA_Util::convertBitDefaultValue方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::convertBitDefaultValue方法的具体用法?PHP PMA_Util::convertBitDefaultValue怎么用?PHP PMA_Util::convertBitDefaultValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA_Util的用法示例。


在下文中一共展示了PMA_Util::convertBitDefaultValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testConvert_bit_default_value_test

    /**
     * @dataProvider dataProvider
     */
    function testConvert_bit_default_value_test($bit, $val)
    {
        $this->assertEquals(
            $val, PMA_Util::convertBitDefaultValue($bit)
        );

    }
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:10,代码来源:PMA_convert_bit_default_value_test.php

示例2: PMA_getForeigners

if (isset($_REQUEST['submit_num_fields'])) {
    //if adding new fields, set regenerate to keep the original values
    $regenerate = 1;
}
$foreigners = PMA_getForeigners($db, $table, '', 'foreign');
$child_references = PMA_getChildReferences($db, $table);
for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
    if (!empty($regenerate)) {
        list($columnMeta, $submit_length, $submit_attribute, $submit_default_current_timestamp, $comments_map, $mime_map) = PMA_handleRegeneration($columnNumber, isset($available_mime) ? $mime_map : null, $comments_map, $mime_map);
    } elseif (isset($fields_meta[$columnNumber])) {
        $columnMeta = PMA_getColumnMetaForDefault($fields_meta[$columnNumber], isset($analyzed_sql[0]['create_table_fields'][$fields_meta[$columnNumber]['Field']]['default_value']));
    }
    if (isset($columnMeta['Type'])) {
        $extracted_columnspec = PMA_Util::extractColumnSpec($columnMeta['Type']);
        if ($extracted_columnspec['type'] == 'bit') {
            $columnMeta['Default'] = PMA_Util::convertBitDefaultValue($columnMeta['Default']);
        }
        $type = $extracted_columnspec['type'];
        $length = $extracted_columnspec['spec_in_brackets'];
    } else {
        // creating a column
        $columnMeta['Type'] = '';
        $type = '';
        $length = '';
        $extracted_columnspec = array();
    }
    // some types, for example longtext, are reported as
    // "longtext character set latin7" when their charset and / or collation
    // differs from the ones of the corresponding database.
    $tmp = mb_strpos($type, 'character set');
    if ($tmp) {
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:31,代码来源:tbl_columns_definition_form.inc.php

示例3: PMA_getHtmlForField

/**
 * Function to get html for field
 *
 * @param int    $index index
 * @param array  $field field
 * @param string $style style
 *
 * @return string
 */
function PMA_getHtmlForField($index, $field, $style)
{
    $html = '<tr class="noclick ' . $style . '">';
    $html .= '<td>' . $index . '</td>';
    $html .= '<td><b>' . htmlspecialchars($field['Field']);
    if ($field['Key'] == 'PRI') {
        $html .= ' ' . PMA_Util::getImage('b_primary.png', __('Primary'));
    } elseif (!empty($field['Key'])) {
        $html .= ' ' . PMA_Util::getImage('bd_primary.png', __('Index'));
    }
    $html .= '</b></td>';
    $html .= "\n";
    $html .= '<td>' . htmlspecialchars($field['Type']) . '</td>';
    $html .= '<td>' . htmlspecialchars($field['Collation']) . '</td>';
    $html .= '<td>' . ($field['Null'] == 'YES' ? __('Yes') : __('No')) . '</td>';
    $html .= '<td>';
    if (isset($field['Default'])) {
        $extracted_columnspec = PMA_Util::extractColumnSpec($field['Type']);
        if ($extracted_columnspec['type'] == 'bit') {
            // here, $field['Default'] contains something like b'010'
            $html .= PMA_Util::convertBitDefaultValue($field['Default']);
        } else {
            $html .= htmlspecialchars($field['Default']);
        }
    } else {
        if ($field['Null'] == 'YES') {
            $html .= '<i>NULL</i>';
        } else {
            $html .= '<i>' . _pgettext('None for default', 'None') . '</i>';
        }
    }
    $html .= '</td>';
    $html .= '<td>' . htmlspecialchars($field['Extra']) . '</td>';
    $html .= '<td>' . htmlspecialchars($field['Comment']) . '</td>';
    $html .= '</tr>';
    return $html;
}
开发者ID:saisai,项目名称:phpmyadmin,代码行数:46,代码来源:tracking.lib.php

示例4: PMA_getSpecialCharsAndBackupFieldForInsertingMode

/**
 * display default values
 *
 * @param array   $column          description of column in given table
 * @param boolean $real_null_value whether column value null or not null
 *
 * @return array $real_null_value, $data, $special_chars,
 *               $backup_field, $special_chars_encoded
 */
function PMA_getSpecialCharsAndBackupFieldForInsertingMode($column, $real_null_value)
{
    if (!isset($column['Default'])) {
        $column['Default'] = '';
        $real_null_value = true;
        $data = '';
    } else {
        $data = $column['Default'];
    }
    $trueType = $column['True_Type'];
    if ($trueType == 'bit') {
        $special_chars = PMA_Util::convertBitDefaultValue($column['Default']);
    } elseif (substr($trueType, 0, 9) == 'timestamp' || $trueType == 'datetime' || $trueType == 'time') {
        $special_chars = PMA_Util::addMicroseconds($column['Default']);
    } elseif ($trueType == 'binary' || $trueType == 'varbinary') {
        $special_chars = bin2hex($column['Default']);
    } else {
        $special_chars = htmlspecialchars($column['Default']);
    }
    $backup_field = '';
    $special_chars_encoded = PMA_Util::duplicateFirstNewline($special_chars);
    return array($real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded);
}
开发者ID:hewenhao2008,项目名称:phpmyadmin,代码行数:32,代码来源:insert_edit.lib.php

示例5: PMA_getHtmlTableStructureRow

/**
 * Get HTML for structure table's rows and return $odd_row parameter also
 * For "Action" Column, this function contains only HTML code for "Change"
 * and "Drop"
 *
 * @param array   $row                  current row
 * @param string  $rownum               row number
 * @param string  $displayed_field_name displayed field name
 * @param string  $type_nowrap          type nowrap
 * @param array   $extracted_columnspec associative array containing type,
 *                                      spec_in_brackets and possibly
 *                                      enum_set_values (another array)
 * @param string  $type_mime            mime type
 * @param string  $field_charset        field charset
 * @param string  $attribute            attribute (BINARY, UNSIGNED,
 *                                      UNSIGNED ZEROFILL,
 *                                      on update CURRENT_TIMESTAMP)
 * @param boolean $tbl_is_view          whether tables is view or not
 * @param boolean $db_is_system_schema  whether db is information schema or not
 * @param string  $url_query            url query
 * @param string  $field_encoded        field encoded
 * @param array   $titles               titles array
 * @param string  $table                table
 *
 * @return array ($html_output, $odd_row)
 */
function PMA_getHtmlTableStructureRow($row, $rownum, $displayed_field_name, $type_nowrap, $extracted_columnspec, $type_mime, $field_charset, $attribute, $tbl_is_view, $db_is_system_schema, $url_query, $field_encoded, $titles, $table)
{
    $html_output = '<td class="center">' . '<input type="checkbox" class="checkall" name="selected_fld[]" ' . 'value="' . htmlspecialchars($row['Field']) . '" ' . 'id="checkbox_row_' . $rownum . '"/>' . '</td>';
    $html_output .= '<td class="right">' . $rownum . '</td>';
    $html_output .= '<th class="nowrap">' . '<label for="checkbox_row_' . $rownum . '">' . $displayed_field_name . '</label>' . '</th>';
    $html_output .= '<td' . $type_nowrap . '>' . '<bdo dir="ltr" lang="en">' . $extracted_columnspec['displayed_type'] . $type_mime . '</bdo></td>';
    $html_output .= '<td>' . (empty($field_charset) ? '' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>';
    $html_output .= '<td class="column_attribute nowrap">' . $attribute . '</td>';
    $html_output .= '<td>' . ($row['Null'] == 'YES' ? __('Yes') : __('No')) . '  </td>';
    $html_output .= '<td class="nowrap">';
    if (isset($row['Default'])) {
        if ($extracted_columnspec['type'] == 'bit') {
            // here, $row['Default'] contains something like b'010'
            $html_output .= PMA_Util::convertBitDefaultValue($row['Default']);
        } else {
            $html_output .= $row['Default'];
        }
    } else {
        $html_output .= '<i>' . _pgettext('None for default', 'None') . '</i>';
    }
    $html_output .= '</td>';
    $html_output .= '<td class="nowrap">' . strtoupper($row['Extra']) . '</td>';
    $html_output .= PMA_getHtmlForDropColumn($tbl_is_view, $db_is_system_schema, $url_query, $field_encoded, $titles, $table, $row);
    return $html_output;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:51,代码来源:structure.lib.php

示例6: PMA_getHtmlForColumnDefault

/**
 * Function to get html for the default column
 *
 * @param int    $columnNumber              column number
 * @param int    $ci                        cell index
 * @param int    $ci_offset                 cell index offset
 * @param string $type_upper                type upper
 * @param string $default_current_timestamp default current timestamp
 * @param array  $columnMeta                column meta
 *
 * @return string
 */
function PMA_getHtmlForColumnDefault($columnNumber, $ci, $ci_offset, $type_upper, $default_current_timestamp, $columnMeta)
{
    // here we put 'NONE' as the default value of drop-down; otherwise
    // users would have problems if they forget to enter the default
    // value (example, for an INT)
    $default_options = array('NONE' => _pgettext('for default', 'None'), 'USER_DEFINED' => __('As defined:'), 'NULL' => 'NULL', 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP');
    // for a TIMESTAMP, do not show the string "CURRENT_TIMESTAMP" as a default
    // value
    if ($type_upper == 'TIMESTAMP' && !empty($default_current_timestamp) && isset($columnMeta['Default'])) {
        $columnMeta['Default'] = '';
    }
    if ($type_upper == 'BIT') {
        $columnMeta['DefaultValue'] = PMA_Util::convertBitDefaultValue($columnMeta['DefaultValue']);
    }
    $html = '<select name="field_default_type[' . $columnNumber . ']" id="field_' . $columnNumber . '_' . ($ci - $ci_offset) . '" class="default_type">';
    foreach ($default_options as $key => $value) {
        $html .= '<option value="' . $key . '"';
        // is only set when we go back to edit a field's structure
        if (isset($columnMeta['DefaultType']) && $columnMeta['DefaultType'] == $key) {
            $html .= ' selected="selected"';
        }
        $html .= ' >' . $value . '</option>';
    }
    $html .= '</select>';
    $html .= '<br />';
    $value = isset($columnMeta['DefaultValue']) ? htmlspecialchars($columnMeta['DefaultValue']) : '';
    if ($GLOBALS['cfg']['CharEditing'] == 'textarea') {
        $html .= '<textarea' . ' name="field_default_value[' . $columnNumber . ']" cols="15"' . ' class="textfield default_value">' . $value . '</textarea>';
    } else {
        $html .= '<input type="text"' . ' name="field_default_value[' . $columnNumber . ']" size="12"' . ' value="' . $value . '"' . ' class="textfield default_value" />';
    }
    return $html;
}
开发者ID:FilipeRamosFernandes,项目名称:phpmyadmin,代码行数:45,代码来源:tbl_columns_definition_form.lib.php

示例7: PMA_getSpecialCharsAndBackupFieldForInsertingMode

/**
 * display default values
 *
 * @param type    $column          description of column in given table
 * @param boolean $real_null_value whether column value null or not null
 *
 * @return array $real_null_value, $data, $special_chars,
 *               $backup_field, $special_chars_encoded
 */
function PMA_getSpecialCharsAndBackupFieldForInsertingMode($column, $real_null_value)
{
    if (!isset($column['Default'])) {
        $column['Default'] = '';
        $real_null_value = true;
        $data = '';
    } else {
        $data = $column['Default'];
    }
    if ($column['True_Type'] == 'bit') {
        $special_chars = PMA_Util::convertBitDefaultValue($column['Default']);
    } elseif (substr($column['True_Type'], 0, 9) == 'timestamp' || $column['True_Type'] == 'datetime' || $column['True_Type'] == 'time') {
        $special_chars = PMA_Util::addMicroseconds($column['Default']);
    } else {
        $special_chars = htmlspecialchars($column['Default']);
    }
    $backup_field = '';
    $special_chars_encoded = PMA_Util::duplicateFirstNewline($special_chars);
    // this will select the UNHEX function while inserting
    if (($column['is_binary'] || $column['is_blob'] && !$GLOBALS['cfg']['ProtectBinary']) && (isset($_SESSION['tmpval']['display_binary_as_hex']) && $_SESSION['tmpval']['display_binary_as_hex']) && $GLOBALS['cfg']['ShowFunctionFields']) {
        $column['display_binary_as_hex'] = true;
    }
    return array($real_null_value, $data, $special_chars, $backup_field, $special_chars_encoded);
}
开发者ID:roccivic,项目名称:phpmyadmin,代码行数:33,代码来源:insert_edit.lib.php

示例8: htmlspecialchars

        echo '<tr class="noclick ' . $style . '">';
        if ($field['Key'] == 'PRI') {
            echo '<td><b><u>' . htmlspecialchars($field['Field']) . '</u></b></td>';
        } else {
            echo '<td><b>' . htmlspecialchars($field['Field']) . '</b></td>';
        }
        echo "\n";
        echo '<td>' . htmlspecialchars($field['Type']) . '</td>';
        echo '<td>' . htmlspecialchars($field['Collation']) . '</td>';
        echo '<td>' . (($field['Null'] == 'YES') ? __('Yes') : __('No')) . '</td>';
        echo '<td>';
        if (isset($field['Default'])) {
            $extracted_columnspec = PMA_Util::extractColumnSpec($field['Type']);
            if ($extracted_columnspec['type'] == 'bit') {
                // here, $field['Default'] contains something like b'010'
                echo PMA_Util::convertBitDefaultValue($field['Default']);
            } else {
                echo htmlspecialchars($field['Default']);
            }
        } else {
            if ($field['Null'] == 'YES') {
                echo '<i>NULL</i>';
            } else {
                echo '<i>' . _pgettext('None for default', 'None') . '</i>';
            }
        }
        echo '</td>';
        echo '<td>' . htmlspecialchars($field['Extra']) . '</td>';
        echo '<td>' . htmlspecialchars($field['Comment']) . '</td>';
        echo '</tr>';
开发者ID:nhodges,项目名称:phpmyadmin,代码行数:30,代码来源:tbl_tracking.php

示例9: isset

 $ci++;
 // column default
 // old column default
 if ($is_backup) {
     $_form_params['field_default_orig[' . $i . ']'] = isset($row['Default']) ? $row['Default'] : '';
 }
 // here we put 'NONE' as the default value of drop-down; otherwise
 // users would have problems if they forget to enter the default
 // value (example, for an INT)
 $default_options = array('NONE' => _pgettext('for default', 'None'), 'USER_DEFINED' => __('As defined:'), 'NULL' => 'NULL', 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP');
 // for a TIMESTAMP, do not show the string "CURRENT_TIMESTAMP" as a default value
 if ($type_upper == 'TIMESTAMP' && !empty($default_current_timestamp) && isset($row['Default'])) {
     $row['Default'] = '';
 }
 if ($type_upper == 'BIT') {
     $row['DefaultValue'] = PMA_Util::convertBitDefaultValue($row['DefaultValue']);
 }
 $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']" id="field_' . $i . '_' . ($ci - $ci_offset) . '" class="default_type">';
 foreach ($default_options as $key => $value) {
     $content_cells[$i][$ci] .= '<option value="' . $key . '"';
     // is only set when we go back to edit a field's structure
     if (isset($row['DefaultType']) && $row['DefaultType'] == $key) {
         $content_cells[$i][$ci] .= ' selected="selected"';
     }
     $content_cells[$i][$ci] .= ' >' . $value . '</option>';
 }
 $content_cells[$i][$ci] .= '</select>';
 $content_cells[$i][$ci] .= '<br />';
 $content_cells[$i][$ci] .= '<input type="text"' . ' name="field_default_value[' . $i . ']" size="12"' . ' value="' . (isset($row['DefaultValue']) ? htmlspecialchars($row['DefaultValue']) : '') . '"' . ' class="textfield default_value" />';
 $ci++;
 // column collation
开发者ID:mindfeederllc,项目名称:openemr,代码行数:31,代码来源:tbl_columns_definition_form.inc.php

示例10: testConvertBitDefaultValueTest

 /**
  * Test for convertBitDefaultValue
  *
  * @param string $bit Value
  * @param string $val Expected value
  *
  * @return void
  *
  * @dataProvider dataProvider
  */
 public function testConvertBitDefaultValueTest($bit, $val)
 {
     $this->assertEquals($val, PMA_Util::convertBitDefaultValue($bit));
 }
开发者ID:yonh,项目名称:php-mvc,代码行数:14,代码来源:PMA_convert_bit_default_value_test.php


注:本文中的PMA_Util::convertBitDefaultValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。