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


Java Type.isArrayType方法代码示例

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


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

示例1: checkRowComparison

import org.hsqldb.types.Type; //导入方法依赖的package包/类
void checkRowComparison() {

        if (opType == OpTypes.EQUAL || opType == OpTypes.NOT_EQUAL) {
            return;
        }

        for (int i = 0; i < nodes[LEFT].nodeDataTypes.length; i++) {
            Type leftType  = nodes[LEFT].nodeDataTypes[i];
            Type rightType = nodes[RIGHT].nodeDataTypes[i];

            if (leftType.isArrayType() || leftType.isLobType()
                    || rightType.isLobType()) {
                throw Error.error(ErrorCode.X_42534);
            }
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:17,代码来源:ExpressionLogical.java

示例2: createArrayOf

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
     *  Factory method for creating Array objects.
     * <p>
     *  <b>Note: </b>When <code>createArrayOf</code> is used to create an array object
     *  that maps to a primitive data type, then it is implementation-defined
     *  whether the <code>Array</code> object is an array of that primitive
     *  data type or an array of <code>Object</code>.
     *  <p>
     *  <b>Note: </b>The JDBC driver is responsible for mapping the elements
     *  <code>Object</code> array to the default JDBC SQL type defined in
     *  java.sql.Types for the given class of <code>Object</code>. The default
     *  mapping is specified in Appendix B of the JDBC specification.  If the
     *  resulting JDBC type is not the appropriate type for the given typeName then
     *  it is implementation defined whether an <code>SQLException</code> is
     *  thrown or the driver supports the resulting conversion.
     *
     *  @param typeName the SQL name of the type the elements of the array map to. The typeName is a
     *  database-specific name which may be the name of a built-in type, a user-defined type or a standard  SQL type supported by this database. This
     *   is the value returned by <code>Array.getBaseTypeName</code>
     *  @param elements the elements that populate the returned object
     *  @return an Array object whose elements map to the specified SQL type
     *  @throws SQLException if a database error occurs, the JDBC type is not
     *   appropriate for the typeName and the conversion is not supported, the typeName is null or this method is called on a closed connection
     *  @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this data type
     *  @since 1.6
     */
//#ifdef JAVA6
    public Array createArrayOf(String typeName,
                               Object[] elements) throws SQLException {

        checkClosed();

        if (typeName == null) {
            throw JDBCUtil.nullArgument();
        }
        typeName = typeName.toUpperCase();

        int typeCode = Type.getTypeNr(typeName);

        if (typeCode < 0) {
            throw JDBCUtil.invalidArgument(typeName);
        }

        Type type = Type.getDefaultType(typeCode);

        if (type.isArrayType() || type.isLobType() || type.isRowType()) {
            throw JDBCUtil.invalidArgument(typeName);
        }

        Object[] newData = new Object[elements.length];

        try {
            for (int i = 0; i < elements.length; i++) {
                Object o = type.convertJavaToSQL(sessionProxy, elements[i]);

                newData[i] = type.convertToTypeLimits(sessionProxy, o);
            }
        } catch (HsqlException e) {
            throw JDBCUtil.sqlException(e);
        }

        return new JDBCArray(newData, type, this);
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:64,代码来源:JDBCConnection.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: writeDataType

import org.hsqldb.types.Type; //导入方法依赖的package包/类
void writeDataType(RowOutputInterface out, Type type) {

        out.writeType(type.typeCode);

        if (type.isArrayType()) {
            out.writeType(type.collectionBaseType().typeCode);
        }

        out.writeLong(type.precision);
        out.writeInt(type.scale);
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:12,代码来源:ResultMetaData.java

示例5: writeDataTypeCodes

import org.hsqldb.types.Type; //导入方法依赖的package包/类
void writeDataTypeCodes(RowOutputInterface out, Type type) {

        out.writeType(type.typeCode);

        if (type.isArrayType()) {
            out.writeType(type.collectionBaseType().typeCode);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:9,代码来源:ResultMetaData.java

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

示例7: getInsertData

import org.hsqldb.types.Type; //导入方法依赖的package包/类
Object[] getInsertData(Session session, Type[] colTypes,
                       Expression[] rowArgs) {

    Object[] data = baseTable.getNewRowData(session);

    session.sessionData.startRowProcessing();

    for (int i = 0; i < rowArgs.length; i++) {
        Expression e        = rowArgs[i];
        int        colIndex = insertColumnMap[i];

        if (e.opType == OpTypes.DEFAULT) {
            if (baseTable.identityColumn == colIndex) {
                continue;
            }

            if (baseTable.colDefaults[colIndex] != null) {
                data[colIndex] =
                    baseTable.colDefaults[colIndex].getValue(session);
            }

            continue;
        }

        Object value = e.getValue(session);
        Type   type  = colTypes[colIndex];

        if (session.database.sqlSyntaxMys
                || session.database.sqlSyntaxPgs) {
            try {
                value = type.convertToType(session, value, e.dataType);
            } catch (HsqlException ex) {
                if (type.typeCode == Types.SQL_DATE) {
                    value = Type.SQL_TIMESTAMP.convertToType(session,
                            value, e.dataType);
                    value = type.convertToType(session, value,
                                               Type.SQL_TIMESTAMP);
                } else if (type.typeCode == Types.SQL_TIMESTAMP) {
                    value = Type.SQL_DATE.convertToType(session, value,
                                                        e.dataType);
                    value = type.convertToType(session, value,
                                               Type.SQL_DATE);
                } else {
                    throw ex;
                }
            }
        } else {

            // DYNAMIC_PARAM and PARAMETER expressions may have wider values
            if (e.dataType == null
                    || type.typeDataGroup != e.dataType.typeDataGroup
                    || type.isArrayType()) {
                value = type.convertToType(session, value, e.dataType);
            }
        }

        data[colIndex] = value;
    }

    return data;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:62,代码来源:StatementDML.java

示例8: getArray

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 *
 * Retrieves the value of the designated JDBC <code>ARRAY</code> parameter as an
 * {@link java.sql.Array} object in the Java programming language.
 *
 * <!-- end generic documentation -->
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * HSQLDB supports this feature. <p>
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2, and
 * so on
 * @return the parameter value as an <code>Array</code> object in
 * the Java programming language.  If the value was SQL <code>NULL</code>, the
 * value <code>null</code> is returned.
 * @exception SQLException  JDBC 4.1[if the parameterIndex is not valid;]
 * if a database access error occurs or
 * this method is called on a closed <code>CallableStatement</code>
 * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
 * this method
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *  JDBCParameterMetaData)
 */
public Array getArray(int parameterIndex) throws SQLException {

    checkGetParameterIndex(parameterIndex);

    Type type = parameterMetaData.columnTypes[parameterIndex - 1];

    if (!type.isArrayType()) {
        throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }

    Object[] data = (Object[]) parameterValues[parameterIndex - 1];

    if (data == null) {
        return null;
    }

    return new JDBCArray(data, type.collectionBaseType(), type,
                         connection);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:50,代码来源:JDBCCallableStatement.java

示例9: setArray

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Sets the designated parameter to the given <code>java.sql.Array</code> object.
 * The driver converts this to an SQL <code>ARRAY</code> value when it
 * sends it to the database.
 * <!-- end generic documentation -->
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * From version 2.0, HSQLDB supports the SQL ARRAY type.
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2, ...
 * @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>PreparedStatement</code>
 * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *   JDBCParameterMetaData)
 */
public synchronized void setArray(int parameterIndex,
                                  Array x) throws SQLException {

    checkParameterIndex(parameterIndex);

    Type type = this.parameterMetaData.columnTypes[parameterIndex - 1];

    if (!type.isArrayType()) {
        throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }

    if (x == null) {
        setParameter(parameterIndex, null);

        return;
    }

    Object[] data = null;

    if (x instanceof JDBCArray) {
        data = ((JDBCArray) x).getArrayInternal();
    } else {
        Object object = x.getArray();

        if (object instanceof Object[]) {
            Type     baseType = type.collectionBaseType();
            Object[] array    = (Object[]) object;

            data = new Object[array.length];

            for (int i = 0; i < data.length; i++) {
                data[i] = baseType.convertJavaToSQL(session, array[i]);
            }
        } else {

            // if foreign data is not Object[]
            throw JDBCUtil.notSupported();
        }
    }
    parameterValues[parameterIndex - 1] = data;
    parameterSet[parameterIndex - 1]    = Boolean.TRUE;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:67,代码来源:JDBCPreparedStatement.java

示例10: getArray

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Retrieves the value of the designated column in the current row
 * of this <code>ResultSet</code> object as an <code>Array</code> object
 * in the Java programming language.
 * <!-- end generic documentation -->
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * From version 2.0, HSQLDB supports array types.
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param columnIndex the first column is 1, the second is 2, ...
 * @return an <code>Array</code> object representing the SQL
 *         <code>ARRAY</code> value in the specified column
 * @exception SQLException if a database access error occurs
 * or this method is called on a closed result set
 *  @exception SQLFeatureNotSupportedException if the JDBC driver does not support
 * this method
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *  JDBCResultSet)
 */
public Array getArray(int columnIndex) throws SQLException {

    checkColumn(columnIndex);

    Type     type = resultMetaData.columnTypes[columnIndex - 1];
    Object[] data = (Object[]) getCurrent()[columnIndex - 1];

    if (!type.isArrayType()) {
        throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }

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

    return new JDBCArray(data, type.collectionBaseType(), type,
                         connection);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:45,代码来源:JDBCResultSet.java

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

示例12: setArray

import org.hsqldb.types.Type; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Sets the designated parameter to the given <code>java.sql.Array</code> object.
 * The driver converts this to an SQL <code>ARRAY</code> value when it
 * sends it to the database.
 * <!-- end generic documentation -->
 *
 * <!-- start release-specific documentation -->
 * <div class="ReleaseSpecificDocumentation">
 * <h3>HSQLDB-Specific Information:</h3> <p>
 *
 * From version 2.0, HSQLDB supports the SQL ARRAY type.
 *
 * </div>
 * <!-- end release-specific documentation -->
 *
 * @param parameterIndex the first parameter is 1, the second is 2, ...
 * @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
 * @exception SQLException if a database access error occurs or
 * this method is called on a closed <code>PreparedStatement</code>
 * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
 * @since JDK 1.2 (JDK 1.1.x developers: read the overview for
 *   JDBCParameterMetaData)
 */
public synchronized void setArray(int parameterIndex,
                                  Array x) throws SQLException {

    checkParameterIndex(parameterIndex);

    Type type = this.parameterMetaData.columnTypes[parameterIndex - 1];

    if (!type.isArrayType()) {
        throw JDBCUtil.sqlException(ErrorCode.X_42561);
    }

    if (x == null) {
        setParameter(parameterIndex, null);

        return;
    }

    Object[] data = null;

    if (x instanceof JDBCArray) {
        data = (Object[]) ((JDBCArray) x).getArrayInternal();
    } else {
        Object object = x.getArray();

        if (object instanceof Object[]) {
            Type     baseType = type.collectionBaseType();
            Object[] array    = (Object[]) object;

            data = new Object[array.length];

            for (int i = 0; i < data.length; i++) {
                data[i] = baseType.convertJavaToSQL(session, array[i]);
            }
        } else {

            // if foreign data is not Object[]
            throw JDBCUtil.notSupported();
        }
    }
    parameterValues[parameterIndex - 1] = data;
    parameterSet[parameterIndex - 1]    = Boolean.TRUE;
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:67,代码来源:JDBCPreparedStatement.java


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