public T addUniqueKey ( final Connection _con , final String _tableName , final String _uniqueKeyName , final String _columns ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) ; cmd . append ( "alter table " ) . append ( _tableName ) . append ( " " ) . append ( "add constraint " ) . append ( _uniqueKeyName ) . append ( " " ) . append ( "unique(" ) . append ( _columns ) . append ( ")" ) ; AbstractDatabase . LOG . debug ( " ..SQL> " + cmd . toString ( ) ) ; final Statement stmt = _con . createStatement ( ) ; try { stmt . execute ( cmd . toString ( ) ) ; } finally { stmt . close ( ) ; } @ SuppressWarnings ( "unchecked" ) final T ret = ( T ) this ; return ret ; }
Adds a new unique key to given table name .