public long [ ] executeInsert ( Connection conn , DataObject object , boolean generatedKeys ) throws SQLException { PreparedStatement statement = conn . prepareStatement ( _sql , generatedKeys ? Statement . RETURN_GENERATED_KEYS : Statement . NO_GENERATED_KEYS ) ; try { load ( statement , object ) ; long [ ] keys = new long [ statement . executeUpdate ( ) ] ; if ( generatedKeys ) { ResultSet rs = statement . getGeneratedKeys ( ) ; for ( int i = 0 ; rs . next ( ) ; ++ i ) { keys [ i ] = rs . getLong ( 1 ) ; } rs . close ( ) ; } return keys ; } finally { statement . close ( ) ; } }
Executes an INSERT statement .