public void setBytes(String parameterName, byte[] x) throws SQLException {
   checkOpen();
   try {
     ((CallableStatement) _stmt).setBytes(parameterName, x);
   } catch (SQLException e) {
     handleException(e);
   }
 }
 public void setBytes(String parameterName, byte[] x) throws SQLException {
   checkOpen();
   try {
     _stmt.setBytes(parameterName, x);
   } catch (SQLException e) {
     handleException(e);
   }
 }
Exemplo n.º 3
0
  private static void test5116(Connection conn) throws Throwable {
    System.out.println("==============================================");
    System.out.println("TESTING FIX OF 5116 -- VAR BIT VARYING INPUT");
    System.out.println("==============================================\n");

    Statement stmt = conn.createStatement();
    stmt.executeUpdate(
        "CREATE TABLE ACTIVITY_INSTANCE_T ("
            + "AIID                               char(16) for bit data              NOT NULL ,"
            + "KIND                               INTEGER                            NOT NULL ,"
            + "PIID                               char(16) for bit data              NOT NULL ,"
            + "PTID                               char(16) for bit data              NOT NULL ,"
            + "ATID                               char(16) for bit data              NOT NULL ,"
            + "RUN_MODE                           INTEGER                            NOT NULL ,"
            + "FINISHED                           TIMESTAMP                                   ,"
            + "ACTIVATED                          TIMESTAMP                                   ,"
            + "STARTED                            TIMESTAMP                                   ,"
            + "LAST_MODIFIED                      TIMESTAMP                                   ,"
            + "LAST_STATE_CHANGE                  TIMESTAMP                                   ,"
            + "STATE                              INTEGER                            NOT NULL ,"
            + "TRANS_COND_VALUES                  VARCHAR(66) FOR BIT DATA           NOT NULL ,"
            + "NUM_CONN_ACT_EVA                   INTEGER                            NOT NULL ,"
            + "NUMBER_OF_ITERATIONS               INTEGER                            NOT NULL ,"
            + "NUMBER_OF_RETRIES                  INTEGER                            NOT NULL ,"
            + "HAS_CUSTOM_ATTRIBUTES              SMALLINT                           NOT NULL ,"
            + "NON_BLOCK_PTID                     char(16) for bit data              NOT NULL ,"
            + "NON_BLOCK_PIID                     char(16) for bit data              NOT NULL ,"
            + "EXPIRES                            TIMESTAMP                                   ,"
            + "TASK_ID                            VARCHAR(254)                                ,"
            + "UNHANDLED_EXCEPTION                BLOB(3993600)                       ,"
            + "SUB_PROCESS_PIID                   char(16) for bit data                                    ,"
            + "OWNER                              VARCHAR(32)                                 ,"
            + "USER_INPUT                         VARCHAR(130) FOR BIT DATA                   ,"
            + "DESCRIPTION                        VARCHAR(254)                                ,"
            + "VERSION_ID                         SMALLINT                           NOT NULL ,"
            + "PRIMARY KEY ( AIID ) )");

    stmt.execute(
        "CREATE PROCEDURE doInsertion(IN P1 VARCHAR(2) FOR BIT DATA) "
            + "EXTERNAL NAME '"
            + CLASS_NAME
            + "doInsertion'"
            + " MODIFIES SQL DATA LANGUAGE JAVA PARAMETER STYLE JAVA");

    CallableStatement cs = conn.prepareCall("call doInsertion (?)");
    cs.setNull(1, java.sql.Types.VARBINARY);
    cs.execute();
    byte[] b = new byte[2];
    b[0] = 1;
    b[1] = 2;
    cs.setBytes(1, b);
    cs.execute();
    cs.close();
    stmt.executeUpdate("DROP PROCEDURE doInsertion");
    stmt.close();
  }
Exemplo n.º 4
0
  /** Sets the bytes */
  @Override
  public void setBytes(String parameterName, byte[] x) throws SQLException {
    try {
      _cstmt.setBytes(parameterName, x);
    } catch (SQLException e) {
      onSqlException(e);

      throw e;
    } catch (RuntimeException e) {
      onRuntimeException(e);

      throw e;
    }
  }
Exemplo n.º 5
0
 /** @see java.sql.PreparedStatement#setBytes(int, byte[]) */
 public void setBytes(int parameterIndex, byte[] x) throws SQLException {
   original.setBytes(parameterIndex, x);
 }
Exemplo n.º 6
0
 /** @see java.sql.CallableStatement#setBytes(java.lang.String, byte[]) */
 public void setBytes(String parameterName, byte[] x) throws SQLException {
   original.setBytes(parameterName, x);
 }
Exemplo n.º 7
0
  private static void callSetMethod(CallableStatement cs, int arg, int type, StringBuilder strbuf)
      throws Throwable {
    switch (type) {
      case Types.BIT:
      case Types.BOOLEAN:
        strbuf.append("setBoolean(" + arg + ", true)");
        cs.setBoolean(arg, true);
        break;

      case Types.TINYINT:
        strbuf.append("setByte(" + arg + ", 6)");
        cs.setByte(arg, (byte) 6);
        break;

      case Types.SMALLINT:
        strbuf.append("setShort(" + arg + ", 66)");
        cs.setShort(arg, (short) 66);
        break;

      case Types.INTEGER:
        strbuf.append("setInt(" + arg + ", 666)");
        cs.setInt(arg, 666);
        break;

      case Types.BIGINT:
        strbuf.append("setLong(" + arg + ", 666)");
        cs.setLong(arg, 666);
        break;

      case Types.FLOAT:
      case Types.REAL:
        strbuf.append("setFLoat(" + arg + ", 666)");
        cs.setFloat(arg, 666);
        break;

      case Types.DOUBLE:
        strbuf.append("setDouble(" + arg + ", 666)");
        cs.setDouble(arg, 666);
        break;

      case Types.DECIMAL:
      case Types.NUMERIC:
        strbuf.append("setBigDecimal(" + arg + ", 666.666)");
        BigDecimalHandler.setBigDecimalString(cs, arg, "666.666");
        break;

      case Types.CHAR:
      case Types.VARCHAR:
      case Types.LONGVARCHAR:
        strbuf.append("setString(" + arg + ", \"Set via setString()\")");
        cs.setString(arg, "Set via setString()");
        break;

      case Types.BINARY:
      case Types.VARBINARY:
      case Types.LONGVARBINARY:
        strbuf.append("setBytes(" + arg + ", byte[])");
        byte[] myarray = new byte[16];
        myarray[0] = (byte) 255;
        cs.setBytes(arg, myarray);
        break;

      case Types.DATE:
        strbuf.append("setDate(" + arg + ", Date.valueOf(1999-09-09))");
        cs.setDate(arg, Date.valueOf("1999-09-09"));
        break;

      case Types.TIME:
        strbuf.append("setTime(" + arg + ", Time.valueOf(09:09:09))");
        cs.setTime(arg, Time.valueOf("09:09:09"));
        break;

      case Types.TIMESTAMP:
        strbuf.append("setTimestamp(" + arg + ", Timestamp.valueOf(1999-09-09 09:09:09.999))");
        cs.setTimestamp(arg, Timestamp.valueOf("1999-09-09 09:09:09.999"));
        break;

      case Types.OTHER:
        strbuf.append("setObject(" + arg + ", new BigInteger(666))");
        cs.setObject(arg, new BigInteger("666"));
        break;

      default:
        throw new Throwable("TEST ERROR: unexpected type " + type);
    }
  }
 public void setBytes(String parameterName, byte x[]) throws SQLException {
   passThru.setBytes(parameterName, x);
 }