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


Java ResultMetaData.getParameterTypes方法代码示例

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


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

示例1: StatementPortal

import org.hsqldb.result.ResultMetaData; //导入方法依赖的package包/类
/**
 * Instantiates a proxy ODBC StatementPortal object for the
 * Connection Session, and adds the new instance to the specified map.
 *
 * @param paramObjs Param values are either String or BinaryData instances
 */
public StatementPortal(String handle, OdbcPreparedStatement odbcPs,
                       Object[] paramObjs,
                       Map containingMap) throws RecoverableOdbcFailure {

    this.handle        = handle;
    lcQuery            = odbcPs.query.toLowerCase();
    ackResult          = odbcPs.ackResult;
    session            = odbcPs.session;
    this.containingMap = containingMap;

    Type[] paramTypes = Type.emptyArray;

    switch (ackResult.getType()) {

        case ResultConstants.PREPARE_ACK :
            break;

        case ResultConstants.ERROR :
            throw new RecoverableOdbcFailure(ackResult);
        default :
            throw new RecoverableOdbcFailure(
                "Output Result from secondary Statement prep is of "
                + "unexpected type: " + ackResult.getType());
    }

    if (paramObjs.length < 1) {
        parameters = new Object[0];
    } else {
        ResultMetaData pmd = odbcPs.ackResult.parameterMetaData;

        if (pmd == null) {
            throw new RecoverableOdbcFailure("No metadata for Result ack");
        }

        paramTypes = pmd.getParameterTypes();

        if (paramTypes.length != paramObjs.length) {
            throw new RecoverableOdbcFailure(
                null,
                "Client didn't specify all " + paramTypes.length
                + " parameters (" + paramObjs.length + ')', "08P01");
        }

        parameters = new Object[paramObjs.length];

        try {
            for (int i = 0; i < parameters.length; i++) {
                parameters[i] = (paramObjs[i] instanceof String)
                                ? PgType.getPgType(
                                    paramTypes[i], true).getParameter(
                                    (String) paramObjs[i], session)
                                : paramObjs[i];
            }
        } catch (java.sql.SQLException se) {
            throw new RecoverableOdbcFailure("Typing failure: " + se);
        }
    }

    bindResult = Result.newPreparedExecuteRequest(paramTypes,
            odbcPs.ackResult.getStatementID());

    containingMap.put(handle, this);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:70,代码来源:StatementPortal.java

示例2: StatementPortal

import org.hsqldb.result.ResultMetaData; //导入方法依赖的package包/类
/**
 * Instantiates a proxy ODBC StatementPortal object for the
 * Connection Session, and adds the new instance to the specified map.
 *
 * @param paramObjs Param values are either String or BinaryData instances
 */
public StatementPortal(String handle, OdbcPreparedStatement odbcPs,
                       Object[] paramObjs,
                       Map containingMap) throws RecoverableOdbcFailure {

    this.handle        = handle;
    lcQuery            = odbcPs.query.toLowerCase();
    ackResult          = odbcPs.ackResult;
    session            = odbcPs.session;
    this.containingMap = containingMap;
    bindResult = Result.newPreparedExecuteRequest(
        odbcPs.ackResult.parameterMetaData.getParameterTypes(),
        odbcPs.ackResult.getStatementID());

    switch (bindResult.getType()) {

        case ResultConstants.EXECUTE :
            break;

        case ResultConstants.ERROR :
            throw new RecoverableOdbcFailure(bindResult);
        default :
            throw new RecoverableOdbcFailure(
                "Output Result from seconary Statement prep is of "
                + "unexpected type: " + bindResult.getType());
    }

    if (paramObjs.length < 1) {
        parameters = new Object[0];
    } else {
        ResultMetaData pmd = odbcPs.ackResult.parameterMetaData;

        if (pmd == null) {
            throw new RecoverableOdbcFailure("No metadata for Result ack");
        }

        Type[] paramTypes = pmd.getParameterTypes();

        if (paramTypes.length != paramObjs.length) {
            throw new RecoverableOdbcFailure(
                null,
                "Client didn't specify all " + paramTypes.length
                + " parameters (" + paramObjs.length + ')', "08P01");
        }

        parameters = new Object[paramObjs.length];

        try {
            for (int i = 0; i < parameters.length; i++) {
                parameters[i] = (paramObjs[i] instanceof String)
                                ? PgType.getPgType(
                                    paramTypes[i], true).getParameter(
                                    (String) paramObjs[i], session)
                                : paramObjs[i];
            }
        } catch (java.sql.SQLException se) {
            throw new RecoverableOdbcFailure("Typing failure: " + se);
        }
    }

    containingMap.put(handle, this);
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:68,代码来源:StatementPortal.java


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