JdbcPreparedStatement의 setObject

PreparedStatement의 setObject메소드로 파라미터 매핑을 했을 때 어떻게 자동으로 타입을 찾는지 궁금해서 조금 찾아봤다. // JdbcPreparedStatement @Override public void setObject(int parameterIndex, Object x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setObject(" + parameterIndex + ", x);"); } if (x == null) { setParameter(parameterIndex, ValueNull.INSTANCE); } else { setParameter(parameterIndex, DataType.convertToValue(session, x, Value.UNKNOWN)); } } catch (Exception e) { throw logAndConvert(e); } } JdbcPreparedStatement의 setObject를 보면 다음과같이 DataType.convertToValue 메서드로 타입을 변환한다. https://github.com/chris-martin/h2/blob/a639abcdfd5928ea23b7dd3827cb8567e162a0a1/h2/src/main/org/h2/value/DataType.java#L882...

2024-09-15 · 1 min · 82 words

AUTO_INCREMENT 1로 초기화 하기

ALTER TABLE tablename AUTO_INCREMENT = 1 https://stackoverflow.com/questions/8923114/how-to-reset-auto-increment-in-mysql

2024-09-15 · 1 min · 7 words