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


Java Type.collectionBaseType方法代码示例

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


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

示例1: writeArray

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

        type = type.collectionBaseType();

        noSeparators = true;
        write(BYTES_ARRAY);

        for (int i = 0; i < o.length; i++) {
            if (i > 0) {
                write(',');
            }

            writeData(o[i], type);
        }

        write(']');
        noSeparators = false;
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:19,代码来源:RowOutputTextLog.java

示例2: writeArray

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

        type = type.collectionBaseType();

        noSeparators = true;
        write(BYTES_ARRAY);

        for (int i = 0; i < o.length; i++) {
            if (i > 0) {
                write(',');
            }

            writeData(type, o[i]);
        }

        write(']');
        noSeparators = false;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:19,代码来源:RowOutputTextLog.java

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

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

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

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

示例7: writeArray

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

        type = type.collectionBaseType();

        writeInt(o.length);

        for (int i = 0; i < o.length; i++) {
            writeData(o[i], type);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:11,代码来源:RowOutputBinary.java

示例8: readArray

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

        type = type.collectionBaseType();

        int      size = readInt();
        Object[] data = new Object[size];

        for (int i = 0; i < size; i++) {
            data[i] = readData(type);
        }

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

示例9: writeArray

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

        type = type.collectionBaseType();

        writeInt(o.length);

        for (int i = 0; i < o.length; i++) {
            writeData(type, o[i]);
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:11,代码来源:RowOutputBinary.java

示例10: readArray

import org.hsqldb.types.Type; //导入方法依赖的package包/类
protected Object[] readArray(Type type) throws IOException {

        type = type.collectionBaseType();

        int      size = readInt();
        Object[] data = new Object[size];

        for (int i = 0; i < size; i++) {
            data[i] = readData(type);
        }

        return data;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:14,代码来源:RowInputBinary.java


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