pg_result_status() alternative?

Gerhard Häring gh at ghaering.de
Wed Jan 7 18:54:53 EST 2009


Qian Xu wrote:
> Steve Holden wrote:
>> Without knowing the full details of that particular module I would
>> hazard a guess that any database errors will raise exceptions in Python.
>> No exceptions means your database operation worked fine.
> 
> result status is not an exception.
> It means the information of frontend/backend protocal, after a SQL-statement
> is execute.
> 
> The following is a list of backend IPC commands (v3)
> ----------------------------------------------------
>   Z - Zero / Ready for Query
> [...]
> For instance:
> ----------------------------------------------------
>   SELECT * FROM my_table;
> The backend protocal should return T (Row Description) and the frontend
> protocal should return Q (Query)
> ----------------------------------------------------
>   DROP TABLE my_table;
> The backend protocal should return C (Complete) and the frontend protocal
> should return Q (Query)

What are you testing, really? "Normal" Python code should use a 
PostgreSQL DB-API module or a wrapper on top of it, like SQLAlchemy.

Generally, you shouldn't have to drop down to protocol-level functions, 
unless you're developing a PostgreSQL adapter yourself.

Care to explain why you're messing around with this low-level functions?

-- Gerhard



More information about the Python-list mailing list