public Script updateName ( int id , String name ) throws Exception { PreparedStatement statement = null ; try ( Connection sqlConnection = SQLService . getInstance ( ) . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "UPDATE " + Constants . DB_TABLE_SCRIPT + " SET " + Constants . SCRIPT_NAME + " = ? " + " WHERE " + Constants . GENERIC_ID + " = ?" ) ; statement . setString ( 1 , name ) ; statement . setInt ( 2 , id ) ; statement . executeUpdate ( ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; } finally { try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } return this . getScript ( id ) ; }
Update the name of a script