Add optional 'conn' argument to all APIs which use a connection.

Allows passing the connection through explicitly, rather than relying
on global or class defaults.  This should allow for connection-pooling,
as well as having different connections used in different parts of the
application.