Fixes #11048: Removed string formatting for preparing SQL and replaced with proper use of the Trac database API. These changes should prevent the possibility of SQL injection and improve cross-DB compatibility.

0.3dev: Don't modify the component_default_cc table if the Component name is being changed to the name of an already existing component, as trac.ticket.model.ComponentAdmin will raise a TracError (or an IntegrityError for Trac < 1.0) and abort the transaction. Fixes #11039.