Add Connection class, to allow for non-global use.

Preserve global APIs 'setup', 'execute_query', etc., using a global
instance of that class.
Use the instances connection, if present.
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.