PreparedStatment or Statement.executeBatch() 할때
리턴값으로 건당 갱신건수로 int[]로 넘어온다.
이때 주의점.. 아래소스가 필요할지도.
private static int getBatchCnt(int[] updates){ int tmpCnt = 0; for(int i=0; i < updates.length; i++){ if( updates[i] == Statement.SUCCESS_NO_INFO ){ //처리는 되었으나 갱신건수를 알수 없을때 ( -2 ) tmpCnt = tmpCnt + 1; }else if( updates[i] == Statement.EXECUTE_FAILED){ //처리안됨. tmpCnt = tmpCnt + 0; }else{ tmpCnt = tmpCnt + updates[i]; } } return tmpCnt; } |
DB밴더, JDBC 버전 등등의 이유로 Statement.SUCCESS_NO_INFO 인 상태가 나오는거 같은데
정확한 갱신건수로 처리를 해야하는 로직이면 우선 이것부터 확인하구 적용여부를 결정할것!!
댓글 없음:
댓글 쓰기