public long nextTSecGroupMemberIdGen( CFSecurityAuthorization Authorization, CFSecurityTenantPKey PKey) { final String S_ProcName = "nextTSecGroupMemberIdGen"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Not in a transaction"); } Connection cnx = schema.getCnx(); long Id = PKey.getRequiredId(); CallableStatement stmtSelectNextTSecGroupMemberIdGen = null; try { String sql = "{ call sp_next_tsecgroupmemberidgen( ?" + ", " + "?" + " ) }"; stmtSelectNextTSecGroupMemberIdGen = cnx.prepareCall(sql); int argIdx = 1; stmtSelectNextTSecGroupMemberIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT); stmtSelectNextTSecGroupMemberIdGen.setLong(argIdx++, Id); stmtSelectNextTSecGroupMemberIdGen.execute(); long nextId = stmtSelectNextTSecGroupMemberIdGen.getLong(1); return (nextId); } catch (SQLException e) { throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e); } finally { if (stmtSelectNextTSecGroupMemberIdGen != null) { try { stmtSelectNextTSecGroupMemberIdGen.close(); } catch (SQLException e) { } stmtSelectNextTSecGroupMemberIdGen = null; } } }
public long getLong(int parameterIndex) throws SQLException { checkOpen(); try { return _stmt.getLong(parameterIndex); } catch (SQLException e) { handleException(e); return 0; } }
public long getLong(String parameterName) throws SQLException { checkOpen(); try { return _stmt.getLong(parameterName); } catch (SQLException e) { handleException(e); return 0; } }
private Long getNextNumber(SessionImplementor session) { Long index = 0L; Connection con = (Connection) session.getBatcher().openConnection(); CallableStatement statement = null; try { if (con != null) { statement = con.prepareCall("CALL proc_get_next_key(?,?,?,?)"); if (statement != null) { statement.setString(2, schemaName); statement.setString(3, tableName); statement.setString(4, columnName); statement.registerOutParameter(1, Types.BIGINT); statement.execute(); System.out.println("Output=" + statement.getLong(1)); index = statement.getLong(1); con.commit(); System.out.println("Connected identifier"); } } } catch (SQLException ex) { Logger.getLogger(HibernateIdGenerator.class.getName()).log(Level.SEVERE, null, ex); } finally { try { if (statement != null) { statement.close(); } } catch (SQLException ex) { Logger.getLogger(HibernateIdGenerator.class.getName()).log(Level.SEVERE, null, ex); } try { if (con != null) { con.close(); } } catch (SQLException ex) { Logger.getLogger(HibernateIdGenerator.class.getName()).log(Level.SEVERE, null, ex); } } return index; }
public void testGetLong01() throws Throwable { try { Statement stmt = con.createStatement(); stmt.execute("create temp table l_tab ( max_val int8, min_val int8, null_val int8 )"); stmt.execute("insert into l_tab values (9223372036854775807,-9223372036854775808,null)"); boolean ret = stmt.execute( "create or replace function " + "bigint_proc( OUT IMAX int8, OUT IMIN int8, OUT INUL int8) as " + "'begin " + "select max_val into imax from l_tab;" + "select min_val into imin from l_tab;" + "select null_val into inul from l_tab;" + " end;' " + "language plpgsql;"); } catch (Exception ex) { fail(ex.getMessage()); throw ex; } try { CallableStatement cstmt = con.prepareCall("{ call bigint_proc(?,?,?) }"); cstmt.registerOutParameter(1, java.sql.Types.BIGINT); cstmt.registerOutParameter(2, java.sql.Types.BIGINT); cstmt.registerOutParameter(3, java.sql.Types.BIGINT); cstmt.executeUpdate(); assertTrue(cstmt.getLong(1) == 9223372036854775807L); assertTrue(cstmt.getLong(2) == -9223372036854775808L); cstmt.getLong(3); assertTrue(cstmt.wasNull()); } catch (Exception ex) { fail(ex.getMessage()); } finally { try { Statement dstmt = con.createStatement(); dstmt.execute("drop function bigint_proc()"); } catch (Exception ex) { } } }
/** The long value */ @Override public long getLong(String name) throws SQLException { try { return _cstmt.getLong(name); } catch (SQLException e) { onSqlException(e); throw e; } catch (RuntimeException e) { onRuntimeException(e); throw e; } }
@Override public void procesar(MotEmpConductor dto) throws MotEmpConductorDaoException { Connection conn = null; CallableStatement stmt = null; ResultSet rs = null; try { conn = ResourceManager.getConnection(); stmt = conn.prepareCall( "{call SP_MOT_INS_PERSONA_CONDUCTOR;1(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"); stmt.registerOutParameter(1, Types.DECIMAL); stmt.setLong(1, dto.getConductor().getConcodigoD()); stmt.setLong(2, dto.getConductor().getPersona().getPercodigoD()); stmt.setString(3, dto.getConductor().getPersona().getPerdniV()); stmt.setString(4, dto.getConductor().getPersona().getPernombresV()); stmt.setString(5, dto.getConductor().getPersona().getPerpaternoV()); stmt.setString(6, dto.getConductor().getPersona().getPermaternoV()); stmt.setString(7, dto.getConductor().getPersona().getPernacimientoF()); stmt.setString(8, dto.getConductor().getPersona().getPerestadocivilC()); stmt.setString(9, dto.getConductor().getPersona().getPermovilclaV()); stmt.setString(10, dto.getConductor().getPersona().getPermovilmovV()); stmt.setString(11, dto.getConductor().getPersona().getPermovilnexV()); stmt.setString(12, dto.getConductor().getPersona().getPerteleffijoV()); stmt.setString(13, dto.getConductor().getPersona().getPeremailV()); stmt.setString(14, dto.getConductor().getPersona().getPerdomicilioV()); stmt.setString(15, dto.getConductor().getPersona().getPerubidistV()); stmt.setString(16, dto.getConductor().getPersona().getPerubdptoV()); stmt.setString(17, dto.getConductor().getPersona().getPerubprovV()); stmt.setString(18, dto.getConductor().getPersona().getPersexoC()); stmt.setLong(19, dto.getEmpresa().getEmpcodigoD()); stmt.setString(20, dto.getEcofechainicioF()); stmt.execute(); Long codigo = stmt.getLong(1); if (codigo != null) { dto.getConductor().setConcodigoD(codigo); } } catch (Exception ex) { logger.error("Exception: " + ex.getMessage(), ex); throw new MotEmpConductorDaoException("Exception: " + ex.getMessage(), ex); } finally { ResourceManager.close(rs); ResourceManager.close(stmt); ResourceManager.close(conn); } }
public void testAllInOut() throws Throwable { CallableStatement call = con.prepareCall("{ call test_allinout(?,?,?) }"); call.registerOutParameter(1, Types.INTEGER); call.registerOutParameter(2, Types.VARCHAR); call.registerOutParameter(3, Types.BIGINT); call.setInt(1, 20); call.setString(2, "hi"); call.setInt(3, 123); call.execute(); call.getInt(1); call.getString(2); call.getLong(3); }
public long getClass(long objectId) throws PersistenceException { try { CallableStatement callable; callable = this.con.prepareCall("Begin ? := " + this.schemaName + ".SrvcFacade.getClass(?); end;"); callable.registerOutParameter(1, OracleTypes.NUMBER); callable.setLong(2, objectId); callable.execute(); long result = callable.getLong(1); callable.close(); return result; } catch (SQLException se) { throw new PersistenceException(se.getMessage(), se.getErrorCode()); } }
@Override public long getDatabaseSystemTimeMillis() throws SQLException { Connection con = connectionFactory.getConnection(); try { CallableStatement stat = con.prepareCall(code); try { stat.registerOutParameter(1, Types.NUMERIC); stat.execute(); return (stat.getLong(1)); } finally { DatabaseUtil.closeQuietly(stat); } } finally { DatabaseUtil.closeQuietly(con); } }
public long createGame(long gameCreator, String model, String filePath) { String sql = DatabaseProperties.getProperty("dominion.createGame"); long gameId = 0; try (CallableStatement cs = con.prepareCall(sql)) { int index = 0; cs.setLong(++index, gameCreator); cs.setString(++index, model); cs.setString(++index, filePath); cs.execute(); filePath = cs.getString(3); gameId = cs.getLong(4); } catch (Exception e) { log.log(Level.WARNING, "Error adding user", e); } return gameId; }
public void test_wrapperOutputArgs() throws Exception { Connection conn = getConnection(); PreparedStatement ps = conn.prepareStatement( "create procedure wrapperProc\n" + "(\n" + " out bigintCol bigint,\n" + " out booleanCol boolean,\n" + " out doubleCol double,\n" + " out floatCol float,\n" + " out intCol int,\n" + " out realCol real,\n" + " out smallintCol smallint\n" + ")\n" + "language java\n" + "parameter style java\n" + "no sql\n" + "external name 'org.apache.derbyTesting.functionTests.tests.lang.AnsiSignatures.wrapperProc'\n"); ps.execute(); ps.close(); CallableStatement cs = conn.prepareCall("call wrapperProc( ?, ?, ?, ?, ?, ?, ? )"); int param = 1; cs.registerOutParameter(param++, Types.BIGINT); cs.registerOutParameter(param++, Types.BOOLEAN); cs.registerOutParameter(param++, Types.DOUBLE); cs.registerOutParameter(param++, Types.FLOAT); cs.registerOutParameter(param++, Types.INTEGER); cs.registerOutParameter(param++, Types.REAL); cs.registerOutParameter(param++, Types.SMALLINT); cs.execute(); param = 1; assertEquals(1L, cs.getLong(param++)); assertEquals(true, cs.getBoolean(param++)); assertEquals(1.0, cs.getDouble(param++), 0.0); assertEquals(1.0, cs.getDouble(param++), 0.0); assertEquals(1, cs.getInt(param++)); assertEquals(1.0F, cs.getFloat(param++), 0.0F); assertEquals((short) 1, cs.getShort(param++)); }
/** Test of getLong method, of inteface java.sql.CallableStatement. */ public void testGetLong() throws Exception { println("getLong"); if (!isTestOutParameters()) { return; } CallableStatement stmt; long expResult = 1; long result = 0; try { stmt = prepRegAndExec("{?= call cast(1 as bigint)}", 1, Types.BIGINT); result = stmt.getLong(1); } catch (Exception ex) { fail(ex.getMessage()); } assertEquals(expResult, result); }
@Override public void insertar(MotInteInventario inteInventario) throws MotInteInventarioDaoException { Connection conn = null; CallableStatement stmt = null; try { conn = ResourceManager.getConnection(); stmt = conn.prepareCall("{call SP_MOT_INS_INTE_INVENTARIO;1(?,?,?,?,?)}"); stmt.registerOutParameter(1, Types.DECIMAL); stmt.setLong(2, inteInventario.getInternamiento().getIntcodigoD()); stmt.setInt(3, inteInventario.getInventarioTipo().getBitcodigoI()); stmt.setString(4, inteInventario.getBivestadoC()); stmt.setInt(5, inteInventario.getBivcantidadI()); stmt.execute(); Long codigo = stmt.getLong(1); if (codigo != null) { inteInventario.setBivcodigoD(codigo); } } catch (SQLException e) { throw new MotInteInventarioDaoException(e.getMessage(), e); } finally { ResourceManager.close(stmt); ResourceManager.close(conn); } }
@SuppressWarnings("unchecked") public static <T> T getFromStatement(ExecuteContext ctx, Class<? extends T> type, int index) throws SQLException { CallableStatement stmt = (CallableStatement) ctx.statement(); if (type == Blob.class) { return (T) stmt.getBlob(index); } else if (type == Boolean.class) { return (T) checkWasNull(stmt, Boolean.valueOf(stmt.getBoolean(index))); } else if (type == BigInteger.class) { BigDecimal result = stmt.getBigDecimal(index); return (T) (result == null ? null : result.toBigInteger()); } else if (type == BigDecimal.class) { return (T) stmt.getBigDecimal(index); } else if (type == Byte.class) { return (T) checkWasNull(stmt, Byte.valueOf(stmt.getByte(index))); } else if (type == byte[].class) { return (T) stmt.getBytes(index); } else if (type == Clob.class) { return (T) stmt.getClob(index); } else if (type == Date.class) { return (T) stmt.getDate(index); } else if (type == Double.class) { return (T) checkWasNull(stmt, Double.valueOf(stmt.getDouble(index))); } else if (type == Float.class) { return (T) checkWasNull(stmt, Float.valueOf(stmt.getFloat(index))); } else if (type == Integer.class) { return (T) checkWasNull(stmt, Integer.valueOf(stmt.getInt(index))); } else if (type == Long.class) { return (T) checkWasNull(stmt, Long.valueOf(stmt.getLong(index))); } else if (type == Short.class) { return (T) checkWasNull(stmt, Short.valueOf(stmt.getShort(index))); } else if (type == String.class) { return (T) stmt.getString(index); } else if (type == Time.class) { return (T) stmt.getTime(index); } else if (type == Timestamp.class) { return (T) stmt.getTimestamp(index); } else if (type == YearToMonth.class) { if (ctx.getDialect() == POSTGRES) { Object object = stmt.getObject(index); return (T) (object == null ? null : PostgresUtils.toYearToMonth(object)); } else { String string = stmt.getString(index); return (T) (string == null ? null : YearToMonth.valueOf(string)); } } else if (type == DayToSecond.class) { if (ctx.getDialect() == POSTGRES) { Object object = stmt.getObject(index); return (T) (object == null ? null : PostgresUtils.toDayToSecond(object)); } else { String string = stmt.getString(index); return (T) (string == null ? null : DayToSecond.valueOf(string)); } } else if (type == UByte.class) { String string = stmt.getString(index); return (T) (string == null ? null : UByte.valueOf(string)); } else if (type == UShort.class) { String string = stmt.getString(index); return (T) (string == null ? null : UShort.valueOf(string)); } else if (type == UInteger.class) { String string = stmt.getString(index); return (T) (string == null ? null : UInteger.valueOf(string)); } else if (type == ULong.class) { String string = stmt.getString(index); return (T) (string == null ? null : ULong.valueOf(string)); } // The type byte[] is handled earlier. byte[][] can be handled here else if (type.isArray()) { return (T) convertArray(stmt.getObject(index), (Class<? extends Object[]>) type); } else if (ArrayRecord.class.isAssignableFrom(type)) { return (T) getArrayRecord(ctx, stmt.getArray(index), (Class<? extends ArrayRecord<?>>) type); } else if (EnumType.class.isAssignableFrom(type)) { return getEnumType(type, stmt.getString(index)); } else if (MasterDataType.class.isAssignableFrom(type)) { return (T) getMasterDataType(type, stmt.getString(index)); } else if (UDTRecord.class.isAssignableFrom(type)) { switch (ctx.getDialect()) { case POSTGRES: return (T) pgNewUDTRecord(type, stmt.getObject(index)); } return (T) stmt.getObject(index, DataTypes.udtRecords()); } else if (Result.class.isAssignableFrom(type)) { ResultSet nested = (ResultSet) stmt.getObject(index); return (T) getNewFactory(ctx).fetch(nested); } else { return (T) stmt.getObject(index); } }
public long getLong(int parameterIndex) throws SQLException { return passThru.getLong(parameterIndex); }
public void retrieveOutVariables(int ColIndex, cfSession _Session, CallableStatement _stmt) throws SQLException, cfmRunTimeException { boolean b; byte[] bin; int i; long l; double dbl; float flt; java.sql.Date dt; java.sql.Time t; Timestamp ts; ResultSet rs; String str; cfData outData = null; if (!isOUT()) return; switch (cfSqlType) { case CF_SQL_BIT: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { b = _stmt.getBoolean(paramName); } else { b = _stmt.getBoolean(ColIndex); } if (!_stmt.wasNull()) outData = cfBooleanData.getcfBooleanData(b); break; case CF_SQL_BINARY: case CF_SQL_VARBINARY: case CF_SQL_BLOB: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { bin = _stmt.getBytes(paramName); } else { bin = _stmt.getBytes(ColIndex); } if ((!_stmt.wasNull()) && (bin != null)) { outData = new cfBinaryData(bin); } break; case CF_SQL_SMALLINT: case CF_SQL_INTEGER: case CF_SQL_TINYINT: try { // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { i = _stmt.getInt(paramName); } else { i = _stmt.getInt(ColIndex); } if (!_stmt.wasNull()) outData = new cfNumberData(i); } catch (NumberFormatException e) { // With JDK 1.3 and the JDBC-ODBC bridge, the getInt() method will // throw a number format exception for in/out params so just ignore it. // Ignoring it allows us to retrieve the out param values. } break; case CF_SQL_BIGINT: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { l = _stmt.getLong(paramName); } else { l = _stmt.getLong(ColIndex); } if (!_stmt.wasNull()) outData = new cfNumberData(l); break; case CF_SQL_DECIMAL: case CF_SQL_NUMERIC: dbl = getBigDecimalAsDouble(_stmt, useNamedParameters, paramName, ColIndex); if (!_stmt.wasNull()) outData = new cfNumberData(dbl); break; case CF_SQL_DOUBLE: case CF_SQL_FLOAT: case CF_SQL_MONEY: case CF_SQL_MONEY4: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { dbl = _stmt.getDouble(paramName); } else { dbl = _stmt.getDouble(ColIndex); } if (!_stmt.wasNull()) outData = new cfNumberData(dbl); break; case CF_SQL_REAL: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { flt = _stmt.getFloat(paramName); } else { flt = _stmt.getFloat(ColIndex); } // For some reason casting a float to a double doesn't return a double // that exactly matches the original float so we'll use the less efficient // algorithm of converting the float to a string and the string to a double. // If for some reason this fails then we'll revert to casting the float to // a double. if (!_stmt.wasNull()) { try { dbl = Double.valueOf(Float.toString(flt)).doubleValue(); } catch (Exception e) { dbl = (double) flt; } outData = new cfNumberData(dbl); } break; case CF_SQL_DATE: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { dt = _stmt.getDate(paramName); } else { dt = _stmt.getDate(ColIndex); } if ((!_stmt.wasNull()) && (dt != null)) { outData = new cfDateData(dt); } break; case CF_SQL_TIME: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { t = _stmt.getTime(paramName); } else { t = _stmt.getTime(ColIndex); } if ((!_stmt.wasNull()) && (t != null)) { outData = new cfDateData(t); } break; case CF_SQL_TIMESTAMP: try { // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { ts = _stmt.getTimestamp(paramName); } else { ts = _stmt.getTimestamp(ColIndex); } if ((!_stmt.wasNull()) && (ts != null)) { outData = new cfDateData(ts); } } catch (NullPointerException e) { // With JDK 1.3 and the JDBC-ODBC bridge, the getTimestamp() method will // throw a null ptr exception when the underlying value is null so just ignore it. } break; case CF_SQL_REFCURSOR: // This CF SQL Type is only used with Oracle for result sets returned by a // stored procedure. // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { rs = (ResultSet) _stmt.getObject(paramName); } else { rs = (ResultSet) _stmt.getObject(ColIndex); } if ((!_stmt.wasNull()) && (rs != null)) { outData = new cfQueryResultData(rs, "Stored Procedure", maxLength); } break; default: // With the Oracle JDBC driver, if we set the parameters using named parameters then // we must retrieve them using named parameters too. if (useNamedParameters) { str = _stmt.getString(paramName); } else { str = _stmt.getString(ColIndex); } if ((!_stmt.wasNull()) && (str != null)) { outData = new cfStringData(str); } break; } _Session.setData(outVariable, (outData == null ? cfNullData.NULL : outData)); }
public long getLong(String parameterName) throws SQLException { return passThru.getLong(parameterName); }
/** @see java.sql.CallableStatement#getLong(int) */ public long getLong(int parameterIndex) throws SQLException { return original.getLong(parameterIndex); }
/** @see java.sql.CallableStatement#getLong(java.lang.String) */ public long getLong(String parameterName) throws SQLException { return original.getLong(parameterName); }
public void save(MaintainingSetupMgr maintainingSetupMgr, Login login) throws SQLException { this.mCode = 0; CallableStatement cstmt = null; Connection conn = OracleGate.getConnection(); conn.setAutoCommit(false); try { cstmt = conn.prepareCall("begin MM_DATAMAINTAIN_PKG.MODIFY_TYPE(:1,:2,:3,:4,:5,:6,:7,:8); end;"); cstmt.setString(1, Decoder.convertSetString(this.getAttributeCode())); cstmt.setString(2, Decoder.convertSetString(this.getAttributeName())); cstmt.setString(3, Decoder.convertSetString(this.getDescription())); cstmt.setString( 6, Decoder.convertSetString(maintainingSetupMgr.getFunctionMode().split("-")[0])); cstmt.setString(7, Decoder.convertSetString(login.getEmployee().getEmployeeId())); if (this.getAttributeId() != null && !this.getAttributeId().equals("")) { cstmt.setString(8, Decoder.convertSetString(this.getAttributeId())); } else { cstmt.setNull(8, Types.VARCHAR); } cstmt.registerOutParameter(4, Types.INTEGER); cstmt.registerOutParameter(5, Types.VARCHAR); cstmt.registerOutParameter(8, Types.VARCHAR); DeBug.print("Start Save MechanicalType DeBug.Print: "); DeBug.print("1,this.getAttributeCode(): " + this.getAttributeCode()); DeBug.print("2,this.getAttributeName(): " + this.getAttributeName()); DeBug.print("3,this.getDescription(): " + this.getDescription()); DeBug.print( "6,maintainingSetupMgr.getFunctionMode().split(-)[0]: " + maintainingSetupMgr.getFunctionMode().split("-")[0]); DeBug.print("7,login.getEmployee().getEmployeeId(): " + login.getEmployee().getEmployeeId()); DeBug.print("8,this.getAttributeId(): " + this.getAttributeId()); DeBug.print("-----------END-----------"); cstmt.execute(); int returnCode = cstmt.getInt(4); String returnMessage = cstmt.getString(5); DeBug.print(String.valueOf(returnCode), "(4,in Save : the returnCode )"); DeBug.print(returnMessage, "(5,in Save : the returnMessage )"); if (returnCode == -2) { // Violate unique constraint in database conn.rollback(); this.mCode = UNIQUE_VIOLATION; } else if (returnCode != 0) { // Non-manageable error. conn.rollback(); this.mCode = SAVE_ERROR; } else { conn.commit(); this.setAttributeId(String.valueOf(cstmt.getLong(8))); this.isSaved = true; } } catch (Exception e) { conn.rollback(); this.isSaved = false; e.printStackTrace(); this.mCode = SAVE_ERROR; } finally { conn.setAutoCommit(true); if (conn != null) { OracleGate.freeConnection(conn); } try { if (cstmt != null) { cstmt.close(); } cstmt = null; } catch (Exception e) { e.printStackTrace(); } } }
private static void callGetMethod( CallableStatement cs, int arg, int type, int paramType, StringBuilder strbuf) throws Throwable { switch (type) { case Types.BIT: case Types.BOOLEAN: strbuf.append("getBoolean(" + arg + ") = "); strbuf.append(cs.getBoolean(arg)); break; case Types.TINYINT: strbuf.append("getByte(" + arg + ") = "); strbuf.append(Byte.toString(cs.getByte(arg))); break; case Types.SMALLINT: strbuf.append("getShort(" + arg + ") = "); strbuf.append(Short.toString(cs.getShort(arg))); break; case Types.INTEGER: strbuf.append("getInt(" + arg + ") = "); strbuf.append(Integer.toString(cs.getInt(arg))); break; case Types.BIGINT: strbuf.append("getLong(" + arg + ") = "); strbuf.append(Long.toString(cs.getLong(arg))); break; case Types.FLOAT: case Types.REAL: strbuf.append("getFloat(" + arg + ") = "); strbuf.append(Float.toString(cs.getFloat(arg))); break; case Types.DOUBLE: strbuf.append("getDouble(" + arg + ") = "); strbuf.append(Double.toString(cs.getDouble(arg))); break; case Types.DECIMAL: case Types.NUMERIC: strbuf.append("getBigDecimal(" + arg + ") = "); strbuf.append(BigDecimalHandler.getBigDecimalString(cs, arg, paramType)); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: strbuf.append("getString(" + arg + ") = "); String s = cs.getString(arg); if (s.startsWith("[B@")) s = "byte[] reference"; strbuf.append(s); break; case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: strbuf.append("getBytes(" + arg + ") = "); byteArrayToString(cs.getBytes(arg), strbuf); break; case Types.DATE: strbuf.append("getDate(" + arg + ") = "); Date date = cs.getDate(arg); strbuf.append(date == null ? "null" : date.toString()); break; case Types.TIME: strbuf.append("getTime(" + arg + ") = "); Time time = cs.getTime(arg); strbuf.append(time == null ? "null" : time.toString()); break; case Types.TIMESTAMP: strbuf.append("getTimestamp(" + arg + ") = "); Timestamp timestamp = cs.getTimestamp(arg); strbuf.append(timestamp == null ? "null" : timestamp.toString()); break; case Types.OTHER: strbuf.append("getObject(" + arg + ") = "); Object o = cs.getObject(arg); if (o == null) { strbuf.append("null"); } else if (o instanceof byte[]) { byteArrayToString((byte[]) o, strbuf); } else { strbuf.append(o.toString()); } break; default: throw new Throwable("TEST ERROR: unexpected type " + type); } }