)
pgconn_ptr = impl.PQconnectdb(conninfo)
+ if not pgconn_ptr:
+ raise MemoryError("couldn't allocate PGconn")
return cls(pgconn_ptr)
@classmethod
)
pgconn_ptr = impl.PQconnectStart(conninfo)
+ if not pgconn_ptr:
+ raise MemoryError("couldn't allocate PGconn")
return cls(pgconn_ptr)
def connect_poll(self):
"bytes expected, got %s instead" % type(command).__name__
)
rv = impl.PQexec(self.pgconn_ptr, command)
- if rv is None:
+ if not rv:
raise MemoryError("couldn't allocate PGresult")
return PGresult(rv)
aformats,
result_format,
)
- if rv is None:
+ if not rv:
raise MemoryError("couldn't allocate PGresult")
return PGresult(rv)
atypes = (impl.Oid * nparams)(*param_types)
rv = impl.PQprepare(self.pgconn_ptr, name, command, nparams, atypes,)
- if rv is None:
+ if not rv:
raise MemoryError("couldn't allocate PGresult")
return PGresult(rv)
aformats,
result_format,
)
- if rv is None:
+ if not rv:
raise MemoryError("couldn't allocate PGresult")
return PGresult(rv)
"'name' must be bytes, got %s instead" % type(name).__name__
)
rv = impl.PQdescribePrepared(self.pgconn_ptr, name)
- if rv is None:
+ if not rv:
raise MemoryError("couldn't allocate PGresult")
return PGresult(rv)
"'name' must be bytes, got %s instead" % type(name).__name__
)
rv = impl.PQdescribePortal(self.pgconn_ptr, name)
- if rv is None:
+ if not rv:
raise MemoryError("couldn't allocate PGresult")
return PGresult(rv)