Add framework for creating modified copies of client

Add a generic way to create copies of a client instance with some
settings modified.  (Switching users, databases, hosts, ..)

The modifications should not be made on the client instance itself, as
this would make it very difficult to use the API in a multithreaded
environment.