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


Java Type.isIntervalType方法代码示例

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


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

示例1: SetFunction

import org.hsqldb.types.Type; //导入方法依赖的package包/类
SetFunction(int setType, Type type, boolean isDistinct) {

        this.setType = setType;
        this.type    = type;

        if (isDistinct) {
            this.isDistinct = true;
            distinctValues  = new HashSet();
        }

        if (setType == OpTypes.VAR_SAMP || setType == OpTypes.STDDEV_SAMP) {
            this.sample = true;
        }

        if (type != null) {
            dataType = type.typeCode;

            if (type.isIntervalType()) {
                dataType = Types.SQL_INTERVAL;
            }
        }
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:23,代码来源:SetFunction.java

示例2: translateType

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * Translates an INTERVAL type to VARCHAR.
 * Removes time zone from datetime types.
 *
 */
private Type translateType(Type type) {

    if (this.translateTTIType) {
        if (type.isIntervalType()) {
            type = ((IntervalType) type).getCharacterType();
        } else if (type.isDateTimeTypeWithZone()) {
            type = ((DateTimeType) type).getDateTimeTypeWithoutZone();
        }
    }

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

示例3: SetFunction

import org.hsqldb.types.Type; //导入方法依赖的package包/类
SetFunction(Session session, int setType, Type type, Type returnType,
            boolean isDistinct, ArrayType arrayType) {

    this.setType    = setType;
    this.type       = type;
    this.returnType = returnType;

    if (isDistinct) {
        this.isDistinct = true;
        this.arrayType  = arrayType;
        distinctValues  = new HashSet();

        if (type.isRowType() || type.isArrayType()) {
            TypedComparator comparator = Type.newComparator(session);
            SortAndSlice    sort       = new SortAndSlice();
            int length = type.isRowType()
                         ? ((RowType) type).getTypesArray().length
                         : 1;

            sort.prepareMultiColumn(length);
            comparator.setType(type, sort);
            distinctValues.setComparator(comparator);
        }
    }

    if (setType == OpTypes.VAR_SAMP || setType == OpTypes.STDDEV_SAMP) {
        this.sample = true;
    }

    if (type != null) {
        typeCode = type.typeCode;

        if (type.isIntervalType()) {
            typeCode = Types.SQL_INTERVAL;
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:38,代码来源:SetFunction.java

示例4: addTypeInfo

import org.hsqldb.types.Type; //导入方法依赖的package包/类
void addTypeInfo(Object[] row, Type type) {

        final int data_type                = 5;
        final int character_maximum_length = 6;
        final int character_octet_length   = 7;
        final int character_set_catalog    = 8;
        final int character_set_schema     = 9;
        final int character_set_name       = 10;
        final int collation_catalog        = 11;
        final int collation_schema         = 12;
        final int collation_name           = 13;
        final int numeric_precision        = 14;
        final int numeric_precision_radix  = 15;
        final int numeric_scale            = 16;
        final int datetime_precision       = 17;
        final int interval_type            = 18;
        final int interval_precision       = 19;

        //
        final int maximum_cardinality        = 26;
        final int dtd_identifier             = 27;
        final int declared_data_type         = 28;
        final int declared_numeric_precision = 29;
        final int declared_numeric_scale     = 30;

        row[data_type] = type.getFullNameString();

        if (type.isCharacterType()) {
            row[character_maximum_length] = ValuePool.getLong(type.precision);
            row[character_octet_length] = ValuePool.getLong(type.precision
                    * 2);
            row[character_set_catalog] = database.getCatalogName().name;
            row[character_set_schema] =
                type.getCharacterSet().getSchemaName().name;
            row[character_set_name] = type.getCharacterSet().getName().name;
            row[collation_catalog]  = database.getCatalogName().name;
            row[collation_schema]   = type.getCollation().getSchemaName().name;
            row[collation_name]     = type.getCollation().getName().name;
        } else if (type.isNumberType()) {
            row[numeric_precision] = ValuePool.getLong(
                ((NumberType) type).getNumericPrecisionInRadix());
            row[declared_numeric_precision] = ValuePool.getLong(
                ((NumberType) type).getNumericPrecisionInRadix());

            if (type.isExactNumberType()) {
                row[numeric_scale] = row[declared_numeric_scale] =
                    ValuePool.getLong(type.scale);
            }

            row[numeric_precision_radix] =
                ValuePool.getLong(type.getPrecisionRadix());
        } else if (type.isBooleanType()) {

            //
        } else if (type.isDateTimeType()) {
            row[datetime_precision] = ValuePool.getLong(type.scale);
        } else if (type.isIntervalType()) {
            row[data_type]          = "INTERVAL";
            row[interval_type]      = IntervalType.getQualifier(type.typeCode);
            row[interval_precision] = ValuePool.getLong(type.precision);
            row[datetime_precision] = ValuePool.getLong(type.scale);
        } else if (type.isBinaryType()) {
            row[character_maximum_length] = ValuePool.getLong(type.precision);
            row[character_octet_length]   = ValuePool.getLong(type.precision);
        } else if (type.isBitType()) {
            row[character_maximum_length] = ValuePool.getLong(type.precision);
            row[character_octet_length]   = ValuePool.getLong(type.precision);
        } else if (type.isArrayType()) {
            row[maximum_cardinality] =
                ValuePool.getLong(type.arrayLimitCardinality());
        }

        row[dtd_identifier]     = type.getDefinition();
        row[declared_data_type] = row[data_type];
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:76,代码来源:DatabaseInformationFull.java

示例5: getColumnInType

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * Internal value converter. <p>
 *
 * All trivially successful getXXX methods eventually go through this
 * method, converting if neccessary from the source type to the
 * requested type.  <p>
 *
 * Conversion to the JDBC representation, if different, is handled by the
 * calling methods.
 *
 * @param columnIndex of the column value for which to perform the
 *                 conversion
 * @param targetType the org.hsqldb.types.Type object for targetType
 * @return an Object of the requested targetType, representing the value of the
 *       specified column
 * @throws SQLException when there is no rowData, the column index is
 *    invalid, or the conversion cannot be performed
 */
protected Object getColumnInType(int columnIndex,
                                 Type targetType) throws SQLException {

    Object[] rowData = getCurrent();
    Type     sourceType;
    Object   value;

    checkColumn(columnIndex);

    sourceType = resultMetaData.columnTypes[--columnIndex];
    value      = rowData[columnIndex];

    if (trackNull(value)) {
        return null;
    }

    if (translateTTIType && targetType.isIntervalType()) {
        targetType = ((IntervalType) targetType).getCharacterType();
    }


    if (sourceType.typeCode != targetType.typeCode) {
        try {
            value = targetType.convertToTypeJDBC(session, value,
                    sourceType);
        } catch (Exception e) {
            String stringValue = (value instanceof Number
                                  || value
                                     instanceof String) ? value.toString()
                    : "instance of " + value.getClass().getName();
            String msg = "from SQL type " + sourceType.getNameString()
                         + " to " + targetType.getJDBCClassName()
                         + ", value: " + stringValue;

            JDBCUtil.throwError(Error.error(ErrorCode.X_42561, msg));
        }
    }

    return value;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:59,代码来源:JDBCResultSet.java

示例6: 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

示例7: addTypeInfo

import org.hsqldb.types.Type; //导入方法依赖的package包/类
void addTypeInfo(Object[] row, Type type) {

        final int data_type                = 5;
        final int character_maximum_length = 6;
        final int character_octet_length   = 7;
        final int character_set_catalog    = 8;
        final int character_set_schema     = 9;
        final int character_set_name       = 10;
        final int collation_catalog        = 11;
        final int collation_schema         = 12;
        final int collation_name           = 13;
        final int numeric_precision        = 14;
        final int numeric_precision_radix  = 15;
        final int numeric_scale            = 16;
        final int datetime_precision       = 17;
        final int interval_type            = 18;
        final int interval_precision       = 19;

        //
        final int maximum_cardinality        = 26;
        final int dtd_identifier             = 27;
        final int declared_data_type         = 28;
        final int declared_numeric_precision = 29;
        final int declared_numeric_scale     = 30;

        row[data_type] = type.getFullNameString();

        if (type.isCharacterType()) {
            row[character_maximum_length] = ValuePool.getLong(type.precision);
            row[character_octet_length] = ValuePool.getLong(type.precision
                    * 2);
            row[character_set_catalog] = database.getCatalogName().name;
            row[character_set_schema] =
                ((CharacterType) type).getCharacterSet().getSchemaName().name;
            row[character_set_name] =
                ((CharacterType) type).getCharacterSet().getName().name;
            row[collation_catalog] = database.getCatalogName().name;
            row[collation_schema] =
                ((CharacterType) type).getCollation().getSchemaName().name;
            row[collation_name] =
                ((CharacterType) type).getCollation().getName().name;
        } else if (type.isNumberType()) {
            row[numeric_precision] = ValuePool.getLong(
                ((NumberType) type).getNumericPrecisionInRadix());
            row[declared_numeric_precision] = ValuePool.getLong(
                ((NumberType) type).getNumericPrecisionInRadix());

            if (type.isExactNumberType()) {
                row[numeric_scale] = row[declared_numeric_scale] =
                    ValuePool.getLong(type.scale);
            }

            row[numeric_precision_radix] =
                ValuePool.getLong(type.getPrecisionRadix());
        } else if (type.isBooleanType()) {

            //
        } else if (type.isDateTimeType()) {
            row[datetime_precision] = ValuePool.getLong(type.scale);
        } else if (type.isIntervalType()) {
            row[data_type] = "INTERVAL";
            row[interval_type] =
                ((IntervalType) type).getQualifier(type.typeCode);
            row[interval_precision] = ValuePool.getLong(type.precision);
            row[datetime_precision] = ValuePool.getLong(type.scale);
        } else if (type.isBinaryType()) {
            row[character_maximum_length] = ValuePool.getLong(type.precision);
            row[character_octet_length]   = ValuePool.getLong(type.precision);
        } else if (type.isBitType()) {
            row[character_maximum_length] = ValuePool.getLong(type.precision);
            row[character_octet_length]   = ValuePool.getLong(type.precision);
        } else if (type.isArrayType()) {
            row[maximum_cardinality] =
                ValuePool.getLong(type.arrayLimitCardinality());
        }

        row[dtd_identifier]     = type.getDefinition();
        row[declared_data_type] = row[data_type];
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:80,代码来源:DatabaseInformationFull.java


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