Fix typo in connections.py.
Fix escape_string().
Fix query string formatting for py3k.