public static void bind(PreparedStatement stmt, Object[] args) throws SQLException { for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg instanceof WebData) { // unwrap the arg to a real value represented by the web data arg = ((WebData) arg).unwrap(); } if (arg instanceof byte[]) { byte[] bytes = (byte[]) arg; stmt.setBytes(i + 1, bytes); } else if (arg instanceof UUID) { UUID uuid = (UUID) arg; byte[] bytes = Msc.uuidToBytes(uuid); stmt.setBytes(i + 1, bytes); } else if (arg instanceof TUUID) { TUUID tuuid = (TUUID) arg; stmt.setBytes(i + 1, tuuid.toBytes()); } else { stmt.setObject(i + 1, arg); } } }
public static void bind(PreparedStatement stmt, Object[] args) throws SQLException { for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg instanceof WebData) { // unwrap the arg to a real value represented by the web data arg = ((WebData) arg).unwrap(); } if (arg instanceof byte[]) { byte[] bytes = (byte[]) arg; stmt.setBytes(i + 1, bytes); } else if (arg instanceof UUID) { UUID uuid = (UUID) arg; byte[] bytes = Msc.uuidToBytes(uuid); stmt.setBytes(i + 1, bytes); } else if (arg instanceof TUUID) { TUUID tuuid = (TUUID) arg; stmt.setBytes(i + 1, tuuid.toBytes()); } else { stmt.setObject(i + 1, arg); } } }