connection_factory and cursor_factory support

Fixed support of connection_factory argument.
Added support for cursor_factory argument.
Fixes #63
Fixes #64