Xu Qian schrieb:
how to retrieve the result status of a query using pygresql library?
I have seen some functions like PGresultStatus() and pg_result_status()
in other languages.

The result is directly returned by the query function.

For a DML operation, you get the number of rows affected.

I.e. in the following example, you will get "RESULT: 3".

db = DB('test')
db.query("create table result_test (n int);")
for i in range(3):
    db.query("insert into result_test values(%d)" % i)
print "RESULT:", db.query("delete from result_test")
db.query("drop table result_test")

For a single insert, you get the OID as an integer.

-- Christoph
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql

Reply via email to