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


Java Type.displaySize方法代码示例

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


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

示例1: getPrecision

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * Retrieves the designated parameter's specified column size.
 *
 * <P>The returned value represents the maximum column size for the given parameter.
 * For numeric data, this is the maximum precision.  For character data, this is the length in characters.
 * For datetime datatypes, this is the length in characters of the String representation (assuming the
 * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes.  For the ROWID datatype,
 * this is the length in bytes. 0 is returned for data types where the
 * column size is not applicable.
 *
 * @param param the first parameter is 1, the second is 2, ...
 * @return precision
 * @exception SQLException if a database access error occurs
 * @since JDK 1.4, HSQLDB 1.7.2
 */
public int getPrecision(int param) throws SQLException {

    checkRange(param);

    Type type = translateType(rmd.columnTypes[--param]);

    if (type.isDateTimeType()) {
        return type.displaySize();
    } else {
        long size = type.precision;

        if (size > Integer.MAX_VALUE) {
            size = 0;
        }

        return (int) size;
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:34,代码来源:JDBCParameterMetaData.java

示例2: getPrecision

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * Retrieves the designated parameter's specified column size.
 *
 * <P>The returned value represents the maximum column size for the given parameter.
 * For numeric data, this is the maximum precision.  For character data, this is the length in characters.
 * For datetime datatypes, this is the length in characters of the String representation (assuming the
 * maximum allowed precision of the fractional seconds component). For binary data, this is the length in bytes.  For the ROWID datatype,
 * this is the length in bytes. 0 is returned for data types where the
 * column size is not applicable.
 *
 * @param param the first parameter is 1, the second is 2, ...
 * @return precision
 * @exception SQLException if a database access error occurs
 * @since JDK 1.4, HSQLDB 1.7.2
 */
public int getPrecision(int param) throws SQLException {

    checkRange(param);

    Type type = rmd.columnTypes[--param];

    if (type.isDateTimeType()) {
        return type.displaySize();
    } else {
        long size = type.precision;

        if (size > Integer.MAX_VALUE) {
            size = 0;
        }

        return (int) size;
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:34,代码来源:JDBCParameterMetaData.java

示例3: getPrecision

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * (JDBC4 clarification:)
 * Get the designated column's specified column size.
 * For numeric data, this is the maximum precision.  For character data, this is the [maximum] length in characters.
 * For datetime datatypes, this is the [maximim] length in characters of the String representation (assuming the
 * maximum allowed precision of the fractional seconds component). For binary data, this is the [maximum] length in bytes.  For the ROWID datatype,
 * this is the length in bytes[, as returned by the implementation-specific java.sql.RowId.getBytes() method]. 0 is returned for data types where the
 * column size is not applicable.
 * <!-- end generic documentation -->
 *
 * <!-- start Release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * Starting with 1.8.0, HSQLDB reports the declared length or precision
 * specifiers for table columns, if they are defined.<p>
 *
 * From 1.9.0, HSQLDB, reports the correct length or precision for
 * computed columns according to the SQL Standard.<p>
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param column the first column is 1, the second is 2, ...
 * @return precision
 * @exception SQLException if a database access error occurs
 */
public int getPrecision(int column) throws SQLException {

    checkColumn(column);

    // type in columnTypes overrides column type
    Type type      = resultMetaData.columnTypes[--column];
    long precision = type.precision;

    if (type.isDateTimeType() || type.isIntervalType()) {
        precision = type.displaySize();
    }

    if (precision > Integer.MAX_VALUE) {
        precision = Integer.MAX_VALUE;
    }

    return (int) precision;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:46,代码来源:JDBCResultSetMetaData.java

示例4: getColumnDisplaySize

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Indicates the designated column's normal maximum width in characters.
 * <!-- end generic documentation -->
 *
 * <!-- start Release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * HSQLDB 2.0 fully supports this feature.  <p>
 *
 * The current calculation follows these rules: <p>
 *
 * <ol>
 * <li>Long character types and datetime types:<p>
 *
 *     The maximum length/precision, repectively.<p>
 *
 * <li>CHAR and VARCHAR types: <p>
 *
 *      <ul>
 *      <li> If the result set column is a direct pass through of a table
 *           column value and column size was declared, then the declared
 *           value is returned. <p>
 *
 *      <li> Otherwise, the computed length according to SQL Standard is
 *           returned. For very large values, the value of the system property
 *           hsqldb.max_xxxchar_display_size or the magic value
 *           32766 (0x7FFE) (tested usable/accepted by most tools and
 *           compatible with assumptions made by java.io read/write
 *           UTF) when the system property is not defined or is not
 *           accessible, due to security constraints. <p>
 *
 *      </ul>
 *
 *      It must be noted that the latter value in no way affects the
 *      ability of the HSQLDB JDBC driver to retrieve longer values
 *      and serves only as the current best effort at providing a
 *      value that maximizes usability across a wide range of tools,
 *      given that the HSQLDB database engine allows very large
 *      lengths to be declared. <p>
 *
 * <li>Number types: <p>
 *
 *     The max precision, plus the length of the negation character (1),
 *     plus (if applicable) the maximum number of characters that may
 *     occupy the exponent character sequence.  Note that some legacy tools
 *     do not correctly handle BIGINT values of greater than 18 digits. <p>
 *
 * <li>BOOLEAN type: <p>
 *
 *     The length of the character sequence "false" (5), the longer of the
 *     two boolean value String representations. <p>
 *
 * <li>Remaining types: <p>
 *
 *     The maximum length/precision, respectively, as reported by
 *     DatabaseMetaData.getTypeInfo(), when applicable.  If the maximum
 *     display size is unknown, unknowable or inapplicable, then zero is
 *     returned. <p>
 *
 * </ol>
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param column the first column is 1, the second is 2, ...
 * @return the normal maximum number of characters allowed as the width
 *          of the designated column
 * @exception SQLException if a database access error occurs
 */
public int getColumnDisplaySize(int column) throws SQLException {

    checkColumn(column);

    Type type = translateType(resultMetaData.columnTypes[--column]);

    return type.displaySize();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:80,代码来源:JDBCResultSetMetaData.java

示例5: getColumnDisplaySize

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Indicates the designated column's normal maximum width in characters.
 * <!-- end generic documentation -->
 *
 * <!-- start Release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * HSQLDB 1.9.0 fully supports this feature.  <p>
 *
 * The current calculation follows these rules: <p>
 *
 * <ol>
 * <li>Long character types and datetime types:<p>
 *
 *     The maximum length/precision, repectively.<p>
 *
 * <li>CHAR and VARCHAR types: <p>
 *
 *      <ul>
 *      <li> If the result set column is a direct pass through of a table
 *           column value and column size was declared, then the declared
 *           value is returned. <p>
 *
 *      <li> Otherwise, the computed length according to SQL Standard is
 *           returned. For very large values, the value of the system property
 *           hsqldb.max_xxxchar_display_size or the magic value
 *           32766 (0x7FFE) (tested usable/accepted by most tools and
 *           compatible with assumptions made by java.io read/write
 *           UTF) when the system property is not defined or is not
 *           accessible, due to security constraints. <p>
 *
 *      </ul>
 *
 *      It must be noted that the latter value in no way affects the
 *      ability of the HSQLDB JDBC driver to retrieve longer values
 *      and serves only as the current best effort at providing a
 *      value that maximizes usability across a wide range of tools,
 *      given that the HSQLDB database engine allows very large
 *      lengths to be declared. <p>
 *
 * <li>Number types: <p>
 *
 *     The max precision, plus the length of the negation character (1),
 *     plus (if applicable) the maximum number of characters that may
 *     occupy the exponent character sequence.  Note that some legacy tools
 *     do not correctly handle BIGINT values of greater than 18 digits. <p>
 *
 * <li>BOOLEAN type: <p>
 *
 *     The length of the character sequence "false" (5), the longer of the
 *     two boolean value String representations. <p>
 *
 * <li>Remaining types: <p>
 *
 *     The maximum length/precision, respectively, as reported by
 *     DatabaseMetaData.getTypeInfo(), when applicable.  If the maximum
 *     display size is unknown, unknowable or inapplicable, then zero is
 *     returned. <p>
 *
 * </ol>
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param column the first column is 1, the second is 2, ...
 * @return the normal maximum number of characters allowed as the width
 *          of the designated column
 * @exception SQLException if a database access error occurs
 */
public int getColumnDisplaySize(int column) throws SQLException {

    checkColumn(column);

    Type type = resultMetaData.columnTypes[--column];

    return type.displaySize();
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:80,代码来源:JDBCResultSetMetaData.java


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