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


Java ClobDataID.getSubString方法代码示例

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


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

示例1: getString

import org.hsqldb.types.ClobDataID; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Retrieves the value of the designated column in the current row
 * of this <code>ResultSet</code> object as
 * a <code>String</code> in the Java programming language.
 * <!-- end generic documentation -->
 *
 * @param columnIndex the first column is 1, the second is 2, ...
 * @return the column value; if the value is SQL <code>NULL</code>, the
 * value returned is <code>null</code>
 * @exception SQLException if a database access error occurs or this method is
 *            called on a closed result set
 */
public String getString(int columnIndex) throws SQLException {

    checkColumn(columnIndex);

    Type sourceType = resultMetaData.columnTypes[columnIndex - 1];

    if (sourceType.typeCode == Types.SQL_CLOB) {
        ClobDataID x = (ClobDataID) getColumnInType(columnIndex,
            sourceType);

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

        long length = x.length(session);

        if (length > Integer.MAX_VALUE) {
            JDBCUtil.throwError(Error.error(ErrorCode.X_42561));
        }

        return x.getSubString(session, 0, (int) length);
    }

    return (String) getColumnInType(columnIndex, Type.SQL_VARCHAR);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:39,代码来源:JDBCResultSet.java

示例2: getString

import org.hsqldb.types.ClobDataID; //导入方法依赖的package包/类
/**
 * <!-- start generic documentation -->
 * Retrieves the value of the designated column in the current row
 * of this <code>ResultSet</code> object as
 * a <code>String</code> in the Java programming language.
 * <!-- end generic documentation -->
 *
 * @param columnIndex the first column is 1, the second is 2, ...
 * @return the column value; if the value is SQL <code>NULL</code>, the
 * value returned is <code>null</code>
 * @exception SQLException if a database access error occurs or this method is
 *            called on a closed result set
 */
public String getString(int columnIndex) throws SQLException {

    checkColumn(columnIndex);

    Type sourceType = resultMetaData.columnTypes[columnIndex - 1];

    if (sourceType.typeCode == Types.SQL_CLOB) {
        ClobDataID x = (ClobDataID) getColumnInType(columnIndex,
            sourceType);

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

        long length = x.length(session);

        if (length > Integer.MAX_VALUE) {
            Util.throwError(Error.error(ErrorCode.X_42561));
        }

        return x.getSubString(session, 0, (int) length);
    }

    return (String) getColumnInType(columnIndex, Type.SQL_VARCHAR);
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:39,代码来源:JDBCResultSet.java


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