📄 parametermapping.java
字号:
msg = " CLOUD EXT (OK)"; else if (B2_MOD[whichCall][type]) { if (sqleResult != null) showException(sqleResult); msg = " JDBC FAIL " + SQLTypes[type]; } else { if (sqleResult == null) return; // XCL12 is temp if ("22005".equals(sqleResult.getSQLState()) || "XCL12".equals(sqleResult.getSQLState())) System.out.print("IC"); else if (sqleResult.getMessage().indexOf("Illegal Conv") != -1) System.out.print("IC"); else showException(sqleResult); msg = " JDBC MATCH (INVALID)"; } System.out.println(msg); } private static void judge_setObject(boolean worked, SQLException sqleResult, int b5o, int type) { String msg; if (worked && B5[b5o][type]) msg = " JDBC MATCH(OK)"; else if (worked) msg = " CLOUD EXT (OK)"; else if (B5[b5o][type]) { if (sqleResult != null) showException(sqleResult); msg = " JDBC FAIL " + SQLTypes[type]; } else { if (sqleResult == null) return; // XCL12 is temp if ("22005".equals(sqleResult.getSQLState()) || "XCL12".equals(sqleResult.getSQLState())) System.out.print("IC"); else if (sqleResult.getMessage().indexOf("Illegal Conv") != -1) System.out.print("IC"); else showException(sqleResult); msg = " JDBC MATCH (INVALID)"; } System.out.println(msg); } private static void setXXX(Statement s, PreparedStatement psi, PreparedStatement psq, int type) throws SQLException, java.io.IOException { boolean executeBatchTests = true; // DERBY-349 - Disable executeBatch on these target types as invald conversions // using setByte() and executeBatch lead to the test hanging. if (TestUtil.isDerbyNetClientFramework()) { switch (jdbcTypes[type]) { case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: case Types.DATE: case Types.TIMESTAMP: case Types.TIME: case Types.CLOB: case Types.BLOB: executeBatchTests = false; break; } } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setByte() "); psi.setByte(1, (byte) 98); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 0, type); } // and as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setByte() as batch "); psi.setByte(1, (byte) 98); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 0, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setShort() "); psi.setShort(1, (short) 98); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 1, type); } // and as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setShort() as batch "); psi.setShort(1, (short) 98); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 1, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setInt() "); psi.setInt(1, 98); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 2, type); } // and as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setInt() as batch "); psi.setInt(1, 98); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 2, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setLong() "); psi.setLong(1, 98L); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 3, type); } // as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setLong() as batch "); psi.setLong(1, 98L); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 3, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setFloat() "); psi.setFloat(1, 98.4f); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 4, type); } // and as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setFloat() as batch "); psi.setFloat(1, 98.4f); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 4, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setDouble() "); psi.setDouble(1, 98.5); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 5, type); } // as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setDouble() as batch "); psi.setDouble(1, 98.5); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 5, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setBigDecimal() "); psi.setBigDecimal(1, new BigDecimal(99.0)); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 6, type); } // as a batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setBigDecimal() as batch "); psi.setBigDecimal(1, new BigDecimal(99.0)); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 6, type); } // null BigDecimal { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setBigDecimal(null) "); psi.setBigDecimal(1, null); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 6, type); } // null BigDecimal if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setBigDecimal(null) as batch "); psi.setBigDecimal(1, null); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 6, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setBoolean() "); psi.setBoolean(1, true); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 7, type); } if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setBoolean() as batch "); psi.setBoolean(1, true); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } judge_setXXX(worked, sqleResult, 7, type); } { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setString() "); psi.setString(1, "97"); psi.executeUpdate(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } catch (Throwable t) { // JCC has some bugs System.out.println(t.getMessage()); worked = false; sqleResult = null; } judge_setXXX(worked, sqleResult, 8, type); } // as batch if (executeBatchTests) { s.execute("DELETE FROM PM.TYPE_AS"); SQLException sqleResult = null; boolean worked; try { System.out.print(" setString() as batch "); psi.setString(1, "97"); psi.addBatch(); psi.executeBatch(); getValidValue(psq, jdbcTypes[type]); worked = true; } catch (SQLException sqle) { sqleResult = sqle; worked = false; } catch (Throwable t) { // JCC has some bugs System.out.println(t.getMessage()); worked = false; sqleResult = null; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -