public int executeProcedure ( Connection conn , DataObject object ) throws SQLException { CallableStatement statement = conn . prepareCall ( _sql ) ; try { for ( int i = 0 ; i < _params . length ; ++ i ) { if ( ( _params [ i ] . direction & Param . OUT ) == 0 ) continue ; statement . registerOutParameter ( i + 1 , _params [ i ] . type ) ; } load ( statement , object ) ; statement . execute ( ) ; int result = statement . getUpdateCount ( ) ; if ( object != null ) { Class < ? extends DataObject > type = object . getClass ( ) ; for ( int i = 0 ; i < _params . length ; ++ i ) { if ( ( _params [ i ] . direction & Param . OUT ) == 0 ) continue ; try { Beans . setValue ( object , Beans . getKnownField ( type , _params [ i ] . name ) , statement . getObject ( i + 1 ) ) ; } catch ( NoSuchFieldException x ) { // ignore } catch ( Exception x ) { throw new SQLException ( "Exception in storage of '" + _params [ i ] . name + "' into DataObject (" + type . getName ( ) + ' ' , x ) ; } } } return result ; } finally { statement . close ( ) ; } }
Executes a callable statement that performs updates .