當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。