protected int insertRecord ( Connection connection , String hash ) throws SQLException { int id = - 1 ; PreparedStatement ps = setObjects ( connection , Query . INSERT_RECORD , hash ) ; ps . execute ( ) ; ResultSet rs = ps . getGeneratedKeys ( ) ; try { while ( rs . next ( ) ) { id = rs . getInt ( 1 ) ; break ; } } finally { rs . close ( ) ; ps . close ( ) ; } return id ; }
Insert a new record with the given hash and return the record id .