本文整理汇总了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);
}
示例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);
}
}
示例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!");
}
}
示例4: getNullableResult
import java.sql.CallableStatement; //导入方法依赖的package包/类
@Override
public Boolean getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return cs.getBoolean(columnIndex);
}
示例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);
}