Really throw ConnectionException on connection failure
Fix error when no connection opened

"pg_last_error(): No PostgreSQL link opened yet"
Merge pull request #155 from sanpii/invalid_connection

Invalid connection error handling.