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


Java CallableStatement.getBoolean方法代码示例

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


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

示例1: testMoreLanceBugs

import java.sql.CallableStatement; //导入方法依赖的package包/类
public void testMoreLanceBugs() throws Exception {
    if (!versionMeetsMinimum(5, 0)) {
        return;
    }

    createTable("Bit_Tab", "( `MAX_VAL` BIT default NULL, `MIN_VAL` BIT default NULL, `NULL_VAL` BIT default NULL) DEFAULT CHARSET=latin1", "InnoDB");
    // this.stmt.execute("insert into Bit_Tab values(null,0,null)");
    createProcedure("Bit_Proc", "(out MAX_PARAM TINYINT, out MIN_PARAM TINYINT, out NULL_PARAM TINYINT) "
            + "begin select MAX_VAL, MIN_VAL, NULL_VAL  into MAX_PARAM, MIN_PARAM, NULL_PARAM from Bit_Tab; end ");

    Boolean minBooleanVal;
    Boolean oRetVal;
    String Min_Val_Query = "SELECT MIN_VAL from Bit_Tab";
    String Min_Insert = "insert into Bit_Tab values(1,0,null)";
    // System.out.println("Value to insert=" + extractVal(Min_Insert,1));
    CallableStatement cstmt;

    this.stmt.executeUpdate("delete from Bit_Tab");
    this.stmt.executeUpdate(Min_Insert);
    cstmt = this.conn.prepareCall("{call Bit_Proc(?,?,?)}");

    cstmt.registerOutParameter(1, java.sql.Types.BIT);
    cstmt.registerOutParameter(2, java.sql.Types.BIT);
    cstmt.registerOutParameter(3, java.sql.Types.BIT);

    cstmt.executeUpdate();

    boolean bRetVal = cstmt.getBoolean(2);
    oRetVal = new Boolean(bRetVal);
    minBooleanVal = new Boolean("false");
    this.rs = this.stmt.executeQuery(Min_Val_Query);
    assertEquals(minBooleanVal, oRetVal);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:34,代码来源:StatementRegressionTest.java

示例2: getResult

import java.sql.CallableStatement; //导入方法依赖的package包/类
public Object getResult(CallableStatement cs, int columnIndex) throws SQLException {

            boolean b = cs.getBoolean(columnIndex);
            if (cs.wasNull()) {
                return null;
            }
            else {
                return new Boolean(b);
            }
        }
 
开发者ID:uavorg,项目名称:uavstack,代码行数:11,代码来源:DAOFactory.java

示例3: testBitSp

import java.sql.CallableStatement; //导入方法依赖的package包/类
public void testBitSp() throws Exception {
    if (!versionMeetsMinimum(5, 0)) {
        return;
    }

    createTable("`Bit_Tab`", "( `MAX_VAL` tinyint(1) default NULL, `MIN_VAL` tinyint(1) default NULL, `NULL_VAL` tinyint(1) default NULL)");

    createProcedure("Bit_Proc", "(out MAX_PARAM TINYINT, out MIN_PARAM TINYINT, out NULL_PARAM TINYINT)"
            + "begin select MAX_VAL, MIN_VAL, NULL_VAL  into MAX_PARAM, MIN_PARAM, NULL_PARAM from Bit_Tab; end");

    Boolean minBooleanVal;
    Boolean oRetVal;

    String Min_Val_Query = "SELECT MIN_VAL from Bit_Tab";
    //String sMaxBooleanVal = "1";
    // sMaxBooleanVal = "true";
    //Boolean bool = Boolean.valueOf("true");
    String Min_Insert = "insert into Bit_Tab values(1,0,null)";
    // System.out.println("Value to insert=" + extractVal(Min_Insert,1));
    CallableStatement cstmt;

    this.stmt.executeUpdate("delete from Bit_Tab");
    this.stmt.executeUpdate(Min_Insert);
    cstmt = this.conn.prepareCall("{call Bit_Proc(?,?,?)}");

    System.out.println("register the output parameters");
    cstmt.registerOutParameter(1, java.sql.Types.BIT);
    cstmt.registerOutParameter(2, java.sql.Types.BIT);
    cstmt.registerOutParameter(3, java.sql.Types.BIT);

    System.out.println("execute the procedure");
    cstmt.executeUpdate();

    System.out.println("invoke getBoolean method");
    boolean bRetVal = cstmt.getBoolean(2);
    oRetVal = new Boolean(bRetVal);
    minBooleanVal = new Boolean("false");
    this.rs = this.stmt.executeQuery(Min_Val_Query);
    if (oRetVal.equals(minBooleanVal)) {
        System.out.println("getBoolean returns the Minimum value ");
    } else {
        System.out.println("getBoolean() did not return the Minimum value, getBoolean Failed!");

    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:46,代码来源:CallableStatementRegressionTest.java

示例4: getNullableResult

import java.sql.CallableStatement; //导入方法依赖的package包/类
@Override
public Boolean getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
	return cs.getBoolean(columnIndex);
}
 
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:5,代码来源:BooleanTypeHandler.java

示例5: getAppObject

import java.sql.CallableStatement; //导入方法依赖的package包/类
/** Gets a parameter from the CallableStatement.
 * @return the parameter.
 * @param engineType The engine type as defined in init.xml
 * @param cstmt The CallableStatement.
 * @param parameterIndex The index of the parameter.
 * @throws SQLException if a database access error occurs.
 * @throws IOException if any error occurs in reading the data from the database.
 */
public Object getAppObject(CallableStatement cstmt, int parameterIndex, String engineType) throws SQLException, IOException {
    boolean value = cstmt.getBoolean(parameterIndex);
    if (cstmt.wasNull())
        return null;
    else
        return new Boolean(value);
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:16,代码来源:TypeDefs.java


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