mirror of
https://github.com/sprockets/sprockets-postgres.git
synced 2024-09-21 10:10:57 +00:00
Add a little context of why this code exists
This commit is contained in:
parent
9a49d769df
commit
e880017fc8
1 changed files with 7 additions and 0 deletions
|
@ -266,6 +266,13 @@ class PostgresConnector:
|
||||||
'Unexpected value for ProgrammingError(%s).pgcode: %r',
|
'Unexpected value for ProgrammingError(%s).pgcode: %r',
|
||||||
err, err.pgcode)
|
err, err.pgcode)
|
||||||
|
|
||||||
|
# This logic exists so that we can wrap the results and quickly free
|
||||||
|
# the cursor / connection. We do not know if the query was a SELECT,
|
||||||
|
# INSERT, UPDATE, or DELETE and we may impact multiple rows, but not
|
||||||
|
# have any data to retrieve. The ProgrammingErrror is raised in this
|
||||||
|
# context. It is raised in other contexts, such as when there is an
|
||||||
|
# error in the query, but that will be caught on L248
|
||||||
|
|
||||||
if self.cursor.rowcount == 1:
|
if self.cursor.rowcount == 1:
|
||||||
try:
|
try:
|
||||||
row = dict(await self.cursor.fetchone())
|
row = dict(await self.cursor.fetchone())
|
||||||
|
|
Loading…
Reference in a new issue