mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Clarify in the docs that mogrify() and query always return bytes
This commit is contained in:
parent
e9661bcde5
commit
33f2301772
|
@ -215,6 +215,8 @@ The ``cursor`` class
|
||||||
exactly the one that would be sent to the database running the
|
exactly the one that would be sent to the database running the
|
||||||
`~cursor.execute()` method or similar.
|
`~cursor.execute()` method or similar.
|
||||||
|
|
||||||
|
The returned string is always a bytes string.
|
||||||
|
|
||||||
>>> cur.mogrify("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar'))
|
>>> cur.mogrify("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar'))
|
||||||
"INSERT INTO test (num, data) VALUES (42, E'bar')"
|
"INSERT INTO test (num, data) VALUES (42, E'bar')"
|
||||||
|
|
||||||
|
@ -427,11 +429,11 @@ The ``cursor`` class
|
||||||
.. attribute:: query
|
.. attribute:: query
|
||||||
|
|
||||||
Read-only attribute containing the body of the last query sent to the
|
Read-only attribute containing the body of the last query sent to the
|
||||||
backend (including bound arguments). `!None` if no query has been
|
backend (including bound arguments) as bytes string. `!None` if no
|
||||||
executed yet:
|
query has been executed yet:
|
||||||
|
|
||||||
>>> cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar'))
|
>>> cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar'))
|
||||||
>>> cur.query
|
>>> cur.query
|
||||||
"INSERT INTO test (num, data) VALUES (42, E'bar')"
|
"INSERT INTO test (num, data) VALUES (42, E'bar')"
|
||||||
|
|
||||||
.. extension::
|
.. extension::
|
||||||
|
|
Loading…
Reference in New Issue
Block a user